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);
|
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
|
text[sizeof(text) - 1] = 0x7C; // canary
|
||||||
DVSTARTPROFILE();
|
DVSTARTPROFILE();
|
||||||
|
@ -436,25 +436,13 @@ const char *GenerateVertexShader(u32 components)
|
||||||
WRITE(p, "o.tex3.w = o.pos.w;\n");
|
WRITE(p, "o.tex3.w = o.pos.w;\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (bpmem.fog.c_proj_fsel.fsel != 0) {
|
// Why are we adding w to z?
|
||||||
// switch (bpmem.fog.c_proj_fsel.fsel) {
|
if (!D3D) {
|
||||||
// case 1: // linear
|
// scale to gl clip space
|
||||||
// break;
|
WRITE(p, "o.pos.z = (o.pos.z * 2.0f) + o.pos.w;\n");
|
||||||
// case 4: // exp
|
} else {
|
||||||
// break;
|
WRITE(p, "o.pos.z = o.pos.z + o.pos.w;\n");
|
||||||
// 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");
|
|
||||||
|
|
||||||
WRITE(p, "return o;\n}\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);
|
void GetVertexShaderId(VERTEXSHADERUID& vid, u32 components);
|
||||||
|
|
||||||
#endif // GCOGL_VERTEXSHADER_H
|
#endif // GCOGL_VERTEXSHADER_H
|
||||||
|
|
|
@ -86,7 +86,7 @@ void VertexShaderCache::SetShader(u32 components)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HLSL = false;
|
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);
|
LPDIRECT3DVERTEXSHADER9 shader = HLSL ? D3D::CompileVertexShader(code, (int)strlen(code), false) : CompileCgShader(code);
|
||||||
if (shader)
|
if (shader)
|
||||||
{
|
{
|
||||||
|
|
|
@ -85,7 +85,7 @@ VERTEXSHADER* VertexShaderCache::GetShader(u32 components)
|
||||||
}
|
}
|
||||||
|
|
||||||
VSCacheEntry& entry = vshaders[uid];
|
VSCacheEntry& entry = vshaders[uid];
|
||||||
const char *code = GenerateVertexShader(components);
|
const char *code = GenerateVertexShader(components, false);
|
||||||
|
|
||||||
#if defined(_DEBUG) || defined(DEBUGFAST)
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
||||||
if (g_Config.iLog & CONF_SAVESHADERS && code) {
|
if (g_Config.iLog & CONF_SAVESHADERS && code) {
|
||||||
|
|
Loading…
Reference in New Issue