From 3bb61e21f8bf290773897778fbf391775ba706b9 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 21 Aug 2020 10:03:15 -0400 Subject: [PATCH] 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 Reviewed-by: Tomeu Vizoso Part-of: --- src/gallium/drivers/panfrost/pan_assemble.c | 1 + src/gallium/drivers/panfrost/pan_cmdstream.c | 8 ++++---- src/gallium/drivers/panfrost/pan_context.h | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_assemble.c b/src/gallium/drivers/panfrost/pan_assemble.c index 461f4b06a10..a837aaeb282 100644 --- a/src/gallium/drivers/panfrost/pan_assemble.c +++ b/src/gallium/drivers/panfrost/pan_assemble.c @@ -201,6 +201,7 @@ panfrost_shader_compile(struct panfrost_context *ctx, 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 8409ec25343..34a3e8055e1 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -318,8 +318,8 @@ panfrost_emit_compute_shader(struct panfrost_context *ctx, 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 @@ panfrost_emit_frag_shader(struct panfrost_context *ctx, 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 fee465fb727..8fb6c3a3ad1 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -188,6 +188,7 @@ struct panfrost_shader_state { unsigned uniform_count; unsigned work_reg_count; unsigned attribute_count; + unsigned texture_count; bool can_discard; bool writes_point_size; bool writes_depth; -- 2.30.2