zink: fix clip/cull dist xfb inlining
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 4 Aug 2023 19:14:21 +0000 (15:14 -0400)
committerMarge Bot <emma+marge@anholt.net>
Tue, 15 Aug 2023 11:54:06 +0000 (11:54 +0000)
these are compact arrays which don't take up slots according to normal
array i/o sizing rules

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

src/gallium/drivers/zink/zink_compiler.c

index a5d6483..088bb6f 100644 (file)
@@ -1908,7 +1908,9 @@ update_so_info(struct zink_shader *zs, nir_shader *nir, const struct pipe_stream
          if (var->data.is_xfb)
             goto out;
 
-         unsigned num_slots = glsl_count_vec4_slots(var->type, false, false);
+         unsigned num_slots = var->data.location >= VARYING_SLOT_CLIP_DIST0 && var->data.location <= VARYING_SLOT_CULL_DIST1 ?
+                              glsl_array_size(var->type) / 4 :
+                              glsl_count_vec4_slots(var->type, false, false);
          /* for each variable, iterate over all the variable's slots and inline the outputs */
          for (unsigned j = 0; j < num_slots; j++) {
             slot = var->data.location + j;