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; return *this;
} }
#ifndef MAGNUM_TARGET_GLES
Buffer& Buffer::invalidateData() { Buffer& Buffer::invalidateData() {
(this->*Context::current()->state().buffer->invalidateImplementation)(); (this->*Context::current()->state().buffer->invalidateImplementation)();
return *this; return *this;
@ -205,7 +204,6 @@ Buffer& Buffer::invalidateSubData(const GLintptr offset, const GLsizeiptr length
(this->*Context::current()->state().buffer->invalidateSubImplementation)(offset, length); (this->*Context::current()->state().buffer->invalidateSubImplementation)(offset, length);
return *this; return *this;
} }
#endif
void* Buffer::map(const MapAccess access) { void* Buffer::map(const MapAccess access) {
return (this->*Context::current()->state().buffer->mapImplementation)(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; return *this;
} }
#ifndef MAGNUM_TARGET_GLES
/** /**
* @brief Invalidate buffer data * @brief Invalidate buffer data
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
@ -744,7 +743,6 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @see @ref MapFlag::InvalidateRange, @fn_gl{InvalidateBufferData} * @see @ref MapFlag::InvalidateRange, @fn_gl{InvalidateBufferData}
*/ */
Buffer& invalidateSubData(GLintptr offset, GLsizeiptr length); Buffer& invalidateSubData(GLintptr offset, GLsizeiptr length);
#endif
/** /**
* @brief Map buffer to client memory * @brief Map buffer to client memory

12
src/Magnum/Test/BufferGLTest.cpp

@ -53,9 +53,7 @@ class BufferGLTest: public AbstractOpenGLTester {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
void copy(); void copy();
#endif #endif
#ifndef MAGNUM_TARGET_GLES2
void invalidate(); void invalidate();
#endif
}; };
BufferGLTest::BufferGLTest() { BufferGLTest::BufferGLTest() {
@ -71,10 +69,7 @@ BufferGLTest::BufferGLTest() {
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
&BufferGLTest::copy, &BufferGLTest::copy,
#endif #endif
#ifndef MAGNUM_TARGET_GLES &BufferGLTest::invalidate});
&BufferGLTest::invalidate
#endif
});
} }
void BufferGLTest::construct() { void BufferGLTest::construct() {
@ -348,11 +343,7 @@ void BufferGLTest::copy() {
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES
void BufferGLTest::invalidate() { 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; Buffer buffer;
constexpr char data[] = {2, 7, 5, 13, 25}; constexpr char data[] = {2, 7, 5, 13, 25};
buffer.setData(data, BufferUsage::StaticDraw); buffer.setData(data, BufferUsage::StaticDraw);
@ -365,7 +356,6 @@ void BufferGLTest::invalidate() {
buffer.invalidateData(); buffer.invalidateData();
MAGNUM_VERIFY_NO_ERROR(); MAGNUM_VERIFY_NO_ERROR();
} }
#endif
}} }}

Loading…
Cancel
Save