zink: set multiviewport cap in ntv when gl_ViewportIndex is a written output

this cap varies based on the shader stage, but it must be enabled any time this
output is written

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6349>
This commit is contained in:
Mike Blumenkrantz 2020-08-03 11:48:15 -04:00 committed by Marge Bot
parent 09be30b9e4
commit 8a2ddcb4a9
1 changed files with 7 additions and 0 deletions

View File

@ -2263,6 +2263,13 @@ nir_to_spirv(struct nir_shader *s, const struct zink_so_info *so_info)
unreachable("invalid stage");
}
if (s->info.outputs_written & BITFIELD64_BIT(VARYING_SLOT_VIEWPORT)) {
if (s->info.stage < MESA_SHADER_GEOMETRY)
spirv_builder_emit_cap(&ctx.builder, SpvCapabilityShaderViewportIndex);
else
spirv_builder_emit_cap(&ctx.builder, SpvCapabilityMultiViewport);
}
// TODO: only enable when needed
if (s->info.stage == MESA_SHADER_FRAGMENT) {
spirv_builder_emit_cap(&ctx.builder, SpvCapabilitySampled1D);