Browse Source

Full ARB_direct_state_access support in Buffer.

pull/77/head
Vladimír Vondruš 12 years ago
parent
commit
374571ef04
  1. 36
      src/Magnum/Buffer.cpp
  2. 179
      src/Magnum/Buffer.h
  3. 14
      src/Magnum/Implementation/BufferState.cpp

36
src/Magnum/Buffer.cpp

@ -415,6 +415,10 @@ void Buffer::copyImplementationDefault(Buffer& read, Buffer& write, GLintptr rea
}
#ifndef MAGNUM_TARGET_GLES
void Buffer::copyImplementationDSA(Buffer& read, Buffer& write, const GLintptr readOffset, const GLintptr writeOffset, const GLsizeiptr size) {
glCopyNamedBufferSubData(read._id, write._id, readOffset, writeOffset, size);
}
void Buffer::copyImplementationDSAEXT(Buffer& read, Buffer& write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) {
read._created = write._created = true;
glNamedCopyBufferSubDataEXT(read._id, write._id, readOffset, writeOffset, size);
@ -427,6 +431,10 @@ void Buffer::getParameterImplementationDefault(const GLenum value, GLint* const
}
#ifndef MAGNUM_TARGET_GLES
void Buffer::getParameterImplementationDSA(const GLenum value, GLint* const data) {
glGetNamedBufferParameteriv(_id, value, data);
}
void Buffer::getParameterImplementationDSAEXT(const GLenum value, GLint* const data) {
_created = true;
glGetNamedBufferParameterivEXT(_id, value, data);
@ -438,6 +446,10 @@ void Buffer::getSubDataImplementationDefault(const GLintptr offset, const GLsize
glGetBufferSubData(GLenum(bindSomewhereInternal(_targetHint)), offset, size, data);
}
void Buffer::getSubDataImplementationDSA(const GLintptr offset, const GLsizeiptr size, GLvoid* const data) {
glGetNamedBufferSubData(_id, offset, size, data);
}
void Buffer::getSubDataImplementationDSAEXT(const GLintptr offset, const GLsizeiptr size, GLvoid* const data) {
_created = true;
glGetNamedBufferSubDataEXT(_id, offset, size, data);
@ -449,6 +461,10 @@ void Buffer::dataImplementationDefault(GLsizeiptr size, const GLvoid* data, Buff
}
#ifndef MAGNUM_TARGET_GLES
void Buffer::dataImplementationDSA(const GLsizeiptr size, const GLvoid* const data, const BufferUsage usage) {
glNamedBufferData(_id, size, data, GLenum(usage));
}
void Buffer::dataImplementationDSAEXT(GLsizeiptr size, const GLvoid* data, BufferUsage usage) {
_created = true;
glNamedBufferDataEXT(_id, size, data, GLenum(usage));
@ -460,6 +476,10 @@ void Buffer::subDataImplementationDefault(GLintptr offset, GLsizeiptr size, cons
}
#ifndef MAGNUM_TARGET_GLES
void Buffer::subDataImplementationDSA(const GLintptr offset, const GLsizeiptr size, const GLvoid* const data) {
glNamedBufferSubData(_id, offset, size, data);
}
void Buffer::subDataImplementationDSAEXT(GLintptr offset, GLsizeiptr size, const GLvoid* data) {
_created = true;
glNamedBufferSubDataEXT(_id, offset, size, data);
@ -496,6 +516,10 @@ void* Buffer::mapImplementationDefault(MapAccess access) {
}
#ifndef MAGNUM_TARGET_GLES
void* Buffer::mapImplementationDSA(const MapAccess access) {
return glMapNamedBuffer(_id, GLenum(access));
}
void* Buffer::mapImplementationDSAEXT(MapAccess access) {
_created = true;
return glMapNamedBufferEXT(_id, GLenum(access));
@ -516,6 +540,10 @@ void* Buffer::mapRangeImplementationDefault(GLintptr offset, GLsizeiptr length,
}
#ifndef MAGNUM_TARGET_GLES
void* Buffer::mapRangeImplementationDSA(const GLintptr offset, const GLsizeiptr length, const MapFlags access) {
return glMapNamedBufferRange(_id, offset, length, GLenum(access));
}
void* Buffer::mapRangeImplementationDSAEXT(GLintptr offset, GLsizeiptr length, MapFlags access) {
_created = true;
return glMapNamedBufferRangeEXT(_id, offset, length, GLenum(access));
@ -535,6 +563,10 @@ void Buffer::flushMappedRangeImplementationDefault(GLintptr offset, GLsizeiptr l
}
#ifndef MAGNUM_TARGET_GLES
void Buffer::flushMappedRangeImplementationDSA(const GLintptr offset, const GLsizeiptr length) {
glFlushMappedNamedBufferRange(_id, offset, length);
}
void Buffer::flushMappedRangeImplementationDSAEXT(GLintptr offset, GLsizeiptr length) {
_created = true;
glFlushMappedNamedBufferRangeEXT(_id, offset, length);
@ -552,6 +584,10 @@ bool Buffer::unmapImplementationDefault() {
}
#ifndef MAGNUM_TARGET_GLES
bool Buffer::unmapImplementationDSA() {
return glUnmapNamedBuffer(_id);
}
bool Buffer::unmapImplementationDSAEXT() {
_created = true;
return glUnmapNamedBufferEXT(_id);

179
src/Magnum/Buffer.h

@ -195,10 +195,12 @@ rebinding. Buffer limits and implementation-defined values (such as
@ref maxUniformBindings()) are cached, so repeated queries don't result in
repeated @fn_gl{Get} calls.
If extension @extension{EXT,direct_state_access} is available, functions
@ref copy(), @ref setData(), @ref setSubData(), @ref map(), @ref flushMappedRange()
and @ref unmap() use DSA functions to avoid unnecessary calls to
@fn_gl{BindBuffer}. See their respective documentation for more information.
If on desktop GL and either @extension{ARB,direct_state_access} (part of OpenGL
4.5) or @extension{EXT,direct_state_access} is available, functions
@ref copy(), @ref size(), @ref data(), @ref subData(), @ref setData(),
@ref setSubData(), @ref map(), @ref flushMappedRange() and @ref unmap() use DSA
functions to avoid unnecessary calls to @fn_gl{BindBuffer}. See their
respective documentation for more information.
You can use functions @ref invalidateData() and @ref invalidateSubData() if you
don't need buffer data anymore to avoid unnecessary memory operations performed
@ -652,7 +654,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @fn_gl{BindBufferBase}
* @requires_gl30 No form of indexed buffer binding is available in
* OpenGL 2.1, see particular @ref Magnum::Buffer::Target "Target"
* values for version requirements.
* values for version/extension requirements.
* @requires_gles30 No form of indexed buffer binding is available in
* OpenGL ES 2.0, see particular @ref Magnum::Buffer::Target "Target"
* values for version requirements.
@ -675,7 +677,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @fn_gl{BindBuffersBase} or @fn_gl{BindBufferBase}
* @requires_gl30 No form of indexed buffer binding is available in
* OpenGL 2.1, see particular @ref Magnum::Buffer::Target "Target"
* values for version requirements.
* values for version/extension requirements.
* @requires_gles30 No form of indexed buffer binding is available in
* OpenGL ES 2.0, see particular @ref Magnum::Buffer::Target "Target"
* values for version requirements.
@ -705,7 +707,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @fn_gl{BindBuffersRange} or @fn_gl{BindBufferRange}
* @requires_gl30 No form of indexed buffer binding is available in
* OpenGL 2.1, see particular @ref Magnum::Buffer::Target "Target"
* values for version requirements.
* values for version/extension requirements.
* @requires_gles30 No form of indexed buffer binding is available in
* OpenGL ES 2.0, see particular @ref Magnum::Buffer::Target "Target"
* values for version requirements.
@ -731,7 +733,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* or @fn_gl{BindBufferBase}
* @requires_gl30 No form of indexed buffer binding is available in
* OpenGL 2.1, see particular @ref Magnum::Buffer::Target "Target"
* values for version requirements.
* values for version/extension requirements.
* @requires_gles30 No form of indexed buffer binding is available in
* OpenGL ES 2.0, see particular @ref Magnum::Buffer::Target "Target"
* values for version requirements.
@ -746,12 +748,13 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @param writeOffset Offset in the write buffer
* @param size Data size
*
* If @extension{EXT,direct_state_access} is not available and the
* buffers aren't already bound somewhere, they are bound to
* @ref Target::CopyRead and @ref Target::CopyWrite before the copy is
* performed.
* @see @fn_gl{BindBuffer} and @fn_gl{CopyBufferSubData} or
* @fn_gl_extension{NamedCopyBufferSubData,EXT,direct_state_access}
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part
* of OpenGL 4.5) nor @extension{EXT,direct_state_access} is available,
* @p read buffer is bound for reading and @p write buffer is bound for
* writing before the copy is performed (if not already).
* @see @fn_gl2{CopyNamedBufferSubData,CopyBufferSubData},
* @fn_gl_extension{NamedCopyBufferSubData,EXT,direct_state_access},
* eventually @fn_gl{BindBuffer} and @fn_gl{CopyBufferSubData}
* @requires_gl31 Extension @extension{ARB,copy_buffer}
* @requires_gles30 Buffer copying is not available in OpenGL ES 2.0.
*/
@ -842,12 +845,12 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @brief Set target hint
* @return Reference to self (for method chaining)
*
* If @extension{EXT,direct_state_access} is not available, the buffer
* must be internally bound to some target before any operation. You
* can specify target which will always be used when binding the buffer
* internally, possibly saving some calls to @fn_gl{BindBuffer}.
*
* Default target hint is @ref Target::Array.
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part
* of OpenGL 4.5) nor @extension{EXT,direct_state_access} is available,
* the buffer needs to be internally bound to some target before any
* operation. You can specify target which will always be used when
* binding the buffer internally, possibly saving some calls to
* @fn_gl{BindBuffer}. Default target hint is @ref Target::Array.
* @see @ref setData(), @ref setSubData()
* @todo Target::ElementArray cannot be used when no VAO is bound -
* http://www.opengl.org/wiki/Vertex_Specification#Index_buffers
@ -887,7 +890,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @fn_gl{BindBufferRange}
* @requires_gl30 No form of indexed buffer binding is available in
* OpenGL 2.1, see particular @ref Magnum::Buffer::Target "Target"
* values for version requirements.
* values for version/extension requirements.
* @requires_gles30 No form of indexed buffer binding is available in
* OpenGL ES 2.0, see particular @ref Magnum::Buffer::Target "Target"
* values for version requirements.
@ -909,7 +912,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @fn_gl{BindBufferBase}
* @requires_gl30 No form of indexed buffer binding is available in
* OpenGL 2.1, see particular @ref Magnum::Buffer::Target "Target"
* values for version requirements.
* values for version/extension requirements.
* @requires_gles30 No form of indexed buffer binding is available in
* OpenGL ES 2.0, see particular @ref Magnum::Buffer::Target "Target"
* values for version requirements.
@ -920,12 +923,13 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
/**
* @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
* before the operation.
* @see @fn_gl{BindBuffer} and @fn_gl{GetBufferParameter} or
* @fn_gl_extension{GetNamedBufferParameter,EXT,direct_state_access}
* with @def_gl{BUFFER_SIZE}
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part
* of OpenGL 4.5) nor @extension{EXT,direct_state_access} is available,
* the buffer is bound to hinted target before the operation (if not
* already).
* @see @ref setTargetHint(), @fn_gl2{GetNamedBufferParameter,GetBufferParameter},
* @fn_gl_extension{GetNamedBufferParameter,EXT,direct_state_access},
* eventually @fn_gl{BindBuffer} and @fn_gl{GetBufferParameter}
*/
Int size();
@ -933,14 +937,17 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
/**
* @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
* is bound to hinted target before the operation.
* @see @ref size(), @ref subData(), @ref setData(), @fn_gl{BindBuffer}
* and @fn_gl{GetBufferParameter} or
* @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}
* Returns data of whole buffer. If neither @extension{ARB,direct_state_access}
* (part of OpenGL 4.5) nor @extension{EXT,direct_state_access} is
* available, the buffer is bound to hinted target before the operation
* (if not already).
* @see @ref size(), @ref subData(), @ref setData(), @ref setTargetHint(),
* @fn_gl2{GetNamedBufferParameter,GetBufferParameter},
* @fn_gl_extension{GetNamedBufferParameter,EXT,direct_state_access},
* eventually @fn_gl{BindBuffer} and @fn_gl{GetBufferParameter}
* with @def_gl{BUFFER_SIZE}, then @fn_gl2{GetNamedBufferSubData,GetBufferSubData},
* @fn_gl_extension{GetNamedBufferSubData,EXT,direct_state_access},
* eventually @fn_gl{GetBufferSubData}
* @requires_gl Buffer data queries are not available in OpenGL ES.
* Use @ref Magnum::Buffer::map() "map()" instead.
*/
@ -951,12 +958,14 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @param offset Byte offset in the buffer
* @param size Data size (count of @p T values)
*
* Returns data of given buffer portion. If @extension{EXT,direct_state_access}
* is not available and the buffer is not already bound somewhere, it
* is bound to hinted target before the operation.
* @see @ref size(), @ref data(), @ref setSubData(), @fn_gl{BindBuffer}
* and @fn_gl{GetBufferSubData} or
* @fn_gl_extension{GetNamedBufferSubData,EXT,direct_state_access}
* Returns data of given buffer portion. If neither
* @extension{ARB,direct_state_access} (part of OpenGL 4.5) nor
* @extension{EXT,direct_state_access} is available, the buffer is
* bound to hinted target before the operation (if not already).
* @see @ref size(), @ref data(), @ref setSubData(), @ref setTargetHint(),
* @fn_gl2{GetNamedBufferSubData,GetBufferSubData},
* @fn_gl_extension{GetNamedBufferSubData,EXT,direct_state_access},
* eventually @fn_gl{BindBuffer} and @fn_gl{GetBufferSubData}
* @requires_gl Buffer data queries are not available in OpenGL ES.
* Use @ref Magnum::Buffer::map() "map()" instead.
*/
@ -969,11 +978,13 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @param usage Buffer usage
* @return Reference to self (for method chaining)
*
* If @extension{EXT,direct_state_access} is not available and the
* buffer is not already bound somewhere, it is bound to hinted target
* before the operation.
* @see @ref setTargetHint(), @fn_gl{BindBuffer} and @fn_gl{BufferData}
* or @fn_gl_extension{NamedBufferData,EXT,direct_state_access}
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part
* of OpenGL 4.5) nor @extension{EXT,direct_state_access} is available,
* the buffer is bound to hinted target before the operation (if not
* already).
* @see @ref setTargetHint(), @fn_gl2{NamedBufferData,BufferData},
* @fn_gl_extension{NamedBufferData,EXT,direct_state_access},
* eventually @fn_gl{BindBuffer} and @fn_gl{BufferData}
*/
Buffer& setData(Containers::ArrayReference<const void> data, BufferUsage usage);
@ -995,11 +1006,13 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @param data Data
* @return Reference to self (for method chaining)
*
* If @extension{EXT,direct_state_access} is not available and the
* buffer is not already bound somewhere, it is bound to hinted target
* before the operation.
* @see @ref setTargetHint(), @fn_gl{BindBuffer} and @fn_gl{BufferSubData}
* or @fn_gl_extension{NamedBufferSubData,EXT,direct_state_access}
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part
* of OpenGL 4.5) nor @extension{EXT,direct_state_access} is available,
* the buffer is bound to hinted target before the operation (if not
* already).
* @see @ref setTargetHint(), @fn_gl2{NamedBufferSubData,BufferSubData},
* @fn_gl_extension{NamedBufferSubData,EXT,direct_state_access},
* eventually @fn_gl{BindBuffer} and @fn_gl{BufferSubData}
*/
Buffer& setSubData(GLintptr offset, Containers::ArrayReference<const void> data);
@ -1042,12 +1055,14 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @param access Access
* @return Pointer to buffer data
*
* If @extension{EXT,direct_state_access} is not available and the
* buffer is not already bound somewhere, it is bound to hinted target
* before the operation.
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part
* of OpenGL 4.5) nor @extension{EXT,direct_state_access} is available,
* the buffer is bound to hinted target before the operation (if not
* already).
* @see @ref minMapAlignment(), @ref unmap(), @ref setTargetHint(),
* @fn_gl{BindBuffer} and @fn_gl{MapBuffer} or
* @fn_gl_extension{MapNamedBuffer,EXT,direct_state_access}
* @fn_gl2{MapNamedBuffer,MapBuffer},
* @fn_gl_extension{MapNamedBuffer,EXT,direct_state_access},
* eventually @fn_gl{BindBuffer} and @fn_gl{MapBuffer}
* @requires_es_extension Extension @es_extension{OES,mapbuffer} in
* OpenGL ES 2.0, use @ref Magnum::Buffer::map(GLintptr, GLsizeiptr, MapFlags) "map(GLintptr, GLsizeiptr, MapFlags)"
* in OpenGL ES 3.0 instead.
@ -1064,8 +1079,8 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @param access Access
* @return Pointer to buffer data
*
* If the buffer is not already bound somewhere, it is bound to hinted
* target before the operation.
* The buffer is bound to hinted target before the operation (if not
* already).
* @see @ref unmapSub(), @ref setTargetHint(),
* @fn_gl_extension{MapBufferSubData,CHROMIUM,map_sub}
* @requires_gles20 Not available in ES 3.0 or desktop OpenGL. Use
@ -1086,12 +1101,15 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @ref MapFlag::Write must be specified.
* @return Pointer to buffer data
*
* If @extension{EXT,direct_state_access} is not available and the
* buffer is not already bound somewhere, it is bound to hinted target
* before the operation.
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part
* of OpenGL 4.5) nor @extension{EXT,direct_state_access} is available,
* the buffer is bound to hinted target before the operation (if not
* already).
* @see @ref minMapAlignment(), @ref flushMappedRange(), @ref unmap(),
* @ref map(MapAccess), @ref setTargetHint(), @fn_gl{BindBuffer}
* and @fn_gl{MapBufferRange} or @fn_gl_extension{MapNamedBufferRange,EXT,direct_state_access}
* @ref map(MapAccess), @ref setTargetHint(),
* @fn_gl2{MapNamedBufferRange,MapBufferRange},
* @fn_gl_extension{MapNamedBufferRange,EXT,direct_state_access},
* eventually @fn_gl{BindBuffer} and @fn_gl{MapBufferRange}
* @requires_gl30 Extension @extension{ARB,map_buffer_range}
* @requires_gles30 Extension @es_extension{EXT,map_buffer_range} in
* OpenGL ES 2.0
@ -1108,11 +1126,13 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @ref map() with @ref MapFlag::FlushExplicit flag. See
* @ref Buffer-data-mapping "class documentation" for usage example.
*
* If @extension{EXT,direct_state_access} is not available and the
* buffer is not already bound somewhere, it is bound to hinted target
* before the operation.
* @see @ref setTargetHint(), @fn_gl{BindBuffer} and @fn_gl{FlushMappedBufferRange}
* or @fn_gl_extension{FlushMappedNamedBufferRange,EXT,direct_state_access}
* If on OpenGL ES or neither @extension{ARB,direct_state_access} (part
* of OpenGL 4.5) nor @extension{EXT,direct_state_access} is available,
* the buffer is bound to hinted target before the operation (if not
* already).
* @see @ref setTargetHint(), @fn_gl2{FlushMappedNamedBufferRange,FlushMappedBufferRange},
* @fn_gl_extension{FlushMappedNamedBufferRange,EXT,direct_state_access},
* eventually @fn_gl{BindBuffer} and @fn_gl{FlushMappedBufferRange}
* @requires_gl30 Extension @extension{ARB,map_buffer_range}
* @requires_gles30 Extension @es_extension{EXT,map_buffer_range} in
* OpenGL ES 2.0
@ -1126,11 +1146,13 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* otherwise.
*
* Unmaps buffer previously mapped with @ref map(), invalidating the
* pointer returned by these functions. If @extension{EXT,direct_state_access}
* is not available and the buffer is not already bound somewhere, it
* is bound to hinted target before the operation.
* @see setTargetHint(), @fn_gl{BindBuffer} and @fn_gl{UnmapBuffer} or
* @fn_gl_extension{UnmapNamedBuffer,EXT,direct_state_access}
* pointer returned by these functions. If on OpenGL ES or neither
* @extension{ARB,direct_state_access} (part of OpenGL 4.5) nor
* @extension{EXT,direct_state_access} is available, the buffer is
* bound to hinted target before the operation (if not already).
* @see @ref setTargetHint(), @fn_gl2{UnmapNamedBuffer,UnmapBuffer},
* @fn_gl_extension{UnmapNamedBuffer,EXT,direct_state_access},
* eventually @fn_gl{BindBuffer} and @fn_gl{UnmapBuffer}
* @requires_gles30 Extension @es_extension{OES,mapbuffer} in OpenGL
* ES 2.0
*/
@ -1178,6 +1200,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
static void MAGNUM_LOCAL copyImplementationDefault(Buffer& read, Buffer& write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
#ifndef MAGNUM_TARGET_GLES
static void MAGNUM_LOCAL copyImplementationDSA(Buffer& read, Buffer& write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
static void MAGNUM_LOCAL copyImplementationDSAEXT(Buffer& read, Buffer& write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
#endif
#endif
@ -1197,21 +1220,25 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
void MAGNUM_LOCAL getParameterImplementationDefault(GLenum value, GLint* data);
#ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL getParameterImplementationDSA(GLenum value, GLint* data);
void MAGNUM_LOCAL getParameterImplementationDSAEXT(GLenum value, GLint* data);
#endif
#ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL getSubDataImplementationDefault(GLintptr offset, GLsizeiptr size, GLvoid* data);
void MAGNUM_LOCAL getSubDataImplementationDSA(GLintptr offset, GLsizeiptr size, GLvoid* data);
void MAGNUM_LOCAL getSubDataImplementationDSAEXT(GLintptr offset, GLsizeiptr size, GLvoid* data);
#endif
void MAGNUM_LOCAL dataImplementationDefault(GLsizeiptr size, const GLvoid* data, BufferUsage usage);
#ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL dataImplementationDSA(GLsizeiptr size, const GLvoid* data, BufferUsage usage);
void MAGNUM_LOCAL dataImplementationDSAEXT(GLsizeiptr size, const GLvoid* data, BufferUsage usage);
#endif
void MAGNUM_LOCAL subDataImplementationDefault(GLintptr offset, GLsizeiptr size, const GLvoid* data);
#ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL subDataImplementationDSA(GLintptr offset, GLsizeiptr size, const GLvoid* data);
void MAGNUM_LOCAL subDataImplementationDSAEXT(GLintptr offset, GLsizeiptr size, const GLvoid* data);
#endif
@ -1227,21 +1254,25 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
void MAGNUM_LOCAL * mapImplementationDefault(MapAccess access);
#ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL * mapImplementationDSA(MapAccess access);
void MAGNUM_LOCAL * mapImplementationDSAEXT(MapAccess access);
#endif
void MAGNUM_LOCAL * mapRangeImplementationDefault(GLintptr offset, GLsizeiptr length, MapFlags access);
#ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL * mapRangeImplementationDSA(GLintptr offset, GLsizeiptr length, MapFlags access);
void MAGNUM_LOCAL * mapRangeImplementationDSAEXT(GLintptr offset, GLsizeiptr length, MapFlags access);
#endif
void MAGNUM_LOCAL flushMappedRangeImplementationDefault(GLintptr offset, GLsizeiptr length);
#ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL flushMappedRangeImplementationDSA(GLintptr offset, GLsizeiptr length);
void MAGNUM_LOCAL flushMappedRangeImplementationDSAEXT(GLintptr offset, GLsizeiptr length);
#endif
bool MAGNUM_LOCAL unmapImplementationDefault();
#ifndef MAGNUM_TARGET_GLES
bool MAGNUM_LOCAL unmapImplementationDSA();
bool MAGNUM_LOCAL unmapImplementationDSAEXT();
#endif

14
src/Magnum/Implementation/BufferState.cpp

@ -99,7 +99,19 @@ BufferState::BufferState(Context& context, std::vector<std::string>& extensions)
}
#ifndef MAGNUM_TARGET_GLES
if(context.isExtensionSupported<Extensions::GL::EXT::direct_state_access>()) {
if(context.isExtensionSupported<Extensions::GL::ARB::direct_state_access>()) {
extensions.push_back(Extensions::GL::ARB::direct_state_access::string());
copyImplementation = &Buffer::copyImplementationDSA;
getParameterImplementation = &Buffer::getParameterImplementationDSA;
getSubDataImplementation = &Buffer::getSubDataImplementationDSA;
dataImplementation = &Buffer::dataImplementationDSA;
subDataImplementation = &Buffer::subDataImplementationDSA;
mapImplementation = &Buffer::mapImplementationDSA;
mapRangeImplementation = &Buffer::mapRangeImplementationDSA;
flushMappedRangeImplementation = &Buffer::flushMappedRangeImplementationDSA;
unmapImplementation = &Buffer::unmapImplementationDSA;
} else if(context.isExtensionSupported<Extensions::GL::EXT::direct_state_access>()) {
extensions.push_back(Extensions::GL::EXT::direct_state_access::string());
copyImplementation = &Buffer::copyImplementationDSAEXT;

Loading…
Cancel
Save