mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-28 14:02:38 +00:00
revert the mess i made in the d3d plugin. Add way to use HLSL directly without going through Cg. Not that the results look much better... i do see shadows of spinning cars in Burnout 2 after clicking around in the dark. Then it crashes.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2504 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
fca8d04a11
commit
7607d6dc6a
7 changed files with 52 additions and 105 deletions
|
@ -133,7 +133,7 @@ void GetPixelShaderId(PIXELSHADERUID &uid, u32 s_texturemask, u32 zbufrender, u3
|
|||
static void WriteStage(char *&p, int n, u32 texture_mask);
|
||||
static void WrapNonPow2Tex(char* &p, const char* var, int texmap, u32 texture_mask);
|
||||
static void WriteAlphaCompare(char *&p, int num, int comp);
|
||||
static bool WriteAlphaTest(char *&p);
|
||||
static bool WriteAlphaTest(char *&p, bool HLSL);
|
||||
static void WriteFog(char *&p, bool bOutputZ);
|
||||
|
||||
const float epsilon8bit = 1.0f / 255.0f;
|
||||
|
@ -369,7 +369,7 @@ static void BuildSwapModeTable()
|
|||
}
|
||||
}
|
||||
|
||||
const char *GeneratePixelShader(u32 texture_mask, bool has_zbuffer_target, bool bRenderZToCol0)
|
||||
const char *GeneratePixelShader(u32 texture_mask, bool has_zbuffer_target, bool bRenderZToCol0, bool HLSL)
|
||||
{
|
||||
text[sizeof(text) - 1] = 0x7C; // canary
|
||||
DVSTARTPROFILE();
|
||||
|
@ -516,7 +516,7 @@ const char *GeneratePixelShader(u32 texture_mask, bool has_zbuffer_target, bool
|
|||
|
||||
//if (bpmem.genMode.numindstages ) WRITE(p, "prev.rg = indtex0.xy;\nprev.b = 0;\n");
|
||||
|
||||
if (!WriteAlphaTest(p)) {
|
||||
if (!WriteAlphaTest(p, HLSL)) {
|
||||
// alpha test will always fail, so restart the shader and just make it an empty function
|
||||
p = pmainstart;
|
||||
WRITE(p, "discard;\n");
|
||||
|
@ -535,7 +535,9 @@ const char *GeneratePixelShader(u32 texture_mask, bool has_zbuffer_target, bool
|
|||
*/
|
||||
WriteFog(p, bOutputZ);
|
||||
WRITE(p, " ocol0 = prev;\n");
|
||||
}
|
||||
} else {
|
||||
WRITE(p, " ocol0 = prev;\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (bRenderZ) {
|
||||
|
@ -889,7 +891,7 @@ static void WriteAlphaCompare(char *&p, int num, int comp)
|
|||
}
|
||||
}
|
||||
|
||||
static bool WriteAlphaTest(char *&p)
|
||||
static bool WriteAlphaTest(char *&p, bool HLSL)
|
||||
{
|
||||
u32 op = bpmem.alphaFunc.logic;
|
||||
u32 comp[2] = {bpmem.alphaFunc.comp0,bpmem.alphaFunc.comp1};
|
||||
|
@ -928,7 +930,11 @@ static bool WriteAlphaTest(char *&p)
|
|||
}
|
||||
|
||||
// Seems we need discard for Cg and clip for d3d. sigh.
|
||||
WRITE(p, "discard( ");
|
||||
if (HLSL)
|
||||
WRITE(p, "clip( ");
|
||||
else {
|
||||
WRITE(p, "discard( ");
|
||||
}
|
||||
WriteAlphaCompare(p, 0, bpmem.alphaFunc.comp0);
|
||||
|
||||
// negated because testing the inverse condition
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
const char *GeneratePixelShader(u32 texture_mask, bool has_zbuffer_target, bool bRenderZToCol0);
|
||||
const char *GeneratePixelShader(u32 texture_mask, bool has_zbuffer_target, bool bRenderZToCol0, bool HLSL = false);
|
||||
void GetPixelShaderId(PIXELSHADERUID &, u32 s_texturemask, u32 zbufrender, u32 zBufRenderToCol0);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue