From 9cc9cf77a8f7dd5548509ae2b67ac7c79fa87253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Fri, 21 Jan 2022 19:23:15 +0100 Subject: [PATCH] aco: Fix multiview view index for mesh shaders. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Timur Kristóf Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/aco_instruction_selection.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp index c3cf3db160e..3f5eb97d7f0 100644 --- a/src/amd/compiler/aco_instruction_selection.cpp +++ b/src/amd/compiler/aco_instruction_selection.cpp @@ -10747,8 +10747,8 @@ create_vs_exports(isel_context* ctx) get_arg(ctx, ctx->args->ac.vs_prim_id); } - if (ctx->options->key.has_multiview_view_index) { - assert(!outinfo->writes_layer_per_primitive); + if (ctx->options->key.has_multiview_view_index && + !outinfo->writes_layer_per_primitive) { ctx->outputs.mask[VARYING_SLOT_LAYER] |= 0x1; ctx->outputs.temps[VARYING_SLOT_LAYER * 4u] = as_vgpr(ctx, get_arg(ctx, ctx->args->ac.view_index)); @@ -10802,6 +10802,13 @@ create_primitive_exports(isel_context *ctx, Temp prim_ch1) Builder bld(ctx->program, ctx->block); + if (ctx->options->key.has_multiview_view_index && + outinfo->writes_layer_per_primitive) { + ctx->outputs.mask[VARYING_SLOT_LAYER] |= 0x1; + ctx->outputs.temps[VARYING_SLOT_LAYER * 4u] = + as_vgpr(ctx, get_arg(ctx, ctx->args->ac.view_index)); + } + /* Use zeroes if the shader doesn't write these but they are needed by eg. PS. */ if (outinfo->writes_layer_per_primitive && !ctx->outputs.mask[VARYING_SLOT_LAYER]) ctx->outputs.temps[VARYING_SLOT_LAYER * 4u] = bld.copy(bld.def(v1), Operand::c32(0));