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

Author: Mike Blumenkrantz <[email protected]>
Date:   Mon Oct 17 11:07:34 2022 -0400

zink: pass image type to image emission

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19327>

---

 src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 9 +++++----
 1 file changed, 5 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 67c7214f99f..b065af4b403 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
@@ -996,14 +996,13 @@ get_image_type(struct ntv_context *ctx, struct 
nir_variable *var, bool is_sample
 }
 
 static SpvId
-emit_image(struct ntv_context *ctx, struct nir_variable *var, bool bindless)
+emit_image(struct ntv_context *ctx, struct nir_variable *var, SpvId 
image_type, bool bindless)
 {
    if (var->data.bindless)
       return 0;
    const struct glsl_type *type = glsl_without_array(var->type);
 
    bool is_sampler = glsl_type_is_sampler(type);
-   SpvId image_type = get_bare_image_type(ctx, var, is_sampler);
    SpvId var_type = is_sampler ? 
spirv_builder_type_sampled_image(&ctx->builder, image_type) : image_type;
    bool mediump = (var->data.precision == GLSL_PRECISION_MEDIUM || 
var->data.precision == GLSL_PRECISION_LOW);
 
@@ -4540,8 +4539,10 @@ nir_to_spirv(struct nir_shader *s, const struct 
zink_shader_info *sinfo, uint32_
    }
    nir_foreach_variable_with_modes(var, s, nir_var_uniform | nir_var_image) {
       const struct glsl_type *type = glsl_without_array(var->type);
-      if (glsl_type_is_sampler(type) || glsl_type_is_image(type))
-         emit_image(&ctx, var, false);
+      if (glsl_type_is_sampler(type))
+         emit_image(&ctx, var, get_bare_image_type(&ctx, var, true), false);
+      else if (glsl_type_is_image(type))
+         emit_image(&ctx, var, get_bare_image_type(&ctx, var, false), false);
    }
 
    switch (s->info.stage) {

Reply via email to