Mesa (main): zink: always emit sample id 0 for non-msaa texel pointers in ntv

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Sep 7 13:29:01 UTC 2021


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Thu Sep  2 12:44:07 2021 -0400

zink: always emit sample id 0 for non-msaa texel pointers in ntv

in practice this shouldn't matter since the sample id must always be zero,
but it's still a spec violation

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

---

 src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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 2925252a36f..fa6293ef565 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
@@ -2577,10 +2577,12 @@ static void
 emit_image_intrinsic(struct ntv_context *ctx, nir_intrinsic_instr *intr)
 {
    SpvId img_var = get_src(ctx, &intr->src[0]);
-   SpvId sample = get_src(ctx, &intr->src[2]);
    SpvId param = get_src(ctx, &intr->src[3]);
    nir_variable *var = get_var_from_image(ctx, img_var);
    const struct glsl_type *type = glsl_without_array(var->type);
+   bool is_ms;
+   type_to_dim(glsl_get_sampler_dim(type), &is_ms);
+   SpvId sample = is_ms ? get_src(ctx, &intr->src[2]) : emit_uint_const(ctx, 32, 0);
    SpvId coord = get_image_coords(ctx, type, &intr->src[1]);
    SpvId base_type = get_glsl_basetype(ctx, glsl_get_sampler_result_type(type));
    SpvId texel = spirv_builder_emit_image_texel_pointer(&ctx->builder, base_type, img_var, coord, sample);



More information about the mesa-commit mailing list