summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2014-10-27 16:34:06 -0700
committerKenneth Graunke <[email protected]>2014-11-06 16:20:01 -0800
commit0c0bfb2ead03789164cee364fbf405994d876ca3 (patch)
tree104685c6b0e7f46ef130440a95a171216e43b407 /src/mesa/main
parent13786172181bf5a753c706a7f5c3eb5d448e244e (diff)
glsl: Add infrastructure for "hidden" uniforms.
In the compiler, we'd like to generate implicit uniforms for internal use. These should not be visible via the GL uniform introspection API. To support that, we add a new ir_variable::how_declared value of ir_var_hidden, and plumb that through to gl_uniform_storage. v2 (idr): Fix some memory management issues in move_hidden_uniforms_to_end. The comment block on the function has more details. Signed-off-by: Kenneth Graunke <[email protected]> Signed-off-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/main/shaderapi.c6
2 files changed, 5 insertions, 2 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index be79ed3590e..7389baa1d02 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2843,6 +2843,7 @@ struct gl_shader_program
/* post-link info: */
unsigned NumUserUniformStorage;
+ unsigned NumHiddenUniforms;
struct gl_uniform_storage *UniformStorage;
/**
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 2be9092c10d..66578204f08 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -565,13 +565,15 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param
*params = _mesa_longest_attribute_name_length(shProg);
return;
case GL_ACTIVE_UNIFORMS:
- *params = shProg->NumUserUniformStorage;
+ *params = shProg->NumUserUniformStorage - shProg->NumHiddenUniforms;
return;
case GL_ACTIVE_UNIFORM_MAX_LENGTH: {
unsigned i;
GLint max_len = 0;
+ const unsigned num_uniforms =
+ shProg->NumUserUniformStorage - shProg->NumHiddenUniforms;
- for (i = 0; i < shProg->NumUserUniformStorage; i++) {
+ for (i = 0; i < num_uniforms; i++) {
/* Add one for the terminating NUL character for a non-array, and
* 4 for the "[0]" and the NUL for an array.
*/