Make sure to support everything even if GPU doesn't.
This commit is contained in:
parent
d4a80ca3ec
commit
5bcbf92f43
|
@ -527,7 +527,7 @@ const char* WriteBinding(API_TYPE ApiType, const u32 num)
|
||||||
}
|
}
|
||||||
const char *WriteLocation(API_TYPE ApiType)
|
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 "";
|
return "";
|
||||||
static char result[64];
|
static char result[64];
|
||||||
sprintf(result, "uniform ");
|
sprintf(result, "uniform ");
|
||||||
|
@ -582,6 +582,7 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
|
||||||
WRITE(p, "#define saturate(x) clamp(x, 0.0f, 1.0f)\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");
|
WRITE(p, "#define lerp(x, y, z) mix(x, y, z)\n");
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < 8; ++i)
|
for (int i = 0; i < 8; ++i)
|
||||||
WRITE(p, "%suniform sampler2D samp%d;\n", WriteBinding(ApiType, i), 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");
|
WRITE(p, "\n");
|
||||||
if(ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
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_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));
|
WRITE(p, "%sfloat4 "I_KCOLORS"[4] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_KCOLORS));
|
||||||
|
|
|
@ -217,7 +217,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
|
||||||
|
|
||||||
// uniforms
|
// uniforms
|
||||||
if(ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
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_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));
|
WRITE(p, "%sfloat4 "I_PROJECTION"[4] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_PROJECTION));
|
||||||
|
|
|
@ -96,9 +96,13 @@ namespace OGL
|
||||||
|
|
||||||
// Dunno why this is needed when I have the binding
|
// Dunno why this is needed when I have the binding
|
||||||
// points statically set in the shader source
|
// points statically set in the shader source
|
||||||
|
// We should only need these two functions when we don't support binding but do support UBO
|
||||||
// Driver Bug? Nvidia GTX 570, 290.xx Driver, Linux x64
|
// Driver Bug? Nvidia GTX 570, 290.xx Driver, Linux x64
|
||||||
glUniformBlockBinding( entry.program.glprogid, 0, 1 );
|
//if(!g_ActiveConfig.backend_info.bSupportsGLSLBinding)
|
||||||
glUniformBlockBinding( entry.program.glprogid, 1, 2 );
|
{
|
||||||
|
glUniformBlockBinding( entry.program.glprogid, 0, 1 );
|
||||||
|
glUniformBlockBinding( entry.program.glprogid, 1, 2 );
|
||||||
|
}
|
||||||
|
|
||||||
// We cache our uniform locations for now
|
// We cache our uniform locations for now
|
||||||
// Once we move up to a newer version of GLSL, ~1.30
|
// Once we move up to a newer version of GLSL, ~1.30
|
||||||
|
|
Loading…
Reference in New Issue