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

Author: Marek Olšák <marek.ol...@amd.com>
Date:   Sat Nov 18 23:59:27 2023 -0500

nir: don't declare illegal varyings in nir_create_passthrough_tcs

I called it accidentally with LAYER.

Reviewed-by: Timur Kristóf <timur.kris...@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26275>

---

 src/compiler/nir/nir_passthrough_tcs.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/compiler/nir/nir_passthrough_tcs.c 
b/src/compiler/nir/nir_passthrough_tcs.c
index baaf470506c..3ad65acf325 100644
--- a/src/compiler/nir/nir_passthrough_tcs.c
+++ b/src/compiler/nir/nir_passthrough_tcs.c
@@ -68,12 +68,19 @@ nir_create_passthrough_tcs_impl(const 
nir_shader_compiler_options *options,
    for (unsigned i = 0; i < num_locations; i++) {
       const struct glsl_type *type;
       unsigned semantic = locations[i];
-      if ((semantic <= VARYING_SLOT_VAR31 && semantic != VARYING_SLOT_EDGE) ||
-          semantic >= VARYING_SLOT_VAR0_16BIT)
-         type = glsl_array_type(glsl_vec4_type(), 0, 0);
-      else
+
+      /* These are illegal in TCS. */
+      if (semantic == VARYING_SLOT_EDGE ||
+          semantic == VARYING_SLOT_PRIMITIVE_ID ||
+          semantic == VARYING_SLOT_LAYER ||
+          semantic == VARYING_SLOT_VIEWPORT ||
+          semantic == VARYING_SLOT_VIEW_INDEX ||
+          semantic == VARYING_SLOT_VIEWPORT_MASK ||
+          semantic == VARYING_SLOT_PRIMITIVE_SHADING_RATE)
          continue;
 
+      type = glsl_array_type(glsl_vec4_type(), 0, 0);
+
       nir_variable *in = nir_create_variable_with_location(b.shader, 
nir_var_shader_in,
                                                            semantic, type);
 

Reply via email to