agx: report sampler state count
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36127>
diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c
index 32dad47..5fabf86 100644
--- a/src/asahi/compiler/agx_compile.c
+++ b/src/asahi/compiler/agx_compile.c
@@ -1182,6 +1182,8 @@
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 @@
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 7f423a5..d29413f 100644
--- a/src/asahi/compiler/agx_compile.h
+++ b/src/asahi/compiler/agx_compile.h
@@ -140,8 +140,8 @@
/* 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.