Browse Source

Enable Buffer::invalidate*Data() on ES.

This smells fishy. The function _does have_ a no-op fallback
implementation to remove the need to wrap everything with an #ifdef
and/or extension check, so why I did exactly that everywhere?
pull/51/head
Vladimír Vondruš 12 years ago
parent
commit
1d218cbed2
  1. 2
      src/Magnum/Buffer.cpp
  2. 2
      src/Magnum/Buffer.h
  3. 12
      src/Magnum/Test/BufferGLTest.cpp

2
src/Magnum/Buffer.cpp

@ -195,7 +195,6 @@ Buffer& Buffer::setSubData(const GLintptr offset, const Containers::ArrayReferen
return *this;
}
#ifndef MAGNUM_TARGET_GLES
Buffer& Buffer::invalidateData() {
(this->*Context::current()->state().buffer->invalidateImplementation)();
return *this;
@ -205,7 +204,6 @@ Buffer& Buffer::invalidateSubData(const GLintptr offset, const GLsizeiptr length
(this->*Context::current()->state().buffer->invalidateSubImplementation)(offset, length);
return *this;
}
#endif
void* Buffer::map(const MapAccess access) {
return (this->*Context::current()->state().buffer->mapImplementation)(access);

2
src/Magnum/Buffer.h

@ -722,7 +722,6 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
return *this;
}
#ifndef MAGNUM_TARGET_GLES
/**
* @brief Invalidate buffer data
* @return Reference to self (for method chaining)
@ -744,7 +743,6 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @see @ref MapFlag::InvalidateRange, @fn_gl{InvalidateBufferData}
*/
Buffer& invalidateSubData(GLintptr offset, GLsizeiptr length);
#endif
/**
* @brief Map buffer to client memory

12
src/Magnum/Test/BufferGLTest.cpp

@ -53,9 +53,7 @@ class BufferGLTest: public AbstractOpenGLTester {
#ifndef MAGNUM_TARGET_GLES2
void copy();
#endif
#ifndef MAGNUM_TARGET_GLES2
void invalidate();
#endif
};
BufferGLTest::BufferGLTest() {
@ -71,10 +69,7 @@ BufferGLTest::BufferGLTest() {
#ifndef MAGNUM_TARGET_GLES2
&BufferGLTest::copy,
#endif
#ifndef MAGNUM_TARGET_GLES
&BufferGLTest::invalidate
#endif
});
&BufferGLTest::invalidate});
}
void BufferGLTest::construct() {
@ -348,11 +343,7 @@ void BufferGLTest::copy() {
}
#endif
#ifndef MAGNUM_TARGET_GLES
void BufferGLTest::invalidate() {
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::invalidate_subdata>())
CORRADE_SKIP(Extensions::GL::ARB::invalidate_subdata::string() + std::string(" is not supported"));
Buffer buffer;
constexpr char data[] = {2, 7, 5, 13, 25};
buffer.setData(data, BufferUsage::StaticDraw);
@ -365,7 +356,6 @@ void BufferGLTest::invalidate() {
buffer.invalidateData();
MAGNUM_VERIFY_NO_ERROR();
}
#endif
}}

Loading…
Cancel
Save