ac/nir: split 16-bit SSBO stores on GFX6
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 26 Mar 2020 13:14:45 +0000 (14:14 +0100)
committerMarge Bot <eric+marge@anholt.net>
Fri, 3 Apr 2020 08:01:28 +0000 (08:01 +0000)
Due to possible alignment issues, make sure to split stores of
16-bit vectors.

Doom Eternal requires storageBuffer16BitAccess.

Cc: 20.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4339>

src/amd/llvm/ac_nir_to_llvm.c

index f68253edc89c2d6a8d49b78247af0c69ff13745b..00970638516ff908b5e56ae10da132fa12930ee6 100644 (file)
@@ -1741,12 +1741,13 @@ static void visit_store_ssbo(struct ac_nir_context *ctx,
                        num_bytes = 2;
                }
 
-               /* Due to alignment issues, split stores of 8-bit vectors. */
-               if (ctx->ac.chip_class == GFX6 &&
-                    elem_size_bytes == 1 && count > 1) {
+               /* Due to alignment issues, split stores of 8-bit/16-bit
+                * vectors.
+                */
+               if (ctx->ac.chip_class == GFX6 && count > 1 && elem_size_bytes < 4) {
                        writemask |= ((1u << (count - 1)) - 1u) << (start + 1);
                        count = 1;
-                       num_bytes = 1;
+                       num_bytes = elem_size_bytes;
                }
 
                data = extract_vector_range(&ctx->ac, base_data, start, count);