X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fbufferobj.c;h=eca86aae98ce8e17439d868c821045bc99a2f21a;hb=4807a83da0e0f5e3272e85504ee3b2213ef1910a;hp=795cb1618fd5cd630fb9374205cf85ca111e2215;hpb=e891f7cf55f2f3e3d37ece12e5c64f4be70e3845;p=mesa.git diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 795cb1618fd..eca86aae98c 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->BufferBinding[index].BufferObj == obj) { + _mesa_bind_vertex_buffer(ctx, vao, index, ctx->Shared->NullBufferObj, + vao->BufferBinding[index].Offset, + vao->BufferBinding[index].Stride); } } @@ -1301,8 +1304,8 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids) _mesa_buffer_unmap_all_mappings(ctx, bufObj); /* unbind any vertex pointers bound to this buffer */ - for (j = 0; j < ARRAY_SIZE(vao->VertexBinding); j++) { - unbind(ctx, &vao->VertexBinding[j].BufferObj, bufObj); + for (j = 0; j < ARRAY_SIZE(vao->BufferBinding); j++) { + unbind(ctx, vao, j, bufObj); } if (ctx->Array.ArrayBufferObj == bufObj) { @@ -3072,11 +3075,11 @@ bind_buffers_check_offset_and_size(struct gl_context *ctx, const GLsizeiptr *sizes) { if (offsets[index] < 0) { - /* The ARB_multi_bind spec says: - * - * "An INVALID_VALUE error is generated by BindBuffersRange if any - * value in is less than zero (per binding)." - */ + /* The ARB_multi_bind spec says: + * + * "An INVALID_VALUE error is generated by BindBuffersRange if any + * value in is less than zero (per binding)." + */ _mesa_error(ctx, GL_INVALID_VALUE, "glBindBuffersRange(offsets[%u]=%" PRId64 " < 0)", index, (int64_t) offsets[index]); @@ -3084,11 +3087,11 @@ bind_buffers_check_offset_and_size(struct gl_context *ctx, } if (sizes[index] <= 0) { - /* The ARB_multi_bind spec says: - * - * "An INVALID_VALUE error is generated by BindBuffersRange if any - * value in is less than or equal to zero (per binding)." - */ + /* The ARB_multi_bind spec says: + * + * "An INVALID_VALUE error is generated by BindBuffersRange if any + * value in is less than or equal to zero (per binding)." + */ _mesa_error(ctx, GL_INVALID_VALUE, "glBindBuffersRange(sizes[%u]=%" PRId64 " <= 0)", index, (int64_t) sizes[index]);