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

Author: Mike Blumenkrantz <[email protected]>
Date:   Tue Apr  4 11:13:41 2023 -0400

glthread: use id 0 for internal buffer objects

-1 is an invalid buffer index which breaks app expectations, specifically
apitrace, which checks for return value of 0 from checking buffer bindings
to determine whether to inject user vertex buffer bindings and create functional
traces

this should fix capturing traces with drivers using glthread

fixes #8383

cc: mesa-stable

Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22293>

---

 src/mesa/main/glthread_bufferobj.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/glthread_bufferobj.c 
b/src/mesa/main/glthread_bufferobj.c
index 118657c8410..100e810c3f4 100644
--- a/src/mesa/main/glthread_bufferobj.c
+++ b/src/mesa/main/glthread_bufferobj.c
@@ -32,8 +32,9 @@
 static struct gl_buffer_object *
 new_upload_buffer(struct gl_context *ctx, GLsizeiptr size, uint8_t **ptr)
 {
+   /* id 0 is used to avoid returning invalid binding values to apps */
    struct gl_buffer_object *obj =
-      _mesa_bufferobj_alloc(ctx, -1);
+      _mesa_bufferobj_alloc(ctx, 0);
    if (!obj)
       return NULL;
 

Reply via email to