Module: Mesa
Branch: staging/21.0
Commit: 5465b247ba0d1bd001bce90e71eb0bf61ef46119
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5465b247ba0d1bd001bce90e71eb0bf61ef46119

Author: Mike Blumenkrantz <[email protected]>
Date:   Tue Feb 23 11:27:20 2021 -0500

zink: fix streamout emission for super-enhanced layouts

if we get some crazy matrix types in here then we need to ensure that
we accurately unwrap them and copy the components

fixes KHR-GL46.enhanced_layouts.xfb_stride

Fixes: 1b130c42b8d ("zink: implement streamout and xfb handling in ntv")

Reviewed-by: Dave Airlie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9271>
(cherry picked from commit 1b25e3a7019ca529c2ab665a35e06f21ec4b4ebb)

---

 .pick_status.json                                    |  2 +-
 src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 14 ++++++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 93fa5ed4548..e2fdf1318c3 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -733,7 +733,7 @@
         "description": "zink: fix streamout emission for super-enhanced 
layouts",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "1b130c42b8dbed3a7cabaf47e2695e7db8429b56"
     },
diff --git a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c 
b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
index 9bf3011f6b0..32d06ada3b1 100644
--- a/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
+++ b/src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c
@@ -1039,12 +1039,18 @@ emit_so_outputs(struct ntv_context *ctx,
               * and re-pack them into the desired output type
               */
              for (unsigned c = 0; c < so_output.num_components; c++) {
-                uint32_t member[] = { so_output.start_component + c };
-                SpvId base_type = get_glsl_type(ctx, 
glsl_without_array(out_type));
+                uint32_t member[2];
+                unsigned member_idx = 0;
+                if (glsl_type_is_matrix(out_type)) {
+                   member_idx = 1;
+                   member[0] = so_output.register_index;
+                }
+                member[member_idx] = so_output.start_component + c;
+                SpvId base_type = get_glsl_basetype(ctx, 
glsl_get_base_type(glsl_without_array_or_matrix(out_type)));
 
                 if (slot == VARYING_SLOT_CLIP_DIST1)
-                   member[0] += 4;
-                components[c] = 
spirv_builder_emit_composite_extract(&ctx->builder, base_type, src, member, 1);
+                   member[member_idx] += 4;
+                components[c] = 
spirv_builder_emit_composite_extract(&ctx->builder, base_type, src, member, 1 + 
member_idx);
              }
              result = spirv_builder_emit_composite_construct(&ctx->builder, 
type, components, so_output.num_components);
          }

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to