From ce76caf3ee91ccbdb3f3d420e7c653f1b97e2e0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis-Francis=20Ratt=C3=A9-Boulianne?= Date: Tue, 20 Aug 2024 23:23:24 -0400 Subject: [PATCH] pan/bi: implement nir_intrinsic_load_draw_id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only valid on >= 9 Signed-off-by: Louis-Francis Ratté-Boulianne Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/compiler/bifrost_compile.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/panfrost/compiler/bifrost_compile.c b/src/panfrost/compiler/bifrost_compile.c index 09b8c2cfd00..95e69c2832d 100644 --- a/src/panfrost/compiler/bifrost_compile.c +++ b/src/panfrost/compiler/bifrost_compile.c @@ -117,6 +117,13 @@ bi_instance_id(bi_builder *b) return bi_preload(b, (b->shader->arch >= 9) ? 61 : 62); } +static inline bi_index +bi_draw_id(bi_builder *b) +{ + assert(b->shader->arch >= 9); + return bi_preload(b, 62); +} + static void bi_emit_jump(bi_builder *b, nir_jump_instr *instr) { @@ -1892,6 +1899,10 @@ bi_emit_intrinsic(bi_builder *b, nir_intrinsic_instr *instr) bi_mov_i32_to(b, dst, bi_instance_id(b)); break; + case nir_intrinsic_load_draw_id: + bi_mov_i32_to(b, dst, bi_draw_id(b)); + break; + case nir_intrinsic_load_subgroup_invocation: bi_mov_i32_to(b, dst, bi_fau(BIR_FAU_LANE_ID, false)); break;