summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2022-05-20 13:23:05 -0400
committerDylan Baker <dylan.c.baker@intel.com>2022-06-15 16:12:58 -0700
commit274fcc2783384d64a422140eead460484553e22f (patch)
tree0a8302b6d1fb25ba016538f717750b576f33ac76
parent9ff1f30d4508b44795f80b1ca2ec4dc833ac4e77 (diff)
zink: fix ntv partial stores
the previous conditional here was stupid and wrong: it should be comparing to see whether the writemask is the full mask of the type's size cc: mesa-stable Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16669> (cherry picked from commit 31ba19ff681224208943787cedd0b1ada11329e2)
-rw-r--r--.pick_status.json2
-rw-r--r--src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 1ab54e97a2d..ab1b06728ef 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -913,7 +913,7 @@
"description": "zink: fix ntv partial stores",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
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 4f0e514e2d4..6dbcd81f1cf 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
@@ -2191,9 +2191,9 @@ emit_store_deref(struct ntv_context *ctx, nir_intrinsic_instr *intr)
const struct glsl_type *gtype = nir_src_as_deref(intr->src[0])->type;
SpvId type = get_glsl_type(ctx, gtype);
nir_variable *var = nir_deref_instr_get_variable(nir_src_as_deref(intr->src[0]));
- unsigned num_writes = util_bitcount(nir_intrinsic_write_mask(intr));
unsigned wrmask = nir_intrinsic_write_mask(intr);
- if (num_writes && num_writes != intr->num_components) {
+ if (!glsl_type_is_scalar(gtype) &&
+ wrmask != BITFIELD_MASK(glsl_get_length(gtype))) {
/* no idea what we do if this fails */
assert(glsl_type_is_array(gtype) || glsl_type_is_vector(gtype));
@@ -2202,14 +2202,14 @@ emit_store_deref(struct ntv_context *ctx, nir_intrinsic_instr *intr)
SpvId member_type;
if (glsl_type_is_vector(gtype)) {
result_type = get_glsl_basetype(ctx, glsl_get_base_type(gtype));
- member_type = get_uvec_type(ctx, 32, 1);
+ member_type = get_uvec_type(ctx, glsl_get_bit_size(gtype), 1);
} else
member_type = result_type = get_glsl_type(ctx, glsl_get_array_element(gtype));
SpvId ptr_type = spirv_builder_type_pointer(&ctx->builder,
SpvStorageClassOutput,
result_type);
for (unsigned i = 0; i < 4; i++)
- if ((wrmask >> i) & 1) {
+ if (wrmask & BITFIELD_BIT(i)) {
SpvId idx = emit_uint_const(ctx, 32, i);
SpvId val = spirv_builder_emit_composite_extract(&ctx->builder, member_type, src, &i, 1);
val = emit_bitcast(ctx, result_type, val);