Mesa (master): zink: use type of src[0] for ntv store and load ops

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 13 21:25:35 UTC 2020


Module: Mesa
Branch: master
Commit: d4f4546ada7417b0164ceb4f93a652a41438b15b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d4f4546ada7417b0164ceb4f93a652a41438b15b

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Wed Jun 17 15:06:27 2020 -0400

zink: use type of src[0] for ntv store and load ops

in some cases (e.g., gl_ClipDistance) the nir_variable type doesn't match
the needed destination type, so we can simplify this code to just use
the destination type

fixes spec at glsl-1.10@execution at interpolation@interpolation-none-gl_backcolor-smooth-vertex

Reviewed-by: Erik Faye-Lund <erik.faye-lund at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5852>

---

 src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 6 ++----
 1 file changed, 2 insertions(+), 4 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 b80f09ccccd..af8cb2d68d6 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
@@ -1586,9 +1586,8 @@ emit_load_deref(struct ntv_context *ctx, nir_intrinsic_instr *intr)
 {
    SpvId ptr = get_src(ctx, intr->src);
 
-   nir_variable *var = nir_intrinsic_get_var(intr, 0);
    SpvId result = spirv_builder_emit_load(&ctx->builder,
-                                          get_glsl_type(ctx, var->type),
+                                          get_glsl_type(ctx, nir_src_as_deref(intr->src[0])->type),
                                           ptr);
    unsigned num_components = nir_dest_num_components(intr->dest);
    unsigned bit_size = nir_dest_bit_size(intr->dest);
@@ -1602,8 +1601,7 @@ emit_store_deref(struct ntv_context *ctx, nir_intrinsic_instr *intr)
    SpvId ptr = get_src(ctx, &intr->src[0]);
    SpvId src = get_src(ctx, &intr->src[1]);
 
-   nir_variable *var = nir_intrinsic_get_var(intr, 0);
-   SpvId type = get_glsl_type(ctx, glsl_without_array(var->type));
+   SpvId type = get_glsl_type(ctx, nir_src_as_deref(intr->src[0])->type);
    SpvId result = emit_bitcast(ctx, type, src);
    spirv_builder_emit_store(&ctx->builder, ptr, result);
 }



More information about the mesa-commit mailing list