panfrost: Derive texture/sampler_count from shader
This avoids a dependency of the shader descriptor on the texture/sampler
state, which simplifies state management. It also fixes pandecode
warnings where textures/samplers are specified but not referenced.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6440>
diff --git a/src/gallium/drivers/panfrost/pan_assemble.c b/src/gallium/drivers/panfrost/pan_assemble.c
index 461f4b0..a837aae 100644
--- a/src/gallium/drivers/panfrost/pan_assemble.c
+++ b/src/gallium/drivers/panfrost/pan_assemble.c
@@ -201,6 +201,7 @@
state->reads_frag_coord = s->info.system_values_read & (1 << SYSTEM_VALUE_FRAG_COORD);
state->writes_global = s->info.writes_memory;
+ state->texture_count = s->info.num_textures;
switch (stage) {
case MESA_SHADER_VERTEX:
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 8409ec2..34a3e80 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -318,8 +318,8 @@
meta->shader = ss->shader;
meta->attribute_count = ss->attribute_count;
meta->varying_count = ss->varying_count;
- meta->texture_count = ctx->sampler_view_count[st];
- meta->sampler_count = ctx->sampler_count[st];
+ meta->texture_count = ss->texture_count;
+ meta->sampler_count = ss->texture_count; /* Combined on mesa/st */
if (dev->quirks & IS_BIFROST) {
struct mali_bifrost_properties_packed prop;
@@ -573,8 +573,8 @@
fragmeta->shader = fs->shader;
fragmeta->attribute_count = fs->attribute_count;
fragmeta->varying_count = fs->varying_count;
- fragmeta->texture_count = ctx->sampler_view_count[PIPE_SHADER_FRAGMENT];
- fragmeta->sampler_count = ctx->sampler_count[PIPE_SHADER_FRAGMENT];
+ fragmeta->texture_count = fs->texture_count;
+ fragmeta->sampler_count = fs->texture_count; /* Combined on mesa/st */
if (dev->quirks & IS_BIFROST) {
struct mali_bifrost_properties_packed prop;
diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h
index fee465f..8fb6c3a 100644
--- a/src/gallium/drivers/panfrost/pan_context.h
+++ b/src/gallium/drivers/panfrost/pan_context.h
@@ -188,6 +188,7 @@
unsigned uniform_count;
unsigned work_reg_count;
unsigned attribute_count;
+ unsigned texture_count;
bool can_discard;
bool writes_point_size;
bool writes_depth;