From fcdcfd9967767e923fa99a9160f937b67afdf595 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 2 Mar 2022 13:36:21 -0500 Subject: [PATCH] zink: emit Aliased decorations for any image that isn't explicitly marked restrict these might be aliased fixes: arb_shader_image_load_store-restrict fixes #6090 Reviewed-by: Jason Ekstrand Part-of: --- .../drivers/zink/nir_to_spirv/nir_to_spirv.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 4f5929acf27..611ce9b221b 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 @@ -193,6 +193,21 @@ emit_access_decorations(struct ntv_context *ctx, nir_variable *var, SpvId var_id unreachable("unknown access bit"); } } + /* The Simple, GLSL, and Vulkan memory models can assume that aliasing is generally + * not present between the memory object declarations. Specifically, the consumer + * is free to assume aliasing is not present between memory object declarations, + * unless the memory object declarations explicitly indicate they alias. + * ... + * Applying Restrict is allowed, but has no effect. + * ... + * Only those memory object declarations decorated with Aliased or AliasedPointer may alias each other. + * + * - SPIRV 2.18.2 Aliasing + * + * thus if the variable isn't marked restrict, assume it may alias + */ + if (!(var->data.access & ACCESS_RESTRICT)) + spirv_builder_emit_decoration(&ctx->builder, var_id, SpvDecorationAliased); } static SpvOp