Module: Mesa
Branch: main
Commit: 5a4eddc2987acbedca5cfdff4b1b9b38e5def5dd
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5a4eddc2987acbedca5cfdff4b1b9b38e5def5dd

Author: Marek Olšák <[email protected]>
Date:   Fri Dec  8 21:38:30 2023 -0500

glthread: add a missing end-of-batch marker

Unmarshal calls that "look ahead" in the batch use it. They expect
the next call ID to be equal to a specific GL call. NUM_DISPATCH_CMD
is not equal to any GL call (it's last_call_id + 1).

This was missed in the referenced commit, causing assertion failures.

Fixes: c3b95d1507d809ff9c - glthread: add a marker at the end of batches 
indicating the end

Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26786>

---

 src/mesa/main/glthread.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c
index a6e62516d02..f16326a7a71 100644
--- a/src/mesa/main/glthread.c
+++ b/src/mesa/main/glthread.c
@@ -390,6 +390,11 @@ _mesa_glthread_finish(struct gl_context *ctx)
    }
 
    if (glthread->used) {
+      /* Mark the end of the batch, but don't increment "used". */
+      struct marshal_cmd_base *last =
+         (struct marshal_cmd_base *)&next->buffer[glthread->used];
+      last->cmd_id = NUM_DISPATCH_CMD;
+
       p_atomic_add(&glthread->stats.num_direct_items, glthread->used);
       next->used = glthread->used;
       glthread->used = 0;

Reply via email to