diff --git a/src/Magnum/DebugTools/BufferData.cpp b/src/Magnum/DebugTools/BufferData.cpp index e2eb655a2..f41fcdea1 100644 --- a/src/Magnum/DebugTools/BufferData.cpp +++ b/src/Magnum/DebugTools/BufferData.cpp @@ -26,10 +26,13 @@ #include "BufferData.h" #include -#include #include "Magnum/GL/Buffer.h" +#if defined(MAGNUM_TARGET_GLES) || defined(MAGNUM_BUILD_DEPRECATED) +#include +#endif + namespace Magnum { namespace DebugTools { #ifdef MAGNUM_BUILD_DEPRECATED @@ -46,12 +49,16 @@ void bufferSubData(GL::Buffer& buffer, GLintptr offset, GLsizeiptr size, void* o #endif Containers::Array bufferSubData(GL::Buffer& buffer, GLintptr offset, GLsizeiptr size) { + #ifndef MAGNUM_TARGET_GLES + return buffer.subData(offset, size); + #else Containers::Array data{NoInit, std::size_t(size)}; if(size) { Utility::copy(buffer.mapRead(offset, size), data); buffer.unmap(); } return data; + #endif } Containers::Array bufferData(GL::Buffer& buffer) { diff --git a/src/Magnum/DebugTools/BufferData.h b/src/Magnum/DebugTools/BufferData.h index 5b593cc8c..e1c55d8b7 100644 --- a/src/Magnum/DebugTools/BufferData.h +++ b/src/Magnum/DebugTools/BufferData.h @@ -60,13 +60,13 @@ namespace Implementation { @brief Buffer subdata Emulates @ref GL::Buffer::subData() call on platforms that don't support it -(such as OpenGL ES) by using @ref GL::Buffer::map(). +(such as OpenGL ES) by using @ref GL::Buffer::mapRead(). On desktop GL it's +just an alias to @ref GL::Buffer::subData(). @note This function is available only if Magnum is compiled with @ref MAGNUM_TARGET_GL "TARGET_GL" enabled (done by default). See @ref building-features for more information. -@requires_gl30 Extension @gl_extension{ARB,map_buffer_range} @requires_gles30 Extension @gl_extension{EXT,map_buffer_range} in OpenGL ES 2.0. @requires_gles Buffer mapping is not available in WebGL. @@ -97,13 +97,13 @@ template CORRADE_DEPRECATED("use non-templated bufferSubData() and Cont @brief Buffer data Emulates @ref GL::Buffer::data() call on platforms that don't support it (such -as OpenGL ES) by using @ref GL::Buffer::map(). +as OpenGL ES) by using @ref GL::Buffer::mapRead(). On desktop GL it's just an +alias to @ref GL::Buffer::data(). @note This function is available only if Magnum is compiled with @ref MAGNUM_TARGET_GL "TARGET_GL" enabled (done by default). See @ref building-features for more information. -@requires_gl30 Extension @gl_extension{ARB,map_buffer_range} @requires_gles30 Extension @gl_extension{EXT,map_buffer_range} in OpenGL ES 2.0. @requires_gles Buffer mapping is not available in WebGL. diff --git a/src/Magnum/DebugTools/Test/BufferDataGLTest.cpp b/src/Magnum/DebugTools/Test/BufferDataGLTest.cpp index 27a15ec76..4faf02eec 100644 --- a/src/Magnum/DebugTools/Test/BufferDataGLTest.cpp +++ b/src/Magnum/DebugTools/Test/BufferDataGLTest.cpp @@ -49,10 +49,7 @@ BufferDataGLTest::BufferDataGLTest() { constexpr Int Data[] = {2, 7, 5, 13, 25}; void BufferDataGLTest::data() { - #ifndef MAGNUM_TARGET_GLES - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ARB::map_buffer_range::string() << "is not supported."); - #elif defined(MAGNUM_TARGET_GLES2) + #ifdef MAGNUM_TARGET_GLES2 if(!GL::Context::current().isExtensionSupported()) CORRADE_SKIP(GL::Extensions::EXT::map_buffer_range::string() << "is not supported."); #endif @@ -68,10 +65,7 @@ void BufferDataGLTest::data() { } void BufferDataGLTest::subData() { - #ifndef MAGNUM_TARGET_GLES - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ARB::map_buffer_range::string() << "is not supported."); - #elif defined(MAGNUM_TARGET_GLES2) + #ifdef MAGNUM_TARGET_GLES2 if(!GL::Context::current().isExtensionSupported()) CORRADE_SKIP(GL::Extensions::EXT::map_buffer_range::string() << "is not supported."); #endif