Commit e727f8c8 authored by Mathias Fröhlich's avatar Mathias Fröhlich Committed by Mathias Fröhlich

mesa: Track buffer object use also for VAO usage.

We already track the usage history for buffer objects
in a lot of aspects. Add GL_ARRAY_BUFFER and
GL_ELEMENT_ARRAY_BUFFER to gl_buffer_object::UsageHistory.
Reviewed-by: Brian Paul's avatarBrian Paul <brianp@vmware.com>
Signed-off-by: Mathias Fröhlich's avatarMathias Fröhlich <Mathias.Froehlich@web.de>
parent 9e787904
......@@ -1213,8 +1213,10 @@ vertex_array_element_buffer(struct gl_context *ctx, GLuint vaobj, GLuint buffer,
bufObj = ctx->Shared->NullBufferObj;
}
if (bufObj)
if (bufObj) {
bufObj->UsageHistory |= USAGE_ELEMENT_ARRAY_BUFFER;
_mesa_reference_buffer_object(ctx, &vao->IndexBufferObj, bufObj);
}
}
......
......@@ -113,8 +113,13 @@ get_buffer_target(struct gl_context *ctx, GLenum target)
switch (target) {
case GL_ARRAY_BUFFER_ARB:
if (ctx->Array.ArrayBufferObj)
ctx->Array.ArrayBufferObj->UsageHistory |= USAGE_ARRAY_BUFFER;
return &ctx->Array.ArrayBufferObj;
case GL_ELEMENT_ARRAY_BUFFER_ARB:
if (ctx->Array.VAO->IndexBufferObj)
ctx->Array.VAO->IndexBufferObj->UsageHistory
|= USAGE_ELEMENT_ARRAY_BUFFER;
return &ctx->Array.VAO->IndexBufferObj;
case GL_PIXEL_PACK_BUFFER_EXT:
return &ctx->Pack.BufferObj;
......
......@@ -1339,7 +1339,9 @@ typedef enum
USAGE_SHADER_STORAGE_BUFFER = 0x8,
USAGE_TRANSFORM_FEEDBACK_BUFFER = 0x10,
USAGE_PIXEL_PACK_BUFFER = 0x20,
USAGE_DISABLE_MINMAX_CACHE = 0x40,
USAGE_ARRAY_BUFFER = 0x40,
USAGE_ELEMENT_ARRAY_BUFFER = 0x80,
USAGE_DISABLE_MINMAX_CACHE = 0x100,
} gl_buffer_usage;
......
......@@ -209,10 +209,12 @@ _mesa_bind_vertex_buffer(struct gl_context *ctx,
binding->Offset = offset;
binding->Stride = stride;
if (!_mesa_is_bufferobj(vbo))
if (!_mesa_is_bufferobj(vbo)) {
vao->VertexAttribBufferMask &= ~binding->_BoundArrays;
else
} else {
vao->VertexAttribBufferMask |= binding->_BoundArrays;
vbo->UsageHistory |= USAGE_ARRAY_BUFFER;
}
vao->NewArrays |= vao->Enabled & binding->_BoundArrays;
if (vao == ctx->Array.VAO)
......
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