From 7f12daa0142a4e7210fa3d9ef1241083e89ee7f7 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 11 Dec 2011 07:02:13 -0600 Subject: [PATCH] Looks like we make use of fmod, make a GLSL function for it! --- Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index cc350c7e0a..3833c91c93 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -582,6 +582,15 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType WRITE(p, "#define saturate(x) clamp(x, 0.0f, 1.0f)\n"); WRITE(p, "#define lerp(x, y, z) mix(x, y, z)\n"); + // A function here + // Fmod implementation gleaned from Nvidia + // At http://http.developer.nvidia.com/Cg/fmod.html + WRITE(p, "float fmod( float x, float y )\n"); + WRITE(p, "{\n"); + WRITE(p, "float z = fract( abs( x / y) ) * abs( y );\n"); + WRITE(p, "return (x < 0) ? -z : z;\n"); + WRITE(p, "}\n"); + for (int i = 0; i < 8; ++i) WRITE(p, "%suniform sampler2D samp%d;\n", WriteBinding(ApiType, i), i);