vertex shader generator: don't multiply z by two in d3d mode (thanks drk|razi)
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4098 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
78bd8c874a
commit
8827c22c60
|
@ -76,7 +76,7 @@ static char text[16384];
|
|||
|
||||
char *GenerateLightShader(char* p, int index, const LitChannel& chan, const char* dest, int coloralpha);
|
||||
|
||||
const char *GenerateVertexShader(u32 components)
|
||||
const char *GenerateVertexShader(u32 components, bool D3D)
|
||||
{
|
||||
text[sizeof(text) - 1] = 0x7C; // canary
|
||||
DVSTARTPROFILE();
|
||||
|
@ -436,25 +436,13 @@ const char *GenerateVertexShader(u32 components)
|
|||
WRITE(p, "o.tex3.w = o.pos.w;\n");
|
||||
}
|
||||
|
||||
// if (bpmem.fog.c_proj_fsel.fsel != 0) {
|
||||
// switch (bpmem.fog.c_proj_fsel.fsel) {
|
||||
// case 1: // linear
|
||||
// break;
|
||||
// case 4: // exp
|
||||
// break;
|
||||
// case 5: // exp2
|
||||
// break;
|
||||
// case 6: // backward exp
|
||||
// break;
|
||||
// case 7: // backward exp2
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// WRITE(p, "o.fog = o.pos.z/o.pos.w;\n");
|
||||
// }
|
||||
|
||||
// scale to gl clip space
|
||||
WRITE(p, "o.pos.z = (o.pos.z * 2.0f) + o.pos.w;\n");
|
||||
// Why are we adding w to z?
|
||||
if (!D3D) {
|
||||
// scale to gl clip space
|
||||
WRITE(p, "o.pos.z = (o.pos.z * 2.0f) + o.pos.w;\n");
|
||||
} else {
|
||||
WRITE(p, "o.pos.z = o.pos.z + o.pos.w;\n");
|
||||
}
|
||||
|
||||
WRITE(p, "return o;\n}\n");
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
const char *GenerateVertexShader(u32 components);
|
||||
const char *GenerateVertexShader(u32 components, bool D3D);
|
||||
void GetVertexShaderId(VERTEXSHADERUID& vid, u32 components);
|
||||
|
||||
#endif // GCOGL_VERTEXSHADER_H
|
||||
|
|
|
@ -86,7 +86,7 @@ void VertexShaderCache::SetShader(u32 components)
|
|||
}
|
||||
|
||||
bool HLSL = false;
|
||||
const char *code = GenerateVertexShader(components);
|
||||
const char *code = GenerateVertexShader(components, true);
|
||||
LPDIRECT3DVERTEXSHADER9 shader = HLSL ? D3D::CompileVertexShader(code, (int)strlen(code), false) : CompileCgShader(code);
|
||||
if (shader)
|
||||
{
|
||||
|
|
|
@ -85,7 +85,7 @@ VERTEXSHADER* VertexShaderCache::GetShader(u32 components)
|
|||
}
|
||||
|
||||
VSCacheEntry& entry = vshaders[uid];
|
||||
const char *code = GenerateVertexShader(components);
|
||||
const char *code = GenerateVertexShader(components, false);
|
||||
|
||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||
if (g_Config.iLog & CONF_SAVESHADERS && code) {
|
||||
|
|
Loading…
Reference in New Issue