From: Mikko Rasa Date: Wed, 11 Aug 2021 15:02:28 +0000 (+0300) Subject: Always use ARB_map_buffer_range for mapping buffers X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=4d146fba83f1ee7b8bd2249648a66db51857730f;p=libs%2Fgl.git Always use ARB_map_buffer_range for mapping buffers --- diff --git a/source/core/buffer.cpp b/source/core/buffer.cpp index 5b3339a1..013a136a 100644 --- a/source/core/buffer.cpp +++ b/source/core/buffer.cpp @@ -148,26 +148,16 @@ BufferRange *Buffer::create_range(unsigned s, unsigned o) void *Buffer::map() { + static Require _req(ARB_map_buffer_range); + allocate(); - if(ARB_map_buffer_range) - { - if(ARB_direct_state_access) - return glMapNamedBufferRange(id, 0, size, GL_MAP_READ_BIT|GL_MAP_WRITE_BIT); - else - { - BindRestore _bind(this, type); - return glMapBufferRange(type, 0, size, GL_MAP_READ_BIT|GL_MAP_WRITE_BIT); - } - } - else if(ARB_direct_state_access) - return glMapNamedBuffer(id, GL_READ_WRITE); - else if(OES_mapbuffer) + if(ARB_direct_state_access) + return glMapNamedBufferRange(id, 0, size, GL_MAP_READ_BIT|GL_MAP_WRITE_BIT); + else { BindRestore _bind(this, type); - return glMapBuffer(type, GL_READ_WRITE); + return glMapBufferRange(type, 0, size, GL_MAP_READ_BIT|GL_MAP_WRITE_BIT); } - else - throw invalid_operation("Buffer::map"); } bool Buffer::unmap()