From 22c989de9a067eb9b6f04d0c3fa8772e8412d4d8 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Tue, 8 Oct 2013 01:04:41 +0000 Subject: [PATCH] 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. --- Source/Core/VideoCommon/PixelShaderGen.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Source/Core/VideoCommon/PixelShaderGen.cpp b/Source/Core/VideoCommon/PixelShaderGen.cpp index 58d29436a4..f9a3cb5d2f 100644 --- a/Source/Core/VideoCommon/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/PixelShaderGen.cpp @@ -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