Don't try to unmap buffers which aren't mapped.
authorDavid Gow <[email protected]>
Tue, 5 Aug 2014 13:48:59 +0000 (21:48 +0800)
committerDavid Gow <[email protected]>
Tue, 5 Aug 2014 13:48:59 +0000 (21:48 +0800)
Fixes the GL_INAVLID_OPERATION that snuck in: this would occur
when calling GraphicsBuffer::Resize() on an unmapped, non-invalidated buffer.

src/graphicsbuffer.cpp

index 712caf8..d3911db 100644 (file)
@@ -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)
        {

UCC git Repository :: git.ucc.asn.au