summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIago Toral Quiroga <itoral@igalia.com>2017-06-16 12:05:20 +0200
committerAndres Gomez <agomez@igalia.com>2017-07-12 19:32:08 +0300
commit1a972ddd941f83f493e53e67eef3d08ec0c7e787 (patch)
tree4e211fc7683b7396c32e490497ae2db1844dd0ec
parent056681e5a1781d9a511c286984e099530f04fc6b (diff)
glsl: gl_Max{Vertex,Fragment}UniformComponents exist in all desktop GL versions
The current implementation assumed that these were replaced in GLSL >= 4.10 by gl_Max{Vertex,Fragment}UniformVectors, however this is not true: both built-ins should be produced from GLSL 4.10 onwards. This was raised by new CTS tests that are in development. Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (cherry picked from commit b70d6a2de1c90409c7a2e0d6484f350558f5c2ac)
-rw-r--r--src/compiler/glsl/builtin_variables.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/compiler/glsl/builtin_variables.cpp b/src/compiler/glsl/builtin_variables.cpp
index c232571f26e..83a2f02312b 100644
--- a/src/compiler/glsl/builtin_variables.cpp
+++ b/src/compiler/glsl/builtin_variables.cpp
@@ -631,8 +631,16 @@ builtin_variable_generator::generate_constants()
add_const("gl_MaxDrawBuffers", state->Const.MaxDrawBuffers);
/* Max uniforms/varyings: GLSL ES counts these in units of vectors; desktop
- * GL counts them in units of "components" or "floats".
+ * GL counts them in units of "components" or "floats" and also in units
+ * of vectors since GL 4.1
*/
+ if (!state->es_shader) {
+ add_const("gl_MaxFragmentUniformComponents",
+ state->Const.MaxFragmentUniformComponents);
+ add_const("gl_MaxVertexUniformComponents",
+ state->Const.MaxVertexUniformComponents);
+ }
+
if (state->is_version(410, 100)) {
add_const("gl_MaxVertexUniformVectors",
state->Const.MaxVertexUniformComponents / 4);
@@ -660,16 +668,10 @@ builtin_variable_generator::generate_constants()
state->Const.MaxDualSourceDrawBuffers);
}
} else {
- add_const("gl_MaxVertexUniformComponents",
- state->Const.MaxVertexUniformComponents);
-
/* Note: gl_MaxVaryingFloats was deprecated in GLSL 1.30+, but not
* removed
*/
add_const("gl_MaxVaryingFloats", state->ctx->Const.MaxVarying * 4);
-
- add_const("gl_MaxFragmentUniformComponents",
- state->Const.MaxFragmentUniformComponents);
}
/* Texel offsets were introduced in ARB_shading_language_420pack (which