From 3bfdb878aa9b534960b127b69916e9fa85910dd2 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 31 Jul 2019 15:05:57 -0700 Subject: [PATCH] panfrost: Generalize vertex shader upload This allows us to reuse the same code path for compute. Signed-off-by: Alyssa Rosenzweig --- src/gallium/drivers/panfrost/pan_context.c | 32 ++++++++++++++-------- 1 file 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 */ -- 2.30.2