[Mesa-dev] [PATCH 4/4] panfrost: Compute I/O counts from shader_info
Alyssa Rosenzweig
alyssa.rosenzweig at collabora.com
Wed Jul 24 00:06:00 UTC 2019
...rather than exposing it in the vendored compiler region.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
src/gallium/drivers/panfrost/pan_assemble.c | 17 ++++++++++++++---
src/panfrost/midgard/midgard_compile.c | 3 ---
src/panfrost/midgard/midgard_compile.h | 3 ---
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/gallium/drivers/panfrost/pan_assemble.c b/src/gallium/drivers/panfrost/pan_assemble.c
index 8ccf9125a43..c724489da3c 100644
--- a/src/gallium/drivers/panfrost/pan_assemble.c
+++ b/src/gallium/drivers/panfrost/pan_assemble.c
@@ -87,10 +87,21 @@ panfrost_shader_compile(struct panfrost_context *ctx, struct mali_shader_meta *m
memcpy(state->sysval, program.sysvals, sizeof(state->sysval[0]) * state->sysval_count);
meta->midgard1.uniform_count = MIN2(program.uniform_count, program.uniform_cutoff);
- meta->attribute_count = program.attribute_count;
- meta->varying_count = program.varying_count;
meta->midgard1.work_count = program.work_register_count;
+ switch (s->info.stage) {
+ case MESA_SHADER_VERTEX:
+ meta->attribute_count = util_bitcount64(s->info.inputs_read);
+ meta->varying_count = util_bitcount64(s->info.outputs_written);
+ break;
+ case MESA_SHADER_FRAGMENT:
+ meta->attribute_count = 0;
+ meta->varying_count = util_bitcount64(s->info.inputs_read);
+ break;
+ default:
+ unreachable("Unknown shader state");
+ }
+
state->can_discard = s->info.fs.uses_discard;
state->writes_point_size = s->info.outputs_written & VARYING_SLOT_PSIZ;
state->reads_point_coord = s->info.inputs_read & VARYING_SLOT_PNTC;
@@ -106,7 +117,7 @@ panfrost_shader_compile(struct panfrost_context *ctx, struct mali_shader_meta *m
unsigned default_vec4_swizzle = panfrost_get_default_swizzle(4);
/* Iterate the varyings and emit the corresponding descriptor */
- for (unsigned i = 0; i < program.varying_count; ++i) {
+ for (unsigned i = 0; i < meta->varying_count; ++i) {
unsigned location = program.varyings[i];
/* Default to a vec4 varying */
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index 251eaed44e0..86d97e37095 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -2477,9 +2477,6 @@ midgard_compile_shader_nir(struct midgard_screen *screen, nir_shader *nir, midga
program->sysval_count = ctx->sysval_count;
memcpy(program->sysvals, ctx->sysvals, sizeof(ctx->sysvals[0]) * ctx->sysval_count);
- program->attribute_count = (ctx->stage == MESA_SHADER_VERTEX) ? nir->num_inputs : 0;
- program->varying_count = max_varying + 1; /* Fencepost off-by-one */
-
nir_foreach_function(func, nir) {
if (!func->impl)
continue;
diff --git a/src/panfrost/midgard/midgard_compile.h b/src/panfrost/midgard/midgard_compile.h
index 3b16cbd2bb5..9f8064873f7 100644
--- a/src/panfrost/midgard/midgard_compile.h
+++ b/src/panfrost/midgard/midgard_compile.h
@@ -77,9 +77,6 @@ typedef struct {
int uniform_count;
int uniform_cutoff;
- int attribute_count;
- int varying_count;
-
/* Prepended before uniforms, mapping to SYSVAL_ names for the
* sysval */
--
2.20.1
More information about the mesa-dev
mailing list