Module: Mesa Branch: main Commit: bc99b73d70b9ab84390564ad2ade7bca998135e7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc99b73d70b9ab84390564ad2ade7bca998135e7
Author: Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl> Date: Thu Dec 14 16:43:23 2023 +0100 nir: Add nir_static_workgroup_size helper. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26679> --- src/compiler/nir/nir.c | 7 +++++++ src/compiler/nir/nir.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index b78fa575a4b..70d5a8a2279 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -3406,3 +3406,10 @@ nir_remove_non_exported(nir_shader *nir) exec_node_remove(&func->node); } } + +unsigned +nir_static_workgroup_size(const nir_shader *s) +{ + return s->info.workgroup_size[0] * s->info.workgroup_size[1] * + s->info.workgroup_size[2]; +} diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 359909befe6..1c7e137efb3 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -6515,6 +6515,9 @@ nir_remove_tex_shadow(nir_shader *shader, unsigned textures_bitmask); void nir_trivialize_registers(nir_shader *s); +unsigned +nir_static_workgroup_size(const nir_shader *s); + static inline nir_intrinsic_instr * nir_reg_get_decl(nir_def *reg) {