Browse Source

OpenGL ES compilation fixes & workarounds.

pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
ae801ea945
  1. 25
      src/Buffer.cpp
  2. 32
      src/Buffer.h

25
src/Buffer.cpp

@ -123,7 +123,13 @@ void Buffer::setSubDataImplementationDSA(GLintptr offset, GLsizeiptr size, const
#endif #endif
void* Buffer::mapImplementationDefault(MapAccess access) { void* Buffer::mapImplementationDefault(MapAccess access) {
/** @todo Re-enable when extension wrangler is available for ES */
#ifndef MAGNUM_TARGET_GLES
return glMapBuffer(static_cast<GLenum>(bindInternal(_targetHint)), GLenum(access)); return glMapBuffer(static_cast<GLenum>(bindInternal(_targetHint)), GLenum(access));
#else
static_cast<void>(access);
return nullptr;
#endif
} }
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -133,7 +139,15 @@ void* Buffer::mapImplementationDSA(MapAccess access) {
#endif #endif
void* Buffer::mapRangeImplementationDefault(GLintptr offset, GLsizeiptr length, MapFlags access) { void* Buffer::mapRangeImplementationDefault(GLintptr offset, GLsizeiptr length, MapFlags access) {
/** @todo Re-enable when extension wrangler is available for ES */
#ifndef MAGNUM_TARGET_GLES2
return glMapBufferRange(static_cast<GLenum>(bindInternal(_targetHint)), offset, length, GLenum(access)); return glMapBufferRange(static_cast<GLenum>(bindInternal(_targetHint)), offset, length, GLenum(access));
#else
static_cast<void>(offset);
static_cast<void>(length);
static_cast<void>(access);
return nullptr;
#endif
} }
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -143,7 +157,13 @@ void* Buffer::mapRangeImplementationDSA(GLintptr offset, GLsizeiptr length, MapF
#endif #endif
void Buffer::flushMappedRangeImplementationDefault(GLintptr offset, GLsizeiptr length) { void Buffer::flushMappedRangeImplementationDefault(GLintptr offset, GLsizeiptr length) {
/** @todo Re-enable when extension wrangler is available for ES */
#ifndef MAGNUM_TARGET_GLES2
glFlushMappedBufferRange(static_cast<GLenum>(bindInternal(_targetHint)), offset, length); glFlushMappedBufferRange(static_cast<GLenum>(bindInternal(_targetHint)), offset, length);
#else
static_cast<void>(offset);
static_cast<void>(length);
#endif
} }
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -153,7 +173,12 @@ void Buffer::flushMappedRangeImplementationDSA(GLintptr offset, GLsizeiptr lengt
#endif #endif
bool Buffer::unmapImplementationDefault() { bool Buffer::unmapImplementationDefault() {
/** @todo Re-enable when extension wrangler is available for ES */
#ifndef MAGNUM_TARGET_GLES2
return glUnmapBuffer(static_cast<GLenum>(bindInternal(_targetHint))); return glUnmapBuffer(static_cast<GLenum>(bindInternal(_targetHint)));
#else
return false;
#endif
} }
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES

32
src/Buffer.h

@ -324,10 +324,10 @@ class MAGNUM_EXPORT Buffer {
/** /**
* Map buffer for writing only. * Map buffer for writing only.
*/ */
WriteOnly = GL_WRITE_ONLY #ifdef MAGNUM_TARGET_GLES
WriteOnly = GL_WRITE_ONLY_OES
#ifndef MAGNUM_TARGET_GLES #else
, WriteOnly = GL_WRITE_ONLY,
/** /**
* Map buffer for both reading and writing. * Map buffer for both reading and writing.
@ -347,35 +347,59 @@ class MAGNUM_EXPORT Buffer {
*/ */
enum class MapFlag: GLbitfield { enum class MapFlag: GLbitfield {
/** Map buffer for reading. */ /** Map buffer for reading. */
#ifndef MAGNUM_TARGET_GLES2
Read = GL_MAP_READ_BIT, Read = GL_MAP_READ_BIT,
#else
Read = GL_MAP_READ_BIT_EXT,
#endif
/** Map buffer for writing. */ /** Map buffer for writing. */
#ifndef MAGNUM_TARGET_GLES2
Write = GL_MAP_WRITE_BIT, Write = GL_MAP_WRITE_BIT,
#else
Write = GL_MAP_WRITE_BIT_EXT,
#endif
/** /**
* Previous contents of the entire buffer may be discarded. May * Previous contents of the entire buffer may be discarded. May
* not be used in combination with @ref MapFlag "MapFlag::Read". * not be used in combination with @ref MapFlag "MapFlag::Read".
*/ */
#ifndef MAGNUM_TARGET_GLES2
InvalidateBuffer = GL_MAP_INVALIDATE_BUFFER_BIT, InvalidateBuffer = GL_MAP_INVALIDATE_BUFFER_BIT,
#else
InvalidateBuffer = GL_MAP_INVALIDATE_BUFFER_BIT_EXT,
#endif
/** /**
* Previous contents of mapped range may be discarded. May not * Previous contents of mapped range may be discarded. May not
* be used in combination with @ref MapFlag "MapFlag::Read". * be used in combination with @ref MapFlag "MapFlag::Read".
*/ */
#ifndef MAGNUM_TARGET_GLES2
InvalidateRange = GL_MAP_INVALIDATE_RANGE_BIT, InvalidateRange = GL_MAP_INVALIDATE_RANGE_BIT,
#else
InvalidateRange = GL_MAP_INVALIDATE_RANGE_BIT_EXT,
#endif
/** /**
* Only one or more discrete subranges of the mapping will be * Only one or more discrete subranges of the mapping will be
* modified. See flushMappedRange() for more information. May only * modified. See flushMappedRange() for more information. May only
* be used in conjuction with @ref MapFlag "MapFlag::Write". * be used in conjuction with @ref MapFlag "MapFlag::Write".
*/ */
#ifndef MAGNUM_TARGET_GLES2
FlushExplicit = GL_MAP_FLUSH_EXPLICIT_BIT, FlushExplicit = GL_MAP_FLUSH_EXPLICIT_BIT,
#else
FlushExplicit = GL_MAP_FLUSH_EXPLICIT_BIT_EXT,
#endif
/** /**
* No pending operations on the buffer should be synchronized * No pending operations on the buffer should be synchronized
* before mapping. * before mapping.
*/ */
#ifndef MAGNUM_TARGET_GLES2
Unsynchronized = GL_MAP_UNSYNCHRONIZED_BIT Unsynchronized = GL_MAP_UNSYNCHRONIZED_BIT
#else
Unsynchronized = GL_MAP_UNSYNCHRONIZED_BIT_EXT
#endif
}; };
/** /**

Loading…
Cancel
Save