summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
diff options
context:
space:
mode:
authorRyan Houdek <Sonicadvance1@gmail.com>2011-12-10 14:35:37 -0600
committerSonicadvance1 <sonicadvance1@RH-Live.(none)>2012-10-09 23:41:06 -0500
commit5bcbf92f439663900a8fe60c1fee4eea2d96a192 (patch)
tree5ec861de0a334ba77ee1bb6e667ae9e9a3ac0b1f /Source/Core/VideoCommon/Src/PixelShaderGen.cpp
parentd4a80ca3ecb595f849f4b7baebb491fa1fbc915d (diff)
Make sure to support everything even if GPU doesn't.
Diffstat (limited to 'Source/Core/VideoCommon/Src/PixelShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/PixelShaderGen.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
index bffaa5b08a..cc350c7e0a 100644
--- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
@@ -527,7 +527,7 @@ const char* WriteBinding(API_TYPE ApiType, const u32 num)
}
const char *WriteLocation(API_TYPE ApiType)
{
- if(ApiType == API_GLSL && !g_ActiveConfig.backend_info.bSupportsGLSLUBO)
+ if(ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO)
return "";
static char result[64];
sprintf(result, "uniform ");
@@ -581,6 +581,7 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
WRITE(p, "#define frac(x) fract(x)\n");
WRITE(p, "#define saturate(x) clamp(x, 0.0f, 1.0f)\n");
WRITE(p, "#define lerp(x, y, z) mix(x, y, z)\n");
+
for (int i = 0; i < 8; ++i)
WRITE(p, "%suniform sampler2D samp%d;\n", WriteBinding(ApiType, i), i);
@@ -620,7 +621,7 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
WRITE(p, "\n");
if(ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO)
- WRITE(p, "layout(std140, binding = 1) uniform PSBlock {\n");
+ WRITE(p, "layout(std140%s) uniform PSBlock {\n", g_ActiveConfig.backend_info.bSupportsGLSLBinding ? ", binding = 1" : "");
WRITE(p, "%sfloat4 "I_COLORS"[4] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_COLORS));
WRITE(p, "%sfloat4 "I_KCOLORS"[4] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_KCOLORS));