From 053e5a2c1356dc31a8c4ae9e8c9c51309e2aed8d Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 26 Mar 2020 14:14:45 +0100 Subject: [PATCH] ac/nir: split 16-bit SSBO stores on GFX6 Due to possible alignment issues, make sure to split stores of 16-bit vectors. Doom Eternal requires storageBuffer16BitAccess. Cc: 20.0 Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen Part-of: (cherry picked from commit 3cd5450df52c6a314979f5dadf2f6f9d83deb533) --- .pick_status.json | 2 +- src/amd/llvm/ac_nir_to_llvm.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 11e9648798e..3c0acc09e65 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2344,7 +2344,7 @@ "description": "ac/nir: split 16-bit SSBO stores on GFX6", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index 51a64e56934..503391bd3f2 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -1735,12 +1735,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);