Commit f7cb46a9 authored by Mathias Fröhlich's avatar Mathias Fröhlich

mesa: Unbind deleted vbo using _mesa_bind_vertex_buffer.

When a vertex buffer object gets deleted, it is unbound
at the VAO. To do this use _mesa_bind_vertex_buffer instead
of plain unreferencing the buffer object. This keeps the VAOs
internal state consistent. In this case it showed up with
gl_vertex_array_object::VertexAttribBufferMask getting out of
sync.
Signed-off-by: Mathias Fröhlich's avatarMathias Fröhlich <Mathias.Froehlich@web.de>
Reviewed-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
parent f696b712
......@@ -44,6 +44,7 @@
#include "glformats.h"
#include "texstore.h"
#include "transformfeedback.h"
#include "varray.h"
/* Debug flags */
......@@ -1199,11 +1200,13 @@ _mesa_multi_bind_lookup_bufferobj(struct gl_context *ctx,
*/
static void
unbind(struct gl_context *ctx,
struct gl_buffer_object **ptr,
struct gl_vertex_array_object *vao, unsigned index,
struct gl_buffer_object *obj)
{
if (*ptr == obj) {
_mesa_reference_buffer_object(ctx, ptr, ctx->Shared->NullBufferObj);
if (vao->VertexBinding[index].BufferObj == obj) {
_mesa_bind_vertex_buffer(ctx, vao, index, ctx->Shared->NullBufferObj,
vao->VertexBinding[index].Offset,
vao->VertexBinding[index].Stride);
}
}
......@@ -1302,7 +1305,7 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids)
/* unbind any vertex pointers bound to this buffer */
for (j = 0; j < ARRAY_SIZE(vao->VertexBinding); j++) {
unbind(ctx, &vao->VertexBinding[j].BufferObj, bufObj);
unbind(ctx, vao, j, bufObj);
}
if (ctx->Array.ArrayBufferObj == bufObj) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment