Fix GL error with buffer unmapping;

This doesn't seem to fix any of the macOS rendering bugs though...
This commit is contained in:
bjorn 2019-06-29 20:08:31 -07:00
parent d3f08fd1f0
commit afe4d8c0e3
1 changed files with 4 additions and 2 deletions

View File

@ -1744,8 +1744,10 @@ void lovrBufferDiscard(Buffer* buffer) {
glBufferData(glType, buffer->size, NULL, convertBufferUsage(buffer->usage));
#else
// We unmap even if persistent mapping is supported
// TODO investigate glInvalidateBufferData and its interactions with persistently mapped buffers.
glUnmapBuffer(glType);
if (buffer->mapped || GLAD_GL_ARB_buffer_storage) {
glUnmapBuffer(glType);
buffer->mapped = false;
}
GLbitfield flags = GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT | (buffer->readable ? GL_MAP_READ_BIT : 0);
flags |= GLAD_GL_ARB_buffer_storage ? GL_MAP_PERSISTENT_BIT : 0;