Browse Source

Buffer data queries are not available in OpenGL ES.

Similarly to texture image queries.
pull/278/head
Vladimír Vondruš 13 years ago
parent
commit
69a5c2f06f
  1. 6
      src/Buffer.cpp
  2. 16
      src/Buffer.h

6
src/Buffer.cpp

@ -38,7 +38,9 @@ namespace Magnum {
Buffer::CopyImplementation Buffer::copyImplementation = &Buffer::copyImplementationDefault; Buffer::CopyImplementation Buffer::copyImplementation = &Buffer::copyImplementationDefault;
#endif #endif
Buffer::GetParameterImplementation Buffer::getParameterImplementation = &Buffer::getParameterImplementationDefault; Buffer::GetParameterImplementation Buffer::getParameterImplementation = &Buffer::getParameterImplementationDefault;
#ifndef MAGNUM_TARGET_GLES
Buffer::GetSubDataImplementation Buffer::getSubDataImplementation = &Buffer::getSubDataImplementationDefault; Buffer::GetSubDataImplementation Buffer::getSubDataImplementation = &Buffer::getSubDataImplementationDefault;
#endif
Buffer::DataImplementation Buffer::dataImplementation = &Buffer::dataImplementationDefault; Buffer::DataImplementation Buffer::dataImplementation = &Buffer::dataImplementationDefault;
Buffer::SubDataImplementation Buffer::subDataImplementation = &Buffer::subDataImplementationDefault; Buffer::SubDataImplementation Buffer::subDataImplementation = &Buffer::subDataImplementationDefault;
Buffer::InvalidateImplementation Buffer::invalidateImplementation = &Buffer::invalidateImplementationNoOp; Buffer::InvalidateImplementation Buffer::invalidateImplementation = &Buffer::invalidateImplementationNoOp;
@ -126,6 +128,7 @@ Int Buffer::size() {
return size; return size;
} }
#ifndef MAGNUM_TARGET_GLES
Containers::Array<char> Buffer::data() { Containers::Array<char> Buffer::data() {
return subData(0, size()); return subData(0, size());
} }
@ -135,6 +138,7 @@ Containers::Array<char> Buffer::subData(const GLintptr offset, const GLsizeiptr
if(size) (this->*getSubDataImplementation)(offset, size, data); if(size) (this->*getSubDataImplementation)(offset, size, data);
return std::move(data); return std::move(data);
} }
#endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
void Buffer::copyImplementationDefault(Buffer* read, Buffer* write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { void Buffer::copyImplementationDefault(Buffer* read, Buffer* write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) {
@ -158,11 +162,11 @@ void Buffer::getParameterImplementationDSA(const GLenum value, GLint* const data
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES
void Buffer::getSubDataImplementationDefault(const GLintptr offset, const GLsizeiptr size, GLvoid* const data) { void Buffer::getSubDataImplementationDefault(const GLintptr offset, const GLsizeiptr size, GLvoid* const data) {
glGetBufferSubData(GLenum(bindInternal(_targetHint)), offset, size, data); glGetBufferSubData(GLenum(bindInternal(_targetHint)), offset, size, data);
} }
#ifndef MAGNUM_TARGET_GLES
void Buffer::getSubDataImplementationDSA(const GLintptr offset, const GLsizeiptr size, GLvoid* const data) { void Buffer::getSubDataImplementationDSA(const GLintptr offset, const GLsizeiptr size, GLvoid* const data) {
glGetNamedBufferSubDataEXT(_id, offset, size, data); glGetNamedBufferSubDataEXT(_id, offset, size, data);
} }

16
src/Buffer.h

@ -521,7 +521,7 @@ class MAGNUM_EXPORT Buffer {
void bind(Target target) { bind(target, _id); } void bind(Target target) { bind(target, _id); }
/** /**
* @brief Buffer size * @brief %Buffer size
* *
* If @extension{EXT,direct_state_access} is not available and the * If @extension{EXT,direct_state_access} is not available and the
* buffer is not already bound somewhere, it is bound to hinted target * buffer is not already bound somewhere, it is bound to hinted target
@ -532,8 +532,9 @@ class MAGNUM_EXPORT Buffer {
*/ */
Int size(); Int size();
#ifndef MAGNUM_TARGET_GLES
/** /**
* @brief Buffer data * @brief %Buffer data
* *
* Returns data of whole buffer. If @extension{EXT,direct_state_access} * Returns data of whole buffer. If @extension{EXT,direct_state_access}
* is not available and the buffer is not already bound somewhere, it * is not available and the buffer is not already bound somewhere, it
@ -542,11 +543,13 @@ class MAGNUM_EXPORT Buffer {
* @fn_gl_extension{GetNamedBufferParameter,EXT,direct_state_access} * @fn_gl_extension{GetNamedBufferParameter,EXT,direct_state_access}
* with @def_gl{BUFFER_SIZE}, @fn_gl{GetBufferSubData} or * with @def_gl{BUFFER_SIZE}, @fn_gl{GetBufferSubData} or
* @fn_gl_extension{GetNamedBufferSubData,EXT,direct_state_access} * @fn_gl_extension{GetNamedBufferSubData,EXT,direct_state_access}
* @requires_gl %Buffer data queries are not available in OpenGL ES.
* Use @ref Magnum::Buffer::map() "map()" instead.
*/ */
Containers::Array<char> data(); Containers::Array<char> data();
/** /**
* @brief Buffer subdata * @brief %Buffer subdata
* @param offset Offset in the buffer * @param offset Offset in the buffer
* @param size Data size * @param size Data size
* *
@ -555,8 +558,11 @@ class MAGNUM_EXPORT Buffer {
* is bound to hinted target before the operation. * is bound to hinted target before the operation.
* @see size(), data(), setSubData(), @fn_gl{BindBuffer} and @fn_gl{GetBufferSubData} * @see size(), data(), setSubData(), @fn_gl{BindBuffer} and @fn_gl{GetBufferSubData}
* or @fn_gl_extension{GetNamedBufferSubData,EXT,direct_state_access} * or @fn_gl_extension{GetNamedBufferSubData,EXT,direct_state_access}
* @requires_gl %Buffer data queries are not available in OpenGL ES.
* Use @ref Magnum::Buffer::map() "map()" instead.
*/ */
Containers::Array<char> subData(GLintptr offset, GLsizeiptr size); Containers::Array<char> subData(GLintptr offset, GLsizeiptr size);
#endif
/** /**
* @brief Set buffer data * @brief Set buffer data
@ -792,12 +798,12 @@ class MAGNUM_EXPORT Buffer {
#endif #endif
static MAGNUM_LOCAL GetParameterImplementation getParameterImplementation; static MAGNUM_LOCAL GetParameterImplementation getParameterImplementation;
#ifndef MAGNUM_TARGET_GLES
typedef void(Buffer::*GetSubDataImplementation)(GLintptr, GLsizeiptr, GLvoid*); typedef void(Buffer::*GetSubDataImplementation)(GLintptr, GLsizeiptr, GLvoid*);
void MAGNUM_LOCAL getSubDataImplementationDefault(GLintptr offset, GLsizeiptr size, GLvoid* data); void MAGNUM_LOCAL getSubDataImplementationDefault(GLintptr offset, GLsizeiptr size, GLvoid* data);
#ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL getSubDataImplementationDSA(GLintptr offset, GLsizeiptr size, GLvoid* data); void MAGNUM_LOCAL getSubDataImplementationDSA(GLintptr offset, GLsizeiptr size, GLvoid* data);
#endif
static MAGNUM_LOCAL GetSubDataImplementation getSubDataImplementation; static MAGNUM_LOCAL GetSubDataImplementation getSubDataImplementation;
#endif
typedef void(Buffer::*DataImplementation)(GLsizeiptr, const GLvoid*, Usage); typedef void(Buffer::*DataImplementation)(GLsizeiptr, const GLvoid*, Usage);
void MAGNUM_LOCAL dataImplementationDefault(GLsizeiptr size, const GLvoid* data, Usage usage); void MAGNUM_LOCAL dataImplementationDefault(GLsizeiptr size, const GLvoid* data, Usage usage);

Loading…
Cancel
Save