Mesa (master): nir/lower-atomics-to-ssbo: don't set num_components

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 16 03:41:24 UTC 2020


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

Author: Rob Clark <robdclark at chromium.org>
Date:   Mon Jun  8 14:02:16 2020 -0700

nir/lower-atomics-to-ssbo: don't set num_components

Of the possible intrinsics generated, only load_ssbo is vectorized (and
store_ssbo is never generated)

Signed-off-by: Rob Clark <robdclark at chromium.org>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5371>

---

 src/compiler/nir/nir_lower_atomics_to_ssbo.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/compiler/nir/nir_lower_atomics_to_ssbo.c b/src/compiler/nir/nir_lower_atomics_to_ssbo.c
index a72c20e5491..8c8f9f8121e 100644
--- a/src/compiler/nir/nir_lower_atomics_to_ssbo.c
+++ b/src/compiler/nir/nir_lower_atomics_to_ssbo.c
@@ -127,10 +127,16 @@ lower_instr(nir_intrinsic_instr *instr, unsigned ssbo_offset, nir_builder *b)
       break;
    }
 
-   if (new_instr->intrinsic == nir_intrinsic_load_ssbo ||
-       new_instr->intrinsic == nir_intrinsic_store_ssbo)
+   if (new_instr->intrinsic == nir_intrinsic_load_ssbo) {
       nir_intrinsic_set_align(new_instr, 4, 0);
 
+      /* we could be replacing an intrinsic with fixed # of dest
+       * num_components with one that has variable number.  So
+       * best to take this from the dest:
+       */
+      new_instr->num_components = instr->dest.ssa.num_components;
+   }
+
    nir_ssa_dest_init(&new_instr->instr, &new_instr->dest,
                      instr->dest.ssa.num_components,
                      instr->dest.ssa.bit_size, NULL);
@@ -145,11 +151,6 @@ lower_instr(nir_intrinsic_instr *instr, unsigned ssbo_offset, nir_builder *b)
       nir_ssa_def_rewrite_uses(&instr->dest.ssa, nir_src_for_ssa(&new_instr->dest.ssa));
    }
 
-   /* we could be replacing an intrinsic with fixed # of dest num_components
-    * with one that has variable number.  So best to take this from the dest:
-    */
-   new_instr->num_components = instr->dest.ssa.num_components;
-
    return true;
 }
 



More information about the mesa-commit mailing list