diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2011-12-11 07:02:13 -0600 |
|---|---|---|
| committer | Sonicadvance1 <sonicadvance1@RH-Live.(none)> | 2012-10-09 23:41:49 -0500 |
| commit | 7f12daa0142a4e7210fa3d9ef1241083e89ee7f7 (patch) | |
| tree | 3adccd583d1974639323711460c85bf59f0c6da0 /Source/Core/VideoCommon/Src/PixelShaderGen.cpp | |
| parent | ba12c0b4f51aafd814d9d400869586d204cf43df (diff) | |
Looks like we make use of fmod, make a GLSL function for it!
Diffstat (limited to 'Source/Core/VideoCommon/Src/PixelShaderGen.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
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); |
