zink: fix stencil-export cap emission

This cap should only ever be emitted for fragment-shaders, but we
accidentally emit it for all shaders. Let's tighten the check to avoid a
validator warning when emitting non-fragment shaders without support for
VK_EXT_shader_stencil_export.

Fixes: 8724d4fb36 ("zink: check shader stencil output")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10249>
(cherry picked from commit d09442461f)
This commit is contained in:
Erik Faye-Lund 2021-04-15 10:17:55 +02:00 committed by Eric Engestrom
parent 4a44e69ab1
commit e624fba3b4
2 changed files with 3 additions and 2 deletions

View file

@ -958,7 +958,7 @@
"description": "zink: fix stencil-export cap emission",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "8724d4fb361795be68eeced4947758e30feffc1b"
},

View file

@ -3531,7 +3531,8 @@ nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info)
spirv_builder_emit_mem_model(&ctx.builder, SpvAddressingModelLogical,
SpvMemoryModelGLSL450);
if (s->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_STENCIL)) {
if (s->info.stage == MESA_SHADER_FRAGMENT &&
s->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_STENCIL)) {
spirv_builder_emit_extension(&ctx.builder, "SPV_EXT_shader_stencil_export");
spirv_builder_emit_cap(&ctx.builder, SpvCapabilityStencilExportEXT);
}