From f3cce7087a562f77be7306e70d4e62bc214bb5fa Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 21 Mar 2020 22:49:03 -0400 Subject: mesa: don't ever bind NullBufferObj for glBindBuffer targets Since VAOs don't use NullBufferObj for vertex attribs anymore, let's remove more uses of NullBufferObj. Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/mesa/main/attrib.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/mesa/main/attrib.c') diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index ce6c519737f..f84844ccea2 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1666,21 +1666,24 @@ restore_array_attrib(struct gl_context *ctx, _mesa_BindVertexArray(src->VAO->Name); /* Restore or recreate the buffer objects by the names ... */ - if (is_vao_name_zero || src->ArrayBufferObj->Name == 0 || + if (is_vao_name_zero || !src->ArrayBufferObj || _mesa_IsBuffer(src->ArrayBufferObj->Name)) { /* ... and restore its content */ copy_array_attrib(ctx, dest, src, false); _mesa_BindBuffer(GL_ARRAY_BUFFER_ARB, - src->ArrayBufferObj->Name); + src->ArrayBufferObj ? + src->ArrayBufferObj->Name : 0); } else { copy_array_attrib(ctx, dest, src, true); } - if (is_vao_name_zero || src->VAO->IndexBufferObj->Name == 0 || - _mesa_IsBuffer(src->VAO->IndexBufferObj->Name)) + if (is_vao_name_zero || !src->VAO->IndexBufferObj || + _mesa_IsBuffer(src->VAO->IndexBufferObj->Name)) { _mesa_BindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, - src->VAO->IndexBufferObj->Name); + src->VAO->IndexBufferObj ? + src->VAO->IndexBufferObj->Name : 0); + } } /** -- cgit v1.2.3