Module: Mesa
Branch: master
Commit: 341dd9d834c994d2ea4ccafeda058813a4ae4447
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=341dd9d834c994d2ea4ccafeda058813a4ae4447

Author: Rhys Perry <pendingchao...@gmail.com>
Date:   Fri Mar  5 20:01:05 2021 +0000

aco: set compr for fp16 exports

Obviously this didn't affect correctness. Not sure about performance.

It also changes enabled_channels to match radeonsi.

Signed-off-by: Rhys Perry <pendingchao...@gmail.com>
Reviewed-by: Daniel Schürmann <dan...@schuermann.dev>
Fixes: f29c81f863c ("aco: use VOP2 for v_cvt_pkrtz_f16_f32 if possible")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9459>

---

 src/amd/compiler/aco_instruction_selection.cpp | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/amd/compiler/aco_instruction_selection.cpp 
b/src/amd/compiler/aco_instruction_selection.cpp
index 0446870db8d..cb9e78912cb 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -10653,6 +10653,7 @@ static bool export_fs_mrt_color(isel_context *ctx, int 
slot)
    unsigned target, col_format;
    unsigned enabled_channels = 0;
    aco_opcode compr_op = (aco_opcode)0;
+   bool compr = false;
 
    slot -= FRAG_RESULT_DATA0;
    target = V_008DFC_SQ_EXP_MRT + slot;
@@ -10707,7 +10708,7 @@ static bool export_fs_mrt_color(isel_context *ctx, int 
slot)
       for (int i = 0; i < 2; i++) {
          bool enabled = (write_mask >> (i*2)) & 0x3;
          if (enabled) {
-            enabled_channels |= 1 << i;
+            enabled_channels |= 0x3 << (i*2);
             if (is_16bit) {
                values[i] = bld.pseudo(aco_opcode::p_create_vector, bld.def(v1),
                                       values[i*2].isUndefined() ? Operand(v2b) 
: values[i*2],
@@ -10725,6 +10726,9 @@ static bool export_fs_mrt_color(isel_context *ctx, int 
slot)
             values[i] = Operand(v1);
          }
       }
+      values[2] = Operand(v1);
+      values[3] = Operand(v1);
+      compr = true;
       break;
 
    case V_028714_SPI_SHADER_UNORM16_ABGR:
@@ -10811,7 +10815,7 @@ static bool export_fs_mrt_color(isel_context *ctx, int 
slot)
          /* check if at least one of the values to be compressed is enabled */
          bool enabled = (write_mask >> (i*2)) & 0x3;
          if (enabled) {
-            enabled_channels |= 1 << (i*2);
+            enabled_channels |= 0x3 << (i*2);
             values[i] = bld.vop3(compr_op, bld.def(v1),
                                  values[i*2].isUndefined() ? Operand(0u) : 
values[i*2],
                                  values[i*2+1].isUndefined() ? Operand(0u): 
values[i*2+1]);
@@ -10821,13 +10825,14 @@ static bool export_fs_mrt_color(isel_context *ctx, 
int slot)
       }
       values[2] = Operand(v1);
       values[3] = Operand(v1);
-   } else {
+      compr = true;
+   } else if (!compr) {
       for (int i = 0; i < 4; i++)
          values[i] = enabled_channels & (1 << i) ? values[i] : Operand(v1);
    }
 
    bld.exp(aco_opcode::exp, values[0], values[1], values[2], values[3],
-           enabled_channels, target, (bool) compr_op);
+           enabled_channels, target, compr);
    return true;
 }
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to