Module: Mesa Branch: main Commit: 3db963a13592c5b215bb776e0365d4c0d70d5286 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3db963a13592c5b215bb776e0365d4c0d70d5286
Author: Boris Brezillon <[email protected]> Date: Thu Oct 5 09:05:23 2023 +0200 panfrost: Emit attribs in panfrost_update_state_3d() on bifrost/midgard The dirty state tracking should allow us to conditionally re-emit the vertex attribute and attribute buffer arrays if something relevant changed. Signed-off-by: Boris Brezillon <[email protected]> Reviewed-by: Erik Faye-Lund <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26221> --- src/gallium/drivers/panfrost/pan_cmdstream.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index d517ac3c770..a018d6c0e41 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -2930,6 +2930,17 @@ panfrost_update_state_3d(struct panfrost_batch *batch) batch->attrib_bufs[PIPE_SHADER_VERTEX] = panfrost_emit_vertex_buffers(batch); } +#else + unsigned vt_shader_dirty = ctx->dirty_shader[PIPE_SHADER_VERTEX]; + + /* Vertex data, vertex shader and images accessed by the vertex shader have + * an impact on the attributes array, we need to re-emit anytime one of these + * parameters changes. */ + if ((dirty & PAN_DIRTY_VERTEX) || + (vt_shader_dirty & (PAN_DIRTY_STAGE_IMAGE | PAN_DIRTY_STAGE_SHADER))) { + batch->attribs[PIPE_SHADER_VERTEX] = panfrost_emit_vertex_data( + batch, &batch->attrib_bufs[PIPE_SHADER_VERTEX]); + } #endif } @@ -3606,9 +3617,6 @@ panfrost_direct_draw(struct panfrost_batch *batch, panfrost_emit_varying_descriptor( batch, ctx->padded_count * ctx->instance_count, &vs_vary, &fs_vary, &varyings, NULL, &pos, &psiz, info->mode == MESA_PRIM_POINTS); - - mali_ptr attribs, attrib_bufs; - attribs = panfrost_emit_vertex_data(batch, &attrib_bufs); #endif panfrost_update_state_3d(batch); @@ -3616,6 +3624,9 @@ panfrost_direct_draw(struct panfrost_batch *batch, panfrost_update_shader_state(batch, PIPE_SHADER_FRAGMENT); panfrost_clean_state_3d(ctx); + UNUSED mali_ptr attrib_bufs = batch->attrib_bufs[PIPE_SHADER_VERTEX]; + UNUSED mali_ptr attribs = batch->attribs[PIPE_SHADER_VERTEX]; + if (ctx->uncompiled[PIPE_SHADER_VERTEX]->xfb) { #if PAN_ARCH >= 9 mali_ptr attribs = 0, attrib_bufs = 0;
