Mesa (master): glsl: Clarify "mask" variable in add_interface_variables().

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


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

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

glsl: Clarify "mask" variable in add_interface_variables().

This is a bitfield of which stages refer to a variable.  It is not used
to mask off bits.  In fact, it's used to contribute additional bits.

Rename it and tidy a bit of the logic.

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 52df52c..3f06e3b 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -3525,7 +3525,7 @@ add_interface_variables(struct gl_shader_program *shProg,
 
    foreach_in_list(ir_instruction, node, ir) {
       ir_variable *var = node->as_variable();
-      uint8_t mask = 0;
+      uint8_t stages = 0;
 
       if (!var || var->data.how_declared == ir_var_hidden)
          continue;
@@ -3544,7 +3544,7 @@ add_interface_variables(struct gl_shader_program *shProg,
          /* Mark special built-in inputs referenced by the vertex stage so
           * that they are considered active by the shader queries.
           */
-         mask = (1 << (MESA_SHADER_VERTEX));
+         stages = (1 << (MESA_SHADER_VERTEX));
          /* FALLTHROUGH */
       case ir_var_shader_in:
          if (programInterface != GL_PROGRAM_INPUT)
@@ -3574,9 +3574,9 @@ add_interface_variables(struct gl_shader_program *shProg,
       if (!sha_v)
          return false;
 
-      if (!add_program_resource(shProg, programInterface, sha_v,
-                                build_stageref(shProg, sha_v->name,
-                                               sha_v->mode) | mask))
+      stages |= build_stageref(shProg, sha_v->name, sha_v->mode);
+
+      if (!add_program_resource(shProg, programInterface, sha_v, stages))
          return false;
    }
    return true;




More information about the mesa-commit mailing list