Module: Mesa
Branch: main
Commit: c9f8be9d5870de3c4cc5c2729936595288227e1a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c9f8be9d5870de3c4cc5c2729936595288227e1a

Author: Timur Kristóf <[email protected]>
Date:   Thu Sep  9 16:19:37 2021 +0200

ac/llvm: Implement load_num_subgroups for NGG shaders.

Signed-off-by: Timur Kristóf <[email protected]>
Reviewed-by: Qiang Yu <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17706>

---

 src/amd/llvm/ac_nir_to_llvm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c
index 44195d81e3b..a6527a017dc 100644
--- a/src/amd/llvm/ac_nir_to_llvm.c
+++ b/src/amd/llvm/ac_nir_to_llvm.c
@@ -3075,6 +3075,8 @@ static LLVMValueRef visit_load_num_subgroups(struct 
ac_nir_context *ctx)
    if (ctx->stage == MESA_SHADER_COMPUTE) {
       return LLVMBuildAnd(ctx->ac.builder, ac_get_arg(&ctx->ac, 
ctx->args->tg_size),
                           LLVMConstInt(ctx->ac.i32, 0x3f, false), "");
+   } else if (ctx->args->merged_wave_info.used) {
+      return ac_unpack_param(&ctx->ac, ac_get_arg(&ctx->ac, 
ctx->args->merged_wave_info), 28, 4);
    } else {
       return LLVMConstInt(ctx->ac.i32, 1, false);
    }

Reply via email to