Mesa (master): glsl: Pass stage to add_interface_variables().

Kenneth Graunke kwg at kemper.freedesktop.org
Sat Apr 2 05:05:33 UTC 2016


Module: Mesa
Branch: master
Commit: 356c99b4e79631e195058a2796eba0cdfc1d7a29
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=356c99b4e79631e195058a2796eba0cdfc1d7a29

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Mar 29 11:31:10 2016 -0700

glsl: Pass stage to add_interface_variables().

add_interface_variables is supposed to add variables from either the
first or last stage of a linked shader.  But it has no way of knowing
the stage it's being asked to process, which makes it impossible to
produce correct stagerefs.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>

---

 src/compiler/glsl/linker.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index cd096ba..52df52c 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -3519,8 +3519,10 @@ create_shader_variable(struct gl_shader_program *shProg, const ir_variable *in)
 
 static bool
 add_interface_variables(struct gl_shader_program *shProg,
-                        exec_list *ir, GLenum programInterface)
+                        unsigned stage, GLenum programInterface)
 {
+   exec_list *ir = shProg->_LinkedShaders[stage]->ir;
+
    foreach_in_list(ir_instruction, node, ir) {
       ir_variable *var = node->as_variable();
       uint8_t mask = 0;
@@ -3893,12 +3895,10 @@ build_program_resource_list(struct gl_context *ctx,
       return;
 
    /* Add inputs and outputs to the resource list. */
-   if (!add_interface_variables(shProg, shProg->_LinkedShaders[input_stage]->ir,
-                                GL_PROGRAM_INPUT))
+   if (!add_interface_variables(shProg, input_stage, GL_PROGRAM_INPUT))
       return;
 
-   if (!add_interface_variables(shProg, shProg->_LinkedShaders[output_stage]->ir,
-                                GL_PROGRAM_OUTPUT))
+   if (!add_interface_variables(shProg, output_stage, GL_PROGRAM_OUTPUT))
       return;
 
    /* Add transform feedback varyings. */




More information about the mesa-commit mailing list