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

Author: Sergi Blanch Torne <[email protected]>
Date:   Mon Jan  8 14:59:08 2024 +0100

Revert "ac/nir: Export clip distances according to clip_cull_mask"

This reverts commit b38c776690c9c39b04c57d74f9b036de56995aff.

This commit seems to offend radeonsi-raven-piglit and radeonsi-stoney-gl.

Signed-off-by: Sergi Blanch Torne <[email protected]>
Signed-off-by: David Heidelberg <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26941>

---

 src/amd/common/ac_nir.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/amd/common/ac_nir.c b/src/amd/common/ac_nir.c
index 23a2cbd854a..a8e5f270453 100644
--- a/src/amd/common/ac_nir.c
+++ b/src/amd/common/ac_nir.c
@@ -352,19 +352,10 @@ ac_nir_export_position(nir_builder *b,
    }
 
    for (int i = 0; i < 2; i++) {
-      /* Do not check outputs_written to prevent unwritten clip/cull
-       * distance outputs by the shader, and export zero instead.
-       */
-      if (clip_cull_mask & BITFIELD_RANGE(i * 4, 4)) {
-         nir_def *clip_dist[4];
-         for (int j = 0; j < 4; j++) {
-            if (outputs[VARYING_SLOT_CLIP_DIST0 + i][j])
-               clip_dist[j] = nir_u2uN(b, outputs[VARYING_SLOT_CLIP_DIST0 + 
i][j], 32);
-            else
-               clip_dist[j] = nir_imm_zero(b, 1, 32);
-         }
+      if ((outputs_written & (VARYING_BIT_CLIP_DIST0 << i)) &&
+          (clip_cull_mask & BITFIELD_RANGE(i * 4, 4))) {
          exp[exp_num] = export(
-            b, nir_vec(b, clip_dist, ARRAY_SIZE(clip_dist)), row,
+            b, get_export_output(b, outputs[VARYING_SLOT_CLIP_DIST0 + i]), row,
             V_008DFC_SQ_EXP_POS + exp_num + exp_pos_offset, 0,
             (clip_cull_mask >> (i * 4)) & 0xf);
          exp_num++;

Reply via email to