From 59c3413bc2bd0e6a1ddbf4e67d9d7295de10f65c Mon Sep 17 00:00:00 2001 From: David Gow Date: Tue, 5 Aug 2014 21:48:59 +0800 Subject: [PATCH] Don't try to unmap buffers which aren't mapped. Fixes the GL_INAVLID_OPERATION that snuck in: this would occur when calling GraphicsBuffer::Resize() on an unmapped, non-invalidated buffer. --- src/graphicsbuffer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/graphicsbuffer.cpp b/src/graphicsbuffer.cpp index 712caf8..d3911db 100644 --- a/src/graphicsbuffer.cpp +++ b/src/graphicsbuffer.cpp @@ -185,6 +185,10 @@ void* GraphicsBuffer::MapRange(int offset, int length, bool read, bool write, bo void GraphicsBuffer::UnMap() { GLenum target = BufferTypeToGLType(m_buffer_type); + + // If we're not mapped, unmapping is a no-op. + if (!m_map_pointer) + return; if (m_faking_map) { -- 2.20.1