Module: Mesa Branch: main Commit: e82c11df66a58a2aea4fe43e60d76e51f9c76826 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e82c11df66a58a2aea4fe43e60d76e51f9c76826
Author: Samuel Pitoiset <[email protected]> Date: Mon Feb 20 09:05:55 2023 +0100 ac/nir: add resinfo lowering for sliced storage 3D views The first layer isn't necessarily 0 and depth shouldn't be minified. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21359> --- 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. */
