nir/lower_ssbo: Don't set align_* for atomics
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 6 Aug 2020 13:13:32 +0000 (09:13 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 11 Aug 2020 09:00:11 +0000 (09:00 +0000)
Fixes crashes when lowering atomic SSBOs:

   run: ../src/compiler/nir/nir.h:1875: nir_intrinsic_align_mul: Assertion `info->index_map[NIR_INTRINSIC_ALIGN_MUL] > 0' failed.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6204>

src/compiler/nir/nir_lower_ssbo.c

index 904d92fa7e860fe861011e0df537da1ebdd11cd2..1c861755619a894dff8df28ba05ed24712a265cf 100644 (file)
@@ -128,8 +128,10 @@ lower_ssbo_instr(nir_builder *b, nir_intrinsic_instr *intr)
    global->num_components = intr->num_components;
    global->src[is_store ? 1 : 0] = nir_src_for_ssa(address);
 
-   nir_intrinsic_set_align_mul(global, nir_intrinsic_align_mul(intr));
-   nir_intrinsic_set_align_offset(global, nir_intrinsic_align_offset(intr));
+   if (!is_atomic) {
+      nir_intrinsic_set_align_mul(global, nir_intrinsic_align_mul(intr));
+      nir_intrinsic_set_align_offset(global, nir_intrinsic_align_offset(intr));
+   }
 
    if (is_store) {
       nir_src_copy(&global->src[0], &intr->src[0], global);