Module: Mesa Branch: main Commit: 9cc9cf77a8f7dd5548509ae2b67ac7c79fa87253 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9cc9cf77a8f7dd5548509ae2b67ac7c79fa87253
Author: Timur Kristóf <[email protected]> Date: Fri Jan 21 19:23:15 2022 +0100 aco: Fix multiview view index for mesh shaders. Signed-off-by: Timur Kristóf <[email protected]> Reviewed-by: Rhys Perry <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15034> --- 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));
