diff options
author | Mathias Fröhlich <[email protected]> | 2018-12-21 18:41:27 +0100 |
---|---|---|
committer | Mathias Fröhlich <[email protected]> | 2019-03-04 17:03:06 +0100 |
commit | e727f8c8b814b9c36d4a8b52829c2bf7281765be (patch) | |
tree | c5c77fdb8fff990c9c51525460b2c2cf6d836e68 /src/mesa | |
parent | 9e787904d0a5c0dfde509a03f31f7a0c6f2993c3 (diff) |
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 <[email protected]>
Signed-off-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/arrayobj.c | 4 | ||||
-rw-r--r-- | src/mesa/main/bufferobj.c | 5 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 4 | ||||
-rw-r--r-- | src/mesa/main/varray.c | 6 |
4 files changed, 15 insertions, 4 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index bfd6fce6798..68d30aa9b1f 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -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); + } } diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index f9e52942d47..3caf363b37f 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -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; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 9bca5c153ad..96f30d4a4d5 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -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; diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 5af5a7f773f..e6057c7f881 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -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) |