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;