OpenGL: Fix flickery crap graphics in Mario Galaxy. Was an uninitialized variable in the shader.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3654 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2009-07-02 23:16:30 +00:00
parent c97dc8df52
commit 50ccffd0a6
1 changed files with 17 additions and 13 deletions

View File

@ -223,7 +223,7 @@ const char *GenerateVertexShader(u32 components)
WRITE(p, "o.pos = float4(dot("I_PROJECTION".T0, pos), dot("I_PROJECTION".T1, pos), dot("I_PROJECTION".T2, pos), dot("I_PROJECTION".T3, pos));\n");
WRITE(p, "half4 mat, lacc;\n"
WRITE(p, "half4 mat;\n" // = half4(1,1,1,1), lacc = half4(0,0,0,0);\n"
"half3 ldir, h;\n"
"half dist, dist2, attn;\n");
@ -236,10 +236,12 @@ const char *GenerateVertexShader(u32 components)
WRITE(p, "{\n");
WRITE(p, "half4 lacc = half4(1,1,1,1);\n");
if (color.matsource) {// from vertex
if (components & (VB_HAS_COL0 << j))
WRITE(p, "mat = color%d;\n", j);
else WRITE(p, "mat = half4(1,1,1,1);\n");
else
WRITE(p, "mat = half4(1,1,1,1);\n");
}
else // from color
WRITE(p, "mat = "I_MATERIALS".C%d;\n", j+2);
@ -248,7 +250,8 @@ const char *GenerateVertexShader(u32 components)
if (color.ambsource) { // from vertex
if (components & (VB_HAS_COL0<<j) )
WRITE(p, "lacc = color%d;\n", j);
else WRITE(p, "lacc = half4(0.0f,0.0f,0.0f,0.0f);\n");
else
WRITE(p, "lacc = half4(0.0f,0.0f,0.0f,0.0f);\n");
}
else // from color
WRITE(p, "lacc = "I_MATERIALS".C%d;\n", j);
@ -317,14 +320,15 @@ const char *GenerateVertexShader(u32 components)
else {
if (alpha.enablelighting)
WRITE(p, "o.colors[%d] = mat * clamp(lacc, float4(0.0f,0.0f,0.0f,0.0f), float4(1.0f,1.0f,1.0f,1.0f));\n", j);
else WRITE(p, "o.colors[%d] = mat;\n", j);
else
WRITE(p, "o.colors[%d] = mat;\n", j);
}
WRITE(p, "}\n");
}
// zero left over channels
for (int i = xfregs.nNumChans; i < 2; ++i)
WRITE(p, "o.colors[%d] = 0;\n", i);
WRITE(p, "o.colors[%d] = float4(0,0,0,0);\n", i);
// transform texcoords
for (int i = 0; i < xfregs.numTexGens; ++i) {