Check for OES_mapbuffer in Buffer::unmap
authorMikko Rasa <tdb@tdb.fi>
Wed, 25 Apr 2018 11:53:33 +0000 (14:53 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 25 Apr 2018 11:53:33 +0000 (14:53 +0300)
It might have been mapped through ARB_map_buffer_range, in which case
OES_mapbuffer didn't get initialized in Buffer::map.

source/buffer.cpp

index 040ae8df1eca040f55798222257121faf2efef49..2b18d7d7d7d3bf0a47611207850aec5aabc4cc9d 100644 (file)
@@ -110,13 +110,16 @@ void *Buffer::map(BufferAccess access)
 
 bool Buffer::unmap()
 {
+       // TODO check if it's mapped
        if(ARB_direct_state_access)
                return glUnmapNamedBuffer(id);
-       else
+       else if(OES_mapbuffer)
        {
                BindRestore _bind(this, type);
                return glUnmapBuffer(type);
        }
+       else
+               return true;
 }
 
 void Buffer::bind_to(BufferType t) const