Mesa (main): zink: use local variable more consistently in producer shader i/o assign

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 6 23:15:22 UTC 2022


Module: Mesa
Branch: main
Commit: 91e0b919f42659ebfe91931a1530a27d0c92493a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=91e0b919f42659ebfe91931a1530a27d0c92493a

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Apr  6 10:21:32 2022 -0400

zink: use local variable more consistently in producer shader i/o assign

no functional changes

Reviewed-by: Dave Airlie <airlied at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15770>

---

 src/gallium/drivers/zink/zink_compiler.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/zink/zink_compiler.c b/src/gallium/drivers/zink/zink_compiler.c
index 4fad0a9d3c0..67539fa0265 100644
--- a/src/gallium/drivers/zink/zink_compiler.c
+++ b/src/gallium/drivers/zink/zink_compiler.c
@@ -1055,7 +1055,7 @@ static void
 assign_producer_var_io(gl_shader_stage stage, nir_variable *var, unsigned *reserved, unsigned char *slot_map)
 {
    unsigned slot = var->data.location;
-   switch (var->data.location) {
+   switch (slot) {
    case -1:
    case VARYING_SLOT_POS:
    case VARYING_SLOT_PNTC:
@@ -1074,19 +1074,19 @@ assign_producer_var_io(gl_shader_stage stage, nir_variable *var, unsigned *reser
 
    default:
       if (var->data.patch) {
-         assert(var->data.location >= VARYING_SLOT_PATCH0);
-         slot = var->data.location - VARYING_SLOT_PATCH0;
-      } else if (var->data.location >= VARYING_SLOT_VAR0 &&
+         assert(slot >= VARYING_SLOT_PATCH0);
+         slot = slot - VARYING_SLOT_PATCH0;
+      } else if (slot >= VARYING_SLOT_VAR0 &&
                  var->data.mode == nir_var_shader_in &&
                   stage == MESA_SHADER_TESS_EVAL) {
-         slot = var->data.location - VARYING_SLOT_VAR0;
+         slot = slot - VARYING_SLOT_VAR0;
       } else {
-         if (slot_map[var->data.location] == 0xff) {
+         if (slot_map[slot] == 0xff) {
             assert(*reserved < MAX_VARYING);
-            slot_map[var->data.location] = *reserved;
+            slot_map[slot] = *reserved;
             *reserved += glsl_count_vec4_slots(var->type, false, false);
          }
-         slot = slot_map[var->data.location];
+         slot = slot_map[slot];
          assert(slot < MAX_VARYING);
       }
       var->data.driver_location = slot;



More information about the mesa-commit mailing list