[Mesa-dev] [PATCH 03/10] glsl: Make add_interface_variables only consider the appropriate stage.

Kenneth Graunke kenneth at whitecape.org
Thu Mar 31 18:53:36 UTC 2016


add_interface_variables() is supposed to add variables for the inputs of
the first shader stage linked into a program, and the outputs of the
last shader stage linked into a program.

>From the ARB_program_interface_query specification:

"* PROGRAM_INPUT corresponds to the set of active input variables used by
   the first shader stage of <program>.  If <program> includes multiple
   shader stages, input variables from any shader stage other than the
   first will not be enumerated.

 * PROGRAM_OUTPUT corresponds to the set of active output variables
   (section 2.14.11) used by the last shader stage of <program>.  If
   <program> includes multiple shader stages, output variables from any
   shader stage other than the last will not be enumerated."

Previously, we used build_stageref here, which walks over all linked
shaders in the program.  This meant that internal varyings would be
visible.  We don't actually need any of build_stageref's code: we
already explicitly skip packed varyings, handle modes, and the name
comparisons just do a fuzzy string comparison of name with itself.

Fixes two tests: dEQP-GLES31.functional.program_interface_query.
program_{input,output}.referenced_by.referenced_by_vertex_fragment.

These tests have a VS and FS linked together into a single program.
Both stages have an input called "shaderInput".  But the FS input
should not be visible because it isn't the first stage.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/compiler/glsl/linker.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 2b68f79..980be46 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -3574,7 +3574,7 @@ add_interface_variables(struct gl_shader_program *shProg,
       if (!sha_v)
          return false;
 
-      stages |= build_stageref(shProg, sha_v->name, sha_v->mode);
+      stages |= 1 << stage;
 
       if (!add_program_resource(shProg, programInterface, sha_v, stages))
          return false;
-- 
2.7.4



More information about the mesa-dev mailing list