zik: correct spir-v caps for textures and images
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Tue, 2 Feb 2021 11:34:45 +0000 (12:34 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 2 Feb 2021 16:00:37 +0000 (16:00 +0000)
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 <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8832>

src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c

index 2a2e4ea..97f9188 100644 (file)
@@ -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);