Mesa (main): aco: Emit VRS rate when it's per-primitive.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 4 18:07:13 UTC 2022


Module: Mesa
Branch: main
Commit: bc94c2718abf649d9eee195d2235562736b10903
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc94c2718abf649d9eee195d2235562736b10903

Author: Timur Kristóf <timur.kristof at gmail.com>
Date:   Fri Dec 17 17:54:12 2021 +0100

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

Signed-off-by: Timur Kristóf <timur.kristof at gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14193>

---

 src/amd/compiler/aco_instruction_selection.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp
index bd9eff72647..faddfee3c04 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -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);
    }



More information about the mesa-commit mailing list