aco: Emit VRS rate when it's per-primitive.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14193>
This commit is contained in:
Timur Kristóf 2021-12-17 17:54:12 +01:00 committed by Marge Bot
parent 811c001049
commit bc94c2718a
1 changed files with 9 additions and 1 deletions

View File

@ -10847,8 +10847,9 @@ create_vs_exports(isel_context* ctx)
int next_pos = 0;
export_vs_varying(ctx, VARYING_SLOT_POS, true, &next_pos);
bool force_vrs_per_vertex = ctx->options->force_vrs_rates && ctx->stage != mesh_ngg;
bool writes_primitive_shading_rate =
outinfo->writes_primitive_shading_rate || ctx->options->force_vrs_rates;
outinfo->writes_primitive_shading_rate || force_vrs_per_vertex;
if (outinfo->writes_pointsize || outinfo->writes_layer || outinfo->writes_viewport_index ||
writes_primitive_shading_rate) {
export_vs_psiz_layer_viewport_vrs(ctx, &next_pos, outinfo);
@ -10916,6 +10917,11 @@ create_primitive_exports(isel_context *ctx, Temp prim_ch1)
Temp tmp = ctx->outputs.temps[VARYING_SLOT_VIEWPORT * 4u];
ch2 = bld.vop3(aco_opcode::v_lshl_or_b32, bld.def(v1), tmp, Operand::c32(20), ch2);
}
if (outinfo->writes_primitive_shading_rate_per_primitive) {
en_mask |= 2;
Temp tmp = ctx->outputs.temps[VARYING_SLOT_PRIMITIVE_SHADING_RATE * 4u];
ch2 = bld.vop2(aco_opcode::v_or_b32, bld.def(v1), tmp, ch2);
}
Operand prim_ch2 = (en_mask & 2) ? Operand(ch2) : Operand(v1);
@ -10927,6 +10933,8 @@ create_primitive_exports(isel_context *ctx, Temp prim_ch1)
for (unsigned i = 0; i <= VARYING_SLOT_VAR31; ++i) {
if (!(ctx->shader->info.per_primitive_outputs & BITFIELD64_BIT(i)))
continue;
if (i == VARYING_SLOT_PRIMITIVE_SHADING_RATE)
continue;
export_vs_varying(ctx, i, false, NULL);
}