Fix a vertex shader generation bug that crashed Super Monkey Ball. Better shader error handling. Random warning fixes.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4170 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2009-09-02 21:19:35 +00:00
parent 50593397f3
commit 1e016dd522
8 changed files with 47 additions and 61 deletions

View File

@ -336,7 +336,7 @@ const char *GenerateVertexShader(u32 components, bool D3D)
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 );
WRITE(p, "float4 coord = float4(rawnorm0.xyz, 1.0);\n");
}
else WRITE(p, "float4 coord = 0;\n");
else WRITE(p, "float4 coord = float4(0.0f, 0.0f, 1.0f, 1.0f);\n"); // avoid errors
break;
case XF_SRCCOLORS_INROW:
_assert_( texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC0 || texinfo.texgentype == XF_TEXGEN_COLOR_STRGBC1 );
@ -346,21 +346,21 @@ const char *GenerateVertexShader(u32 components, bool D3D)
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 );
WRITE(p, "float4 coord = float4(rawnorm1.xyz, 1.0);\n");
}
else WRITE(p, "float4 coord = 0;\n");
else WRITE(p, "float4 coord = float4(0.0f, 0.0f, 1.0f, 1.0f);\n"); // avoid errors
break;
case XF_SRCBINORMAL_B_INROW:
if (components & VB_HAS_NRM2) {
_assert_( texinfo.inputform == XF_TEXINPUT_ABC1 );
WRITE(p, "float4 coord = float4(rawnorm2.xyz, 1.0);\n");
}
else WRITE(p, "float4 coord = 0;\n");
else WRITE(p, "float4 coord = float4(0.0f, 0.0f, 1.0f, 1.0f);\n"); // avoid errors
break;
default:
_assert_(texinfo.sourcerow <= XF_SRCTEX7_INROW);
if (components & (VB_HAS_UV0<<(texinfo.sourcerow - XF_SRCTEX0_INROW)) )
WRITE(p, "float4 coord = float4(tex%d.x, tex%d.y, 1.0f, 1.0f);\n", texinfo.sourcerow - XF_SRCTEX0_INROW, texinfo.sourcerow - XF_SRCTEX0_INROW);
else
WRITE(p, "float4 coord = float4(0.0f, 0.0f, 1.0f, 1.0f);\n");
WRITE(p, "float4 coord = float4(0.0f, 0.0f, 1.0f, 1.0f);\n"); // avoid errors
break;
}