summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-07-31 14:08:07 -0700
committerAlyssa Rosenzweig <[email protected]>2019-08-01 16:23:02 -0700
commitcd1be4605c21807c07eff48e983c6c7fb0ad410d (patch)
treea7525fe532f909df5103ac0f86b87ec7fd81f11a /src/gallium
parent0da52015a17527200d10a5d93ffba9accdffb4b8 (diff)
panfrost: Cleanup via payload unification
Since these are now indexable, quite a bit of code cleans up. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index dfa151729c6..b6c78340222 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -237,8 +237,8 @@ panfrost_attach_vt_framebuffer(struct panfrost_context *ctx, bool skippable)
panfrost_attach_vt_sfbd(ctx) :
panfrost_attach_vt_mfbd(ctx);
- ctx->payloads[PIPE_SHADER_VERTEX].postfix.framebuffer = framebuffer;
- ctx->payloads[PIPE_SHADER_FRAGMENT].postfix.framebuffer = framebuffer;
+ for (unsigned i = 0; i < PIPE_SHADER_TYPES; ++i)
+ ctx->payloads[i].postfix.framebuffer = framebuffer;
}
/* Reset per-frame context, called on context initialisation as well as after
@@ -254,9 +254,8 @@ panfrost_invalidate_frame(struct panfrost_context *ctx)
else
ctx->vt_framebuffer_mfbd = panfrost_emit_mfbd(ctx, ~0);
- /* The reference is now invalid */
- ctx->payloads[PIPE_SHADER_VERTEX].postfix.framebuffer = 0;
- ctx->payloads[PIPE_SHADER_FRAGMENT].postfix.framebuffer = 0;
+ for (unsigned i = 0; i < PIPE_SHADER_TYPES; ++i)
+ ctx->payloads[i].postfix.framebuffer = 0;
if (ctx->rasterizer)
ctx->dirty |= PAN_DIRTY_RASTERIZER;
@@ -745,12 +744,7 @@ panfrost_upload_sampler_descriptors(struct panfrost_context *ctx)
upload = transfer.gpu;
}
- if (t == PIPE_SHADER_FRAGMENT)
- ctx->payloads[PIPE_SHADER_FRAGMENT].postfix.sampler_descriptor = upload;
- else if (t == PIPE_SHADER_VERTEX)
- ctx->payloads[PIPE_SHADER_VERTEX].postfix.sampler_descriptor = upload;
- else
- assert(0);
+ ctx->payloads[t].postfix.sampler_descriptor = upload;
}
}
@@ -858,12 +852,7 @@ panfrost_upload_texture_descriptors(struct panfrost_context *ctx)
trampoline = panfrost_upload_transient(ctx, trampolines, sizeof(uint64_t) * ctx->sampler_view_count[t]);
}
- if (t == PIPE_SHADER_FRAGMENT)
- ctx->payloads[PIPE_SHADER_FRAGMENT].postfix.texture_trampoline = trampoline;
- else if (t == PIPE_SHADER_VERTEX)
- ctx->payloads[PIPE_SHADER_VERTEX].postfix.texture_trampoline = trampoline;
- else
- assert(0);
+ ctx->payloads[t].postfix.texture_trampoline = trampoline;
}
}
@@ -1291,17 +1280,16 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
int uniform_count = 0;
- struct mali_vertex_tiler_postfix *postfix;
+ struct mali_vertex_tiler_postfix *postfix =
+ &ctx->payloads[i].postfix;
switch (i) {
case PIPE_SHADER_VERTEX:
uniform_count = ctx->vs->variants[ctx->vs->active_variant].uniform_count;
- postfix = &ctx->payloads[PIPE_SHADER_VERTEX].postfix;
break;
case PIPE_SHADER_FRAGMENT:
uniform_count = ctx->fs->variants[ctx->fs->active_variant].uniform_count;
- postfix = &ctx->payloads[PIPE_SHADER_FRAGMENT].postfix;
break;
default: