panfrost: Fix dirty state emission
authorAlyssa Rosenzweig <alyssa@collabora.com>
Fri, 4 Jun 2021 23:06:36 +0000 (19:06 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 10 Jun 2021 18:06:10 +0000 (18:06 +0000)
If we have per-draw state (vertex ID stuff), there's an ordering
mismatch. Fixes
dEQP-GLES31.functional.draw_base_vertex.draw_elements_instanced_base_vertex.builtin_variable.vertex_id
on Midgard, and I'm not sure why it was passing on Bifrost before. Also
should fix (on both architectures) DRAWID issues.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>

src/gallium/drivers/panfrost/pan_context.c

index 51ea2a2..a0051f2 100644 (file)
@@ -567,6 +567,11 @@ panfrost_direct_draw(struct panfrost_batch *batch,
         mali_ptr attribs, attrib_bufs;
         attribs = panfrost_emit_vertex_data(batch, &attrib_bufs);
 
+        panfrost_update_state_3d(batch);
+        panfrost_update_state_vs(batch);
+        panfrost_update_state_fs(batch);
+        panfrost_clean_state_3d(ctx);
+
         /* Fire off the draw itself */
         panfrost_draw_emit_vertex(batch, info, &invocation,
                                   vs_vary, varyings, attribs, attrib_bufs, vertex.cpu);
@@ -641,6 +646,11 @@ panfrost_indirect_draw(struct panfrost_batch *batch,
         ctx->base_vertex_sysval_ptr = 0;
         ctx->base_instance_sysval_ptr = 0;
 
+        panfrost_update_state_3d(batch);
+        panfrost_update_state_vs(batch);
+        panfrost_update_state_fs(batch);
+        panfrost_clean_state_3d(ctx);
+
         bool point_coord_replace = (info->mode == PIPE_PRIM_POINTS);
 
         panfrost_emit_varying_descriptor(batch, 0,
@@ -767,11 +777,6 @@ panfrost_draw_vbo(struct pipe_context *pipe,
         /* Conservatively assume draw parameters always change */
         ctx->dirty |= PAN_DIRTY_PARAMS | PAN_DIRTY_DRAWID;
 
-        panfrost_update_state_3d(batch);
-        panfrost_update_state_vs(batch);
-        panfrost_update_state_fs(batch);
-        panfrost_clean_state_3d(ctx);
-
         if (indirect) {
                 assert(num_draws == 1);