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;
#endif
Buffer::GetParameterImplementation Buffer::getParameterImplementation = &Buffer::getParameterImplementationDefault;
#ifndef MAGNUM_TARGET_GLES
Buffer::GetSubDataImplementation Buffer::getSubDataImplementation = &Buffer::getSubDataImplementationDefault;
#endif
Buffer::DataImplementation Buffer::dataImplementation = &Buffer::dataImplementationDefault;
Buffer::SubDataImplementation Buffer::subDataImplementation = &Buffer::subDataImplementationDefault;
Buffer::InvalidateImplementation Buffer::invalidateImplementation = &Buffer::invalidateImplementationNoOp;
@ -126,6 +128,7 @@ Int Buffer::size() {
return size;
}
#ifndef MAGNUM_TARGET_GLES
Containers::Array<char> Buffer::data() {
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);
return std::move(data);
}
#endif
#ifndef MAGNUM_TARGET_GLES2
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
#ifndef MAGNUM_TARGET_GLES
void Buffer::getSubDataImplementationDefault(const GLintptr offset, const GLsizeiptr size, GLvoid* const data) {
glGetBufferSubData(GLenum(bindInternal(_targetHint)), offset, size, data);
}
#ifndef MAGNUM_TARGET_GLES
void Buffer::getSubDataImplementationDSA(const GLintptr offset, const GLsizeiptr size, GLvoid* const 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); }
/**
* @brief Buffer size
* @brief %Buffer size
*
* If @extension{EXT,direct_state_access} is not available and the
* buffer is not already bound somewhere, it is bound to hinted target
@ -532,8 +532,9 @@ class MAGNUM_EXPORT Buffer {
*/
Int size();
#ifndef MAGNUM_TARGET_GLES
/**
* @brief Buffer data
* @brief %Buffer data
*
* Returns data of whole buffer. If @extension{EXT,direct_state_access}
* 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}
* with @def_gl{BUFFER_SIZE}, @fn_gl{GetBufferSubData} 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> data();
/**
* @brief Buffer subdata
* @brief %Buffer subdata
* @param offset Offset in the buffer
* @param size Data size
*
@ -555,8 +558,11 @@ class MAGNUM_EXPORT Buffer {
* is bound to hinted target before the operation.
* @see size(), data(), setSubData(), @fn_gl{BindBuffer} and @fn_gl{GetBufferSubData}
* 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);
#endif
/**
* @brief Set buffer data
@ -792,12 +798,12 @@ class MAGNUM_EXPORT Buffer {
#endif
static MAGNUM_LOCAL GetParameterImplementation getParameterImplementation;
#ifndef MAGNUM_TARGET_GLES
typedef void(Buffer::*GetSubDataImplementation)(GLintptr, GLsizeiptr, GLvoid*);
void MAGNUM_LOCAL getSubDataImplementationDefault(GLintptr offset, GLsizeiptr size, GLvoid* data);
#ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL getSubDataImplementationDSA(GLintptr offset, GLsizeiptr size, GLvoid* data);
#endif
static MAGNUM_LOCAL GetSubDataImplementation getSubDataImplementation;
#endif
typedef void(Buffer::*DataImplementation)(GLsizeiptr, const GLvoid*, Usage);
void MAGNUM_LOCAL dataImplementationDefault(GLsizeiptr size, const GLvoid* data, Usage usage);

Loading…
Cancel
Save