From e82c11df66a58a2aea4fe43e60d76e51f9c76826 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 20 Feb 2023 09:05:55 +0100 Subject: [PATCH] ac/nir: add resinfo lowering for sliced storage 3D views MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The first layer isn't necessarily 0 and depth shouldn't be minified. Signed-off-by: Samuel Pitoiset Reviewed-by: Marek Olšák Part-of: --- src/amd/common/ac_nir_lower_resinfo.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/amd/common/ac_nir_lower_resinfo.c b/src/amd/common/ac_nir_lower_resinfo.c index 7c91ee07548..9664f199321 100644 --- a/src/amd/common/ac_nir_lower_resinfo.c +++ b/src/amd/common/ac_nir_lower_resinfo.c @@ -167,6 +167,17 @@ lower_query_size(nir_builder *b, nir_ssa_def *desc, nir_src *lod, } } + /* Special case for sliced storage 3D views which shouldn't be minified. */ + if (gfx_level >= GFX10 && has_depth) { + nir_ssa_def *uav3d = + nir_ieq_imm(b, get_field(b, desc, 5, ~C_00A014_ARRAY_PITCH), 1); + nir_ssa_def *layers_3d = + nir_isub(b, get_field(b, desc, 4, ~C_00A010_DEPTH), + get_field(b, desc, 4, ~C_00A010_BASE_ARRAY)); + layers_3d = nir_iadd_imm(b, layers_3d, 1); + depth = nir_bcsel(b, uav3d, layers_3d, depth); + } + nir_ssa_def *result = NULL; /* Construct the result. */