diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2011-12-10 14:35:37 -0600 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2011-12-10 14:35:37 -0600 |
| commit | c72a244809ee9e8a645bd1f200138af727d0474b (patch) | |
| tree | 10d9225f68b2c1c44c1b0d7d958b47cccdda0e6d /Source/Core/VideoCommon | |
| parent | 5925feb6e05219be8abb43576fa7e0b639c049f7 (diff) | |
Make sure to support everything even if GPU doesn't.
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 5 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VertexShaderGen.cpp | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index 977de656d6..940a34f537 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -518,7 +518,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 "); @@ -572,6 +572,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); @@ -611,7 +612,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)); diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp index 8b945af530..67700dd647 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp @@ -217,7 +217,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType) // uniforms if(ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO) - WRITE(p, "layout(std140, binding = 2) uniform VSBlock {\n"); + WRITE(p, "layout(std140%s) uniform VSBlock {\n", g_ActiveConfig.backend_info.bSupportsGLSLBinding ? ", binding = 2" : ""); WRITE(p, "%sfloat4 "I_POSNORMALMATRIX"[6] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_POSNORMALMATRIX)); WRITE(p, "%sfloat4 "I_PROJECTION"[4] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_PROJECTION)); |
