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));