Mesa (main): nir_to_tgsi: Allocate the primid sysval to num_inputs, not num_outputs.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 19 20:44:23 UTC 2022


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

Author: Emma Anholt <emma at anholt.net>
Date:   Sun Feb 13 20:33:13 2022 -0800

nir_to_tgsi: Allocate the primid sysval to num_inputs, not num_outputs.

r600 would end up looking for it past the end of its array of inputs
(which expected 1:1 ordering from declarations to driver locations).

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16043>

---

 src/gallium/auxiliary/nir/nir_to_tgsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c
index 8275dc11b28..7cd2c98d620 100644
--- a/src/gallium/auxiliary/nir/nir_to_tgsi.c
+++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c
@@ -3664,7 +3664,7 @@ nir_lower_primid_sysval_to_input_lower(nir_builder *b, nir_instr *instr, void *d
       var = nir_variable_create(b->shader, nir_var_shader_in, glsl_uint_type(), "gl_PrimitiveID");
       var->data.location = VARYING_SLOT_PRIMITIVE_ID;
       b->shader->info.inputs_read |= VARYING_BIT_PRIMITIVE_ID;
-      var->data.driver_location = b->shader->num_outputs++;
+      var->data.driver_location = b->shader->num_inputs++;
 
       *(nir_variable **)data = var;
    }



More information about the mesa-commit mailing list