summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2016-06-17 08:09:04 +0200
committerMathias Fröhlich <[email protected]>2016-07-31 10:05:45 +0200
commitf7cb46a9721ace5ec6d1e51cdc4ce70348605701 (patch)
tree13c01a8136b8f49a7d76faa2b4cb339213c245ef /src/mesa/main
parentf696b712d7b7c7b701667691bc044b42c1195a69 (diff)
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 <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/bufferobj.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 795cb1618fd..885a99decf4 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -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) {