Provide our own dot functions in GLSL since GLSL doesn't provide integer versions of this function, even though AMD and Nvidia provide their own.

This commit is contained in:
Ryan Houdek 2013-10-08 01:04:41 +00:00 committed by Tony Wasserka
parent bed442198f
commit 22c989de9a

View File

@ -257,6 +257,19 @@ static inline void GeneratePixelShader(T& out, DSTALPHA_MODE dstAlphaMode, API_T
uid_data.genMode_numtevstages = bpmem.genMode.numtevstages;
uid_data.genMode_numtexgens = bpmem.genMode.numtexgens;
// dot product for integer vectors
out.Write( "int idot(int3 x, int3 y)\n"
"{\n"
"\tint3 tmp = x * y;\n"
"\treturn tmp.x + tmp.y + tmp.z;\n"
"}\n");
out.Write( "int idot(int4 x, int4 y)\n"
"{\n"
"\tint4 tmp = x * y;\n"
"\treturn tmp.x + tmp.y + tmp.z + tmp.w;\n"
"}\n");
if (ApiType == API_OPENGL)
{
// Fmod implementation gleaned from Nvidia