From 2fca9dcedf24786bf04525d07e2fe904d7a9a22b Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 4 Jul 2025 18:10:29 -0400 Subject: [PATCH] asahi/clc: promote bindless textures Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/clc/asahi_clc.c | 7 +++++++ src/asahi/compiler/agx_compile.h | 1 + src/asahi/lib/agx_bg_eot.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/asahi/clc/asahi_clc.c b/src/asahi/clc/asahi_clc.c index 4b5b469b74b..80f8412219c 100644 --- a/src/asahi/clc/asahi_clc.c +++ b/src/asahi/clc/asahi_clc.c @@ -347,6 +347,13 @@ main(int argc, char **argv) bool is_helper = !strcmp(libfunc->name, "libagx_helper"); struct agx_shader_key key = { .promote_constants = !is_helper, + + /* Most of the internal programs don't use textures at all, but + * the few that do are exclusively bindless, so we want to + * promote their access. + */ + .promote_textures = true, + .reserved_preamble = layout.size_B / 2, .is_helper = is_helper, }; diff --git a/src/asahi/compiler/agx_compile.h b/src/asahi/compiler/agx_compile.h index 13635c7abe3..7f423a5d5a2 100644 --- a/src/asahi/compiler/agx_compile.h +++ b/src/asahi/compiler/agx_compile.h @@ -178,6 +178,7 @@ static inline struct agx_precompiled_kernel_info agx_compact_kernel_info(struct agx_shader_info *info) { assert(info->has_preamble == (info->nr_preamble_gprs > 0)); + assert(info->texture_state_count <= 8 && "static maximum, no need to plumb"); return (struct agx_precompiled_kernel_info){ .preamble_offset = info->preamble_offset, diff --git a/src/asahi/lib/agx_bg_eot.c b/src/asahi/lib/agx_bg_eot.c index 0045907de55..3aed6795875 100644 --- a/src/asahi/lib/agx_bg_eot.c +++ b/src/asahi/lib/agx_bg_eot.c @@ -261,7 +261,7 @@ agx_get_precompiled_locked(struct agx_bg_eot_cache *cache, unsigned program) /* Bake launch */ agx_pack(&p->b.launch, CDM_LAUNCH_WORD_0, cfg) { - cfg.texture_state_register_count = 0; + cfg.texture_state_register_count = 8 /* same encoding as 0 */; cfg.sampler_state_register_count = 1; cfg.uniform_register_count = info->push_count; cfg.preshader_register_count = info->nr_preamble_gprs;