panfrost: Derive texture/sampler_count from shader
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 21 Aug 2020 14:03:15 +0000 (10:03 -0400)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Tue, 25 Aug 2020 15:05:37 +0000 (17:05 +0200)
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>

src/gallium/drivers/panfrost/pan_assemble.c
src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_context.h

index 461f4b06a10dbf1fb2724bc9087e59a465f76ee5..a837aaeb282a02e320357a02d4a2e5eb707577bb 100644 (file)
@@ -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->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:
 
         switch (stage) {
         case MESA_SHADER_VERTEX:
index 8409ec253437d81b0650703b25d1f2140c55ead4..34a3e8055e1fcce75e1690d967fbf893c43daeb0 100644 (file)
@@ -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->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;
 
         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->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;
 
         if (dev->quirks & IS_BIFROST) {
                 struct mali_bifrost_properties_packed prop;
index fee465fb727e701f9c0cfd00dd2f4c674c7d8b52..8fb6c3a3ad14b4b0cd18f7083d8a06c482142a9a 100644 (file)
@@ -188,6 +188,7 @@ struct panfrost_shader_state {
         unsigned uniform_count;
         unsigned work_reg_count;
         unsigned attribute_count;
         unsigned uniform_count;
         unsigned work_reg_count;
         unsigned attribute_count;
+        unsigned texture_count;
         bool can_discard;
         bool writes_point_size;
         bool writes_depth;
         bool can_discard;
         bool writes_point_size;
         bool writes_depth;