draw: fix viewmask iterating
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Fri, 21 Apr 2023 14:41:34 +0000 (10:41 -0400)
committerMarge Bot <emma+marge@anholt.net>
Mon, 24 Apr 2023 02:20:05 +0000 (02:20 +0000)
the frontend has to be flushed and setup again if only
the viewmask has changed since the last draw

Fixes: 03cbb7b104e ("draw: add view_mask rendering support")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22628>

src/gallium/auxiliary/draw/draw_private.h
src/gallium/auxiliary/draw/draw_pt.c

index f3bcff4..1780070 100644 (file)
@@ -184,6 +184,7 @@ struct draw_context
       enum pipe_prim_type prim;
       unsigned opt;     /**< bitmask of PT_x flags */
       unsigned eltSize; /* saved eltSize for flushing */
+      unsigned viewid; /* saved viewid for flushing */
       ubyte vertices_per_patch;
       boolean rebind_parameters;
 
index 676f526..3d5d5f0 100644 (file)
@@ -103,9 +103,9 @@ draw_pt_arrays(struct draw_context *draw,
           */
          draw_do_flush(draw, DRAW_FLUSH_STATE_CHANGE);
          frontend = NULL;
-      } else if (draw->pt.eltSize != draw->pt.user.eltSize) {
-         /* Flush draw state if eltSize changed.
-          * This could be improved so only the frontend is flushed since it
+      } else if (draw->pt.eltSize != draw->pt.user.eltSize || draw->pt.viewid != draw->pt.user.viewid) {
+         /* Flush draw state if eltSize or viewid changed.
+          * eltSize changes could be improved so only the frontend is flushed since it
           * converts all indices to ushorts and the fetch part of the middle
           * always prepares both linear and indexed.
           */
@@ -121,6 +121,7 @@ draw_pt_arrays(struct draw_context *draw,
 
       draw->pt.frontend = frontend;
       draw->pt.eltSize = draw->pt.user.eltSize;
+      draw->pt.viewid = draw->pt.user.viewid;
       draw->pt.prim = prim;
       draw->pt.opt = opt;
    }