From 4a9ae295cd189153c6d7432500dc543fe95a68ac Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 14 Jul 2025 19:12:14 -0400 Subject: [PATCH] agx: report sampler state count Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_compile.c | 4 ++++ src/asahi/compiler/agx_compile.h | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c index 32dad47ff14..5fabf86f4bb 100644 --- a/src/asahi/compiler/agx_compile.c +++ b/src/asahi/compiler/agx_compile.c @@ -1182,6 +1182,8 @@ agx_emit_image_load(agx_builder *b, agx_index dst, nir_intrinsic_instr *intr) I->mask = agx_expand_tex_to(b, &intr->def, tmp, !sparse); b->shader->out->uses_txf = true; + b->shader->out->sampler_state_count = + MAX2(b->shader->out->sampler_state_count, 1); return NULL; } @@ -2347,6 +2349,8 @@ agx_emit_tex(agx_builder *b, nir_tex_instr *instr) if (instr->op == nir_texop_txf || instr->op == nir_texop_txf_ms) { I->op = AGX_OPCODE_TEXTURE_LOAD; b->shader->out->uses_txf = true; + b->shader->out->sampler_state_count = + MAX2(b->shader->out->sampler_state_count, 1); } /* Destination masking doesn't seem to work properly for gathers (because diff --git a/src/asahi/compiler/agx_compile.h b/src/asahi/compiler/agx_compile.h index 7f423a5d5a2..d29413fe4cf 100644 --- a/src/asahi/compiler/agx_compile.h +++ b/src/asahi/compiler/agx_compile.h @@ -140,8 +140,8 @@ struct agx_shader_info { /* Uses txf and hence needs a txf sampler mapped */ bool uses_txf; - /* Number of texture state registers pushed by the preamble. */ - uint8_t texture_state_count; + /* Number of texture/sampler state registers pushed by the preamble. */ + uint8_t texture_state_count, sampler_state_count; /* Number of 16-bit registers used by the main shader and preamble * respectively.