GL_FALSE, GL_FALSE,
offsetof(struct vertex, x));
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_GENERIC(0),
- *buf_obj, 0, sizeof(struct vertex), false);
+ *buf_obj, 0, sizeof(struct vertex), false,
+ false);
_mesa_enable_vertex_array_attrib(ctx, array_obj,
VERT_ATTRIB_GENERIC(0));
if (texcoord_size > 0) {
GL_FALSE, GL_FALSE, GL_FALSE,
offsetof(struct vertex, tex));
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_GENERIC(1),
- *buf_obj, 0, sizeof(struct vertex), false);
+ *buf_obj, 0, sizeof(struct vertex), false,
+ false);
_mesa_enable_vertex_array_attrib(ctx, array_obj,
VERT_ATTRIB_GENERIC(1));
}
GL_FALSE, GL_FALSE,
offsetof(struct vertex, x));
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_POS,
- *buf_obj, 0, sizeof(struct vertex), false);
+ *buf_obj, 0, sizeof(struct vertex), false,
+ false);
_mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_POS);
if (texcoord_size > 0) {
GL_FALSE, GL_FALSE,
offsetof(struct vertex, tex));
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_TEX(0),
- *buf_obj, 0, sizeof(struct vertex), false);
+ *buf_obj, 0, sizeof(struct vertex), false,
+ false);
_mesa_enable_vertex_array_attrib(ctx, array_obj,
VERT_ATTRIB_TEX(0));
}
GL_FALSE, GL_FALSE,
offsetof(struct vertex, r));
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_COLOR0,
- *buf_obj, 0, sizeof(struct vertex), false);
+ *buf_obj, 0, sizeof(struct vertex), false,
+ false);
_mesa_enable_vertex_array_attrib(ctx, array_obj,
VERT_ATTRIB_COLOR0);
}
offsetof(struct vertex, x));
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_POS,
drawtex->buf_obj, 0, sizeof(struct vertex),
- false);
+ false, false);
_mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_POS);
offsetof(struct vertex, st[i]));
_mesa_bind_vertex_buffer(ctx, array_obj, VERT_ATTRIB_TEX(i),
drawtex->buf_obj, 0, sizeof(struct vertex),
- false);
+ false, false);
_mesa_enable_vertex_array_attrib(ctx, array_obj, VERT_ATTRIB_TEX(i));
}
}
if (vao->BufferBinding[index].BufferObj == obj) {
_mesa_bind_vertex_buffer(ctx, vao, index, NULL,
vao->BufferBinding[index].Offset,
- vao->BufferBinding[index].Stride, true);
+ vao->BufferBinding[index].Stride, true, false);
}
}
GLuint index,
struct gl_buffer_object *vbo,
GLintptr offset, GLsizei stride,
- bool offset_is_int32)
+ bool offset_is_int32, bool take_vbo_ownership)
{
assert(index < ARRAY_SIZE(vao->BufferBinding));
assert(!vao->SharedAndImmutable);
binding->Offset != offset ||
binding->Stride != stride) {
- _mesa_reference_buffer_object(ctx, &binding->BufferObj, vbo);
+ if (take_vbo_ownership) {
+ _mesa_reference_buffer_object(ctx, &binding->BufferObj, NULL);
+ binding->BufferObj = vbo;
+ } else {
+ _mesa_reference_buffer_object(ctx, &binding->BufferObj, vbo);
+ }
binding->Offset = offset;
binding->Stride = stride;
stride : array->Format._ElementSize;
_mesa_bind_vertex_buffer(ctx, vao, attrib,
obj, (GLintptr) ptr,
- effectiveStride, false);
+ effectiveStride, false, false);
}
}
_mesa_bind_vertex_buffer(ctx, vao, VERT_ATTRIB_GENERIC(bindingIndex),
- vbo, offset, stride, false);
+ vbo, offset, stride, false, false);
}
*/
for (i = 0; i < count; i++)
_mesa_bind_vertex_buffer(ctx, vao, VERT_ATTRIB_GENERIC(first + i),
- NULL, 0, 16, false);
+ NULL, 0, 16, false, false);
return;
}
}
_mesa_bind_vertex_buffer(ctx, vao, VERT_ATTRIB_GENERIC(first + i),
- vbo, offsets[i], strides[i], false);
+ vbo, offsets[i], strides[i], false, false);
}
_mesa_HashUnlockMutex(ctx->Shared->BufferObjects);
GLuint index,
struct gl_buffer_object *vbo,
GLintptr offset, GLsizei stride,
- bool offset_is_int32);
+ bool offset_is_int32, bool take_vbo_ownership);
extern void GLAPIENTRY
_mesa_VertexPointer_no_error(GLint size, GLenum type, GLsizei stride,
/* Bind the buffer object */
const GLuint stride = exec->vtx.vertex_size*sizeof(GLfloat);
_mesa_bind_vertex_buffer(ctx, vao, 0, exec->vtx.bufferobj, buffer_offset,
- stride, false);
+ stride, false, false);
/* Retrieve the mapping from VBO_ATTRIB to VERT_ATTRIB space
* Note that the position/generic0 aliasing is done in the VAO.
*/
/* Bind the buffer object at binding point 0 */
- _mesa_bind_vertex_buffer(ctx, *vao, 0, bo, buffer_offset, stride, false);
+ _mesa_bind_vertex_buffer(ctx, *vao, 0, bo, buffer_offset, stride, false,
+ false);
/* Retrieve the mapping from VBO_ATTRIB to VERT_ATTRIB space
* Note that the position/generic0 aliasing is done in the VAO.