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 <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22293>
(cherry picked from commit a17317d2a0)

Conflicts:
	src/mesa/main/glthread_bufferobj.c
This commit is contained in:
Mike Blumenkrantz 2023-04-04 11:13:41 -04:00 committed by Dylan Baker
parent 2d08d71b1a
commit 8405693c33
2 changed files with 3 additions and 2 deletions

View file

@ -7674,7 +7674,7 @@
"description": "glthread: use id 0 for internal buffer objects",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -34,8 +34,9 @@ new_upload_buffer(struct gl_context *ctx, GLsizeiptr size, uint8_t **ptr)
{
assert(ctx->GLThread.SupportsBufferUploads);
/* 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;