From 5a4eddc2987acbedca5cfdff4b1b9b38e5def5dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 8 Dec 2023 21:38:30 -0500 Subject: [PATCH] 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 Part-of: --- 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;