From bda1de89db9f0ab4172aeb7eb52dbab7ca20d223 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 11 Jul 2024 15:40:09 -0400 Subject: [PATCH] asahi: eliminate load_num_workgroups from TCS unrolled ID honeykrisp doesn't want to implement this sysval, we don't need it here. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/lib/agx_nir_lower_tess.c | 5 ++--- src/asahi/lib/shaders/tessellation.cl | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/asahi/lib/agx_nir_lower_tess.c b/src/asahi/lib/agx_nir_lower_tess.c index 61b23aff285..ba504949ab4 100644 --- a/src/asahi/lib/agx_nir_lower_tess.c +++ b/src/asahi/lib/agx_nir_lower_tess.c @@ -31,9 +31,8 @@ tcs_instance_id(nir_builder *b) static nir_def * tcs_unrolled_id(nir_builder *b) { - nir_def *stride = nir_channel(b, nir_load_num_workgroups(b), 0); - - return nir_iadd(b, nir_imul(b, tcs_instance_id(b), stride), tcs_patch_id(b)); + return libagx_tcs_unrolled_id(b, nir_load_tess_param_buffer_agx(b), + nir_load_workgroup_id(b)); } uint64_t diff --git a/src/asahi/lib/shaders/tessellation.cl b/src/asahi/lib/shaders/tessellation.cl index 5dfea8345a1..f99a1e34a29 100644 --- a/src/asahi/lib/shaders/tessellation.cl +++ b/src/asahi/lib/shaders/tessellation.cl @@ -19,6 +19,12 @@ libagx_tes_patch_vertices_in(constant struct libagx_tess_args *p) return p->output_patch_size; } +uint +libagx_tcs_unrolled_id(constant struct libagx_tess_args *p, uint3 wg_id) +{ + return (wg_id.y * p->patches_per_instance) + wg_id.x; +} + ushort libagx_tcs_in_offset(uint vtx, gl_varying_slot location, uint64_t crosslane_vs_out_mask)