Module: Mesa Branch: main Commit: 53605f226b32a16c4b153388ad8256c4ee8303fc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=53605f226b32a16c4b153388ad8256c4ee8303fc
Author: Lionel Landwerlin <[email protected]> Date: Tue May 2 12:06:59 2023 +0300 nir/lower_non_uniform_access: add get_ssbo_size handling Signed-off-by: Lionel Landwerlin <[email protected]> Reviewed-by: Rhys Perry <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22793> --- src/compiler/nir/nir.h | 1 + src/compiler/nir/nir_lower_non_uniform_access.c | 6 ++++++ src/compiler/nir/nir_opt_non_uniform_access.c | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 02f94e08665..b8022870ba7 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -5448,6 +5448,7 @@ enum nir_lower_non_uniform_access_type { nir_lower_non_uniform_ssbo_access = (1 << 1), nir_lower_non_uniform_texture_access = (1 << 2), nir_lower_non_uniform_image_access = (1 << 3), + nir_lower_non_uniform_get_ssbo_size = (1 << 4), }; /* Given the nir_src used for the resource, return the channels which might be non-uniform. */ diff --git a/src/compiler/nir/nir_lower_non_uniform_access.c b/src/compiler/nir/nir_lower_non_uniform_access.c index 1d7a0164ddd..11161580fd7 100644 --- a/src/compiler/nir/nir_lower_non_uniform_access.c +++ b/src/compiler/nir/nir_lower_non_uniform_access.c @@ -254,6 +254,12 @@ nir_lower_non_uniform_access_impl(nir_function_impl *impl, progress = true; break; + case nir_intrinsic_get_ssbo_size: + if ((options->types & nir_lower_non_uniform_get_ssbo_size) && + lower_non_uniform_access_intrin(options, &b, intrin, 0)) + progress = true; + break; + case nir_intrinsic_image_load: case nir_intrinsic_image_sparse_load: case nir_intrinsic_image_store: diff --git a/src/compiler/nir/nir_opt_non_uniform_access.c b/src/compiler/nir/nir_opt_non_uniform_access.c index 7588333cae3..182450a1b3b 100644 --- a/src/compiler/nir/nir_opt_non_uniform_access.c +++ b/src/compiler/nir/nir_opt_non_uniform_access.c @@ -171,6 +171,10 @@ nir_has_non_uniform_access_impl(nir_function_impl *impl, enum nir_lower_non_unif if ((types & nir_lower_non_uniform_image_access) && has_non_uniform_access_intrin(intrin)) return true; + } else if (intrin->intrinsic == nir_intrinsic_get_ssbo_size) { + if ((types & nir_lower_non_uniform_get_ssbo_size) && + has_non_uniform_access_intrin(intrin)) + return true; } else { /* Nothing to do */ }
