freedreno: Add missing indirect_draw_count tracking
authorRob Clark <robdclark@chromium.org>
Mon, 2 Oct 2023 19:45:10 +0000 (12:45 -0700)
committerMarge Bot <emma+marge@anholt.net>
Tue, 3 Oct 2023 15:18:03 +0000 (15:18 +0000)
Fixes: f677f64e80c4 ("freedreno: implement GL_ARB_indirect_parameters")
Fixes: b43e5aec0d2c ("freedreno/batch: Move submit bo tracking to batch")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25465>

src/gallium/drivers/freedreno/freedreno_draw.c

index f94a6fa..56ea718 100644 (file)
@@ -221,6 +221,9 @@ needs_draw_tracking(struct fd_batch *batch, const struct pipe_draw_info *info,
    if (indirect) {
       if (indirect->buffer && !batch_references_resource(batch, indirect->buffer))
          return true;
+      if (indirect->indirect_draw_count &&
+          !batch_references_resource(batch, indirect->indirect_draw_count))
+         return true;
       if (indirect->count_from_stream_output)
          return true;
    }
@@ -252,8 +255,8 @@ batch_draw_tracking(struct fd_batch *batch, const struct pipe_draw_info *info,
 
    /* Mark indirect draw buffer as being read */
    if (indirect) {
-      if (indirect->buffer)
-         resource_read(batch, indirect->buffer);
+      resource_read(batch, indirect->buffer);
+      resource_read(batch, indirect->indirect_draw_count);
       if (indirect->count_from_stream_output)
          resource_read(
             batch, fd_stream_output_target(indirect->count_from_stream_output)