mirror of
https://github.com/love2d/love.git
synced 2026-08-14 10:13:46 +02:00
Don't do unnecessary vertex buffer orphaning when calling SpriteBatch:unbind() on a SpriteBatch with the static usage hint
This commit is contained in:
@@ -182,10 +182,18 @@ void VBO::unmap()
|
||||
is_bound = true;
|
||||
}
|
||||
|
||||
// "orphan" current buffer to avoid implicit synchronisation on the GPU:
|
||||
// http://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-AsynchronousBufferTransfers.pdf
|
||||
glBufferDataARB(getTarget(), (GLsizeiptr) getSize(), NULL, getUsage());
|
||||
glBufferDataARB(getTarget(), (GLsizeiptr) getSize(), memory_map, getUsage());
|
||||
if (getUsage() == GL_STATIC_DRAW)
|
||||
{
|
||||
// Upload the mapped data to the buffer.
|
||||
glBufferSubDataARB(getTarget(), 0, (GLsizeiptr) getSize(), memory_map);
|
||||
}
|
||||
else
|
||||
{
|
||||
// "orphan" current buffer to avoid implicit synchronisation on the GPU:
|
||||
// http://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-AsynchronousBufferTransfers.pdf
|
||||
glBufferDataARB(getTarget(), (GLsizeiptr) getSize(), NULL, getUsage());
|
||||
glBufferDataARB(getTarget(), (GLsizeiptr) getSize(), memory_map, getUsage());
|
||||
}
|
||||
|
||||
is_mapped = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user