Mesa (main): zink: always use 32bit sample ops

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 15 14:19:04 UTC 2022


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Tue Jul  5 13:07:01 2022 -0400

zink: always use 32bit sample ops

while some (tg4) sample ops can use different bit sizes in spirv, most
cannot, and all the shader variables are always emitted as 32bit, so
ensure the 32bit type is always what's being used for sampling

cc: mesa-stable

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

---

 src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

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 6bb996c5aaa..86a7d41a98e 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
@@ -3588,9 +3588,7 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
    }
    SpvId actual_dest_type;
    if (dref && tex->op != nir_texop_tg4)
-      actual_dest_type =
-         spirv_builder_type_float(&ctx->builder,
-                                  nir_dest_bit_size(tex->dest));
+      actual_dest_type = spirv_builder_type_float(&ctx->builder, 32);
    else {
       unsigned num_components = nir_dest_num_components(tex->dest);
       switch (nir_alu_type_get_base_type(tex->dest_type)) {
@@ -3624,10 +3622,10 @@ emit_tex(struct ntv_context *ctx, nir_tex_instr *tex)
       if (tex->op == nir_texop_tg4) {
          if (const_offset)
             spirv_builder_emit_cap(&ctx->builder, SpvCapabilityImageGatherExtended);
-         actual_dest_type = dest_type;
-         result = spirv_builder_emit_image_gather(&ctx->builder, dest_type,
+         result = spirv_builder_emit_image_gather(&ctx->builder, actual_dest_type,
                                                  load, coord, emit_uint_const(ctx, 32, tex->component),
                                                  lod, sample, const_offset, offset, dref, tex->is_sparse);
+         actual_dest_type = dest_type;
       } else
          result = spirv_builder_emit_image_fetch(&ctx->builder, actual_dest_type,
                                                  image, coord, lod, sample, const_offset, offset, tex->is_sparse);



More information about the mesa-commit mailing list