nir_to_tgsi: Handle stores to compact outputs.
authorEmma Anholt <emma@anholt.net>
Mon, 20 Mar 2023 21:09:22 +0000 (14:09 -0700)
committerMarge Bot <emma+marge@anholt.net>
Wed, 29 Mar 2023 16:06:03 +0000 (16:06 +0000)
We had been relying on glsl lowering to a vec4 output, but we can just do
a tiny override here to support compact variables and drop the lowering
pass.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21940>

src/gallium/auxiliary/nir/nir_to_tgsi.c

index 5b25c21..38b9bc6 100644 (file)
@@ -722,13 +722,22 @@ ntt_output_decl(struct ntt_compile *c, nir_intrinsic_instr *instr, uint32_t *fra
        */
       bool invariant = semantics.invariant;
 
+      unsigned num_slots = semantics.num_slots;
+      if (semantics.location == VARYING_SLOT_TESS_LEVEL_INNER ||
+          semantics.location == VARYING_SLOT_TESS_LEVEL_OUTER) {
+         /* Compact vars get a num_slots in NIR as number of components, but we
+          * want the number of vec4 slots here.
+          */
+         num_slots = 1;
+      }
+
       out = ureg_DECL_output_layout(c->ureg,
                                     semantic_name, semantic_index,
                                     gs_streams,
                                     base,
                                     usage_mask,
                                     array_id,
-                                    semantics.num_slots,
+                                    num_slots,
                                     invariant);
    }