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>
This commit is contained in:
Erik Faye-Lund 2021-04-15 10:17:55 +02:00 committed by Marge Bot
parent 451089812a
commit d09442461f
1 changed files with 2 additions and 1 deletions

View File

@ -3532,7 +3532,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);
}