zink: tighten emitted image spir-v caps

We might only need to emit a read or write cap for a given image. This
could provide the Vulkan driver with the chance to optimize things
slightly.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9855>
This commit is contained in:
Erik Faye-Lund
2021-03-26 14:22:01 +01:00
committed by Marge Bot
parent a3ee818b79
commit 3463b8bf41
@@ -773,8 +773,10 @@ emit_image(struct ntv_context *ctx, struct nir_variable *var)
bool is_sampler = glsl_type_is_sampler(type);
if (!is_sampler && !var->data.image.format) {
spirv_builder_emit_cap(&ctx->builder, SpvCapabilityStorageImageWriteWithoutFormat);
spirv_builder_emit_cap(&ctx->builder, SpvCapabilityStorageImageReadWithoutFormat);
if (!(var->data.access & ACCESS_NON_WRITEABLE))
spirv_builder_emit_cap(&ctx->builder, SpvCapabilityStorageImageWriteWithoutFormat);
if (!(var->data.access & ACCESS_NON_READABLE))
spirv_builder_emit_cap(&ctx->builder, SpvCapabilityStorageImageReadWithoutFormat);
}
SpvDim dimension = type_to_dim(glsl_get_sampler_dim(type), &is_ms);