diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-07-31 15:05:57 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-08-01 16:23:03 -0700 |
commit | 3bfdb878aa9b534960b127b69916e9fa85910dd2 (patch) | |
tree | 36c4574b77d24c3d7cdf367b89f451c01d2b6b76 | |
parent | 3b7224190e0d46a21f9caab827659eafcb36c148 (diff) |
panfrost: Generalize vertex shader upload
This allows us to reuse the same code path for compute.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 4ebf5ca6c05..63f865aaccd 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -1013,6 +1013,25 @@ panfrost_patch_shader_state( } +static void +panfrost_patch_shader_state_compute( + struct panfrost_context *ctx, + enum pipe_shader_type stage, + bool should_upload) +{ + struct panfrost_shader_variants *all = ctx->shader[stage]; + + if (!all) { + ctx->payloads[stage].postfix._shader_upper = 0; + return; + } + + struct panfrost_shader_state *s = &all->variants[all->active_variant]; + + ctx->payloads[stage].postfix._shader_upper = + panfrost_patch_shader_state(ctx, s, stage, should_upload) >> 4; +} + /* Go through dirty flags and actualise them in the cmdstream. */ void @@ -1048,17 +1067,8 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data) ctx->payloads[PIPE_SHADER_FRAGMENT].postfix.occlusion_counter = ctx->occlusion_query->transfer.gpu; } - /* TODO: Does it make sense to dirty track VS? We need the transient - * uploads */ - ctx->dirty |= PAN_DIRTY_VS; - if (ctx->dirty & PAN_DIRTY_VS) { - assert(ctx->shader[PIPE_SHADER_VERTEX]); - - struct panfrost_shader_state *vs = &ctx->shader[PIPE_SHADER_VERTEX]->variants[ctx->shader[PIPE_SHADER_VERTEX]->active_variant]; - - ctx->payloads[PIPE_SHADER_VERTEX].postfix._shader_upper = - panfrost_patch_shader_state(ctx, vs, PIPE_SHADER_VERTEX, true) >> 4; - } + panfrost_patch_shader_state_compute(ctx, PIPE_SHADER_VERTEX, true); + panfrost_patch_shader_state_compute(ctx, PIPE_SHADER_COMPUTE, true); if (ctx->dirty & (PAN_DIRTY_RASTERIZER | PAN_DIRTY_VS)) { /* Check if we need to link the gl_PointSize varying */ |