summaryrefslogtreecommitdiffstats
path: root/src/glsl
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2015-10-27 13:18:42 +0200
committerTapani Pälli <[email protected]>2015-10-29 17:17:42 +0200
commitafbe8b6085c4761c25b7bc49a051a08e10a87805 (patch)
tree4028c3ac7fbd059fe0781b71ab88ade883ffb263 /src/glsl
parent6ce0857e30a8484f1b190ccf37631d64e629a468 (diff)
glsl: add fragdata arrays to program resource list
This makes sure that user is still able to query properties about variables that have gotten removed by opt_dead_builtin_varyings pass. Fixes following OpenGL ES 3.1 test: ES31-CTS.program_interface_query.output-layout No Piglit regressions. v2: cleanup, drop extra parenthesis (Topi) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Marta Lofstedt <[email protected]>
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/linker.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index cfd8f81c867..48dd2d38633 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -3386,6 +3386,12 @@ add_interface_variables(struct gl_shader_program *shProg,
if (strncmp(var->name, "packed:", 7) == 0)
continue;
+ /* Skip fragdata arrays, these are handled separately
+ * by add_fragdata_arrays.
+ */
+ if (strncmp(var->name, "gl_out_FragData", 15) == 0)
+ continue;
+
if (!add_program_resource(shProg, programInterface, var,
build_stageref(shProg, var->name,
var->data.mode) | mask))
@@ -3425,6 +3431,26 @@ add_packed_varyings(struct gl_shader_program *shProg, int stage)
return true;
}
+static bool
+add_fragdata_arrays(struct gl_shader_program *shProg)
+{
+ struct gl_shader *sh = shProg->_LinkedShaders[MESA_SHADER_FRAGMENT];
+
+ if (!sh || !sh->fragdata_arrays)
+ return true;
+
+ foreach_in_list(ir_instruction, node, sh->fragdata_arrays) {
+ ir_variable *var = node->as_variable();
+ if (var) {
+ assert(var->data.mode == ir_var_shader_out);
+ if (!add_program_resource(shProg, GL_PROGRAM_OUTPUT, var,
+ 1 << MESA_SHADER_FRAGMENT))
+ return false;
+ }
+ }
+ return true;
+}
+
static char*
get_top_level_name(const char *name)
{
@@ -3701,6 +3727,9 @@ build_program_resource_list(struct gl_shader_program *shProg)
return;
}
+ if (!add_fragdata_arrays(shProg))
+ return;
+
/* Add inputs and outputs to the resource list. */
if (!add_interface_variables(shProg, shProg->_LinkedShaders[input_stage]->ir,
GL_PROGRAM_INPUT))