From 84fd3b7709a4823711fcfa643fdc68f03b16f0e4 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Tue, 2 Feb 2021 12:34:45 +0100 Subject: [PATCH] zik: correct spir-v caps for textures and images There's a couple of minor issues with these the way they where: 1. All shader stages can perform texturing. So let's check for textures instead of fragment-shader 2. Not all implementations support StorageImageExtendedFormats. We don't expose image support for those implementations, but we shouldn't enable the cap just because we're texturing. Both of these issues can be tackled by splitting these into texturing and images conditionals. Reviewed-By: Mike Blumenkrantz Part-of: --- src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c | 6 +++++- 1 file changed, 5 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 2a2e4ea..97f9188 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 @@ -3348,8 +3348,12 @@ nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info, spirv_builder_emit_cap(&ctx.builder, SpvCapabilityMultiViewport); } - if (s->info.stage == MESA_SHADER_FRAGMENT || s->info.num_images) { + if (s->info.num_textures) { spirv_builder_emit_cap(&ctx.builder, SpvCapabilitySampled1D); + spirv_builder_emit_cap(&ctx.builder, SpvCapabilityImageQuery); + } + + if (s->info.num_images) { spirv_builder_emit_cap(&ctx.builder, SpvCapabilityImage1D); spirv_builder_emit_cap(&ctx.builder, SpvCapabilityImageQuery); spirv_builder_emit_cap(&ctx.builder, SpvCapabilityStorageImageExtendedFormats); -- 2.7.4