Browse Source

Expose CHROMIUM_map_sub only for NaCl.

It's not even in official registry.
pull/107/head
Vladimír Vondruš 11 years ago
parent
commit
d3e83f797d
  1. 2
      doc/opengl-support.dox
  2. 15
      src/Magnum/Buffer.cpp
  3. 4
      src/Magnum/Buffer.h
  4. 2
      src/Magnum/Context.cpp
  5. 2
      src/Magnum/Extensions.h
  6. 6
      src/Magnum/Test/BufferGLTest.cpp
  7. 18
      src/Magnum/Text/Renderer.cpp
  8. 4
      src/Magnum/Text/Renderer.h
  9. 7
      src/Magnum/Text/Test/RendererGLTest.cpp
  10. 1
      src/MagnumExternal/OpenGL/GLES2/extensions.txt
  11. 1
      src/MagnumExternal/OpenGL/GLES3/extensions.txt

2
doc/opengl-support.dox

@ -344,7 +344,7 @@ Only extensions not already listed in above tables are included here.
Extension | Status
------------------------------------------- | ------
@es_extension{APPLE,texture_format_BGRA8888} | done
@es_extension{CHROMIUM,map_sub} | only buffer mapping
@es_extension{CHROMIUM,map_sub} (NaCl only) | only buffer mapping
@es_extension{EXT,texture_format_BGRA8888} | done
@es_extension{EXT,read_format_bgra} | done
@es_extension2{EXT,multi_draw_arrays,multi_draw_arrays} | done

15
src/Magnum/Buffer.cpp

@ -344,17 +344,10 @@ void* Buffer::map(const MapAccess access) {
return (this->*Context::current()->state().buffer->mapImplementation)(access);
}
#ifdef MAGNUM_TARGET_GLES2
#ifdef CORRADE_TARGET_NACL
void* Buffer::mapSub(const GLintptr offset, const GLsizeiptr length, const MapAccess access) {
#ifdef CORRADE_TARGET_NACL
CORRADE_ASSERT(!_mappedBuffer, "Buffer::mapSub(): the buffer is already mapped", nullptr);
return _mappedBuffer = glMapBufferSubDataCHROMIUM(GLenum(bindSomewhereInternal(_targetHint)), offset, length, GLenum(access));
#else
static_cast<void>(offset);
static_cast<void>(length);
static_cast<void>(access);
CORRADE_ASSERT_UNREACHABLE();
#endif
}
#endif
@ -369,15 +362,11 @@ Buffer& Buffer::flushMappedRange(const GLintptr offset, const GLsizeiptr length)
bool Buffer::unmap() { return (this->*Context::current()->state().buffer->unmapImplementation)(); }
#ifdef MAGNUM_TARGET_GLES2
#ifdef CORRADE_TARGET_NACL
void Buffer::unmapSub() {
#ifdef CORRADE_TARGET_NACL
CORRADE_ASSERT(_mappedBuffer, "Buffer::unmapSub(): the buffer is not mapped", );
glUnmapBufferSubDataCHROMIUM(_mappedBuffer);
_mappedBuffer = nullptr;
#else
CORRADE_ASSERT_UNREACHABLE();
#endif
}
#endif
#endif

4
src/Magnum/Buffer.h

@ -1145,7 +1145,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
return static_cast<T*>(map(access));
}
#if defined(MAGNUM_TARGET_GLES2) || defined(DOXYGEN_GENERATING_OUTPUT)
#ifdef CORRADE_TARGET_NACL
/**
* @brief Map portion of buffer to client memory
* @param offset Offset into the buffer
@ -1246,7 +1246,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
*/
bool unmap();
#if defined(MAGNUM_TARGET_GLES2) || defined(DOXYGEN_GENERATING_OUTPUT)
#ifdef CORRADE_TARGET_NACL
/**
* @brief Unmap portion of buffer
*

2
src/Magnum/Context.cpp

@ -241,7 +241,9 @@ const std::vector<Extension>& Extension::extensions(Version version) {
#else
static const std::vector<Extension> extensions{
_extension(GL,APPLE,texture_format_BGRA8888),
#ifdef CORRADE_TARGET_NACL
_extension(GL,CHROMIUM,map_sub),
#endif
_extension(GL,EXT,texture_filter_anisotropic),
_extension(GL,EXT,texture_format_BGRA8888),
_extension(GL,EXT,read_format_bgra),

2
src/Magnum/Extensions.h

@ -281,7 +281,9 @@ namespace GL {
_extension(GL,ARM,rgba8, GLES200, GLES300) // #82
#endif
} namespace CHROMIUM {
#ifdef CORRADE_TARGET_NACL
_extension(GL,CHROMIUM,map_sub, GLES200, None)
#endif
} namespace EXT {
_extension(GL,EXT,texture_filter_anisotropic, GLES200, None) // #41
#ifdef MAGNUM_TARGET_GLES2

6
src/Magnum/Test/BufferGLTest.cpp

@ -50,7 +50,7 @@ struct BufferGLTest: AbstractOpenGLTester {
void data();
void map();
#ifdef MAGNUM_TARGET_GLES2
#ifdef CORRADE_TARGET_NACL
void mapSub();
#endif
void mapRange();
@ -75,7 +75,7 @@ BufferGLTest::BufferGLTest() {
&BufferGLTest::data,
&BufferGLTest::map,
#ifdef MAGNUM_TARGET_GLES2
#ifdef CORRADE_TARGET_NACL
&BufferGLTest::mapSub,
#endif
&BufferGLTest::mapRange,
@ -288,7 +288,7 @@ void BufferGLTest::map() {
#endif
}
#ifdef MAGNUM_TARGET_GLES2
#ifdef CORRADE_TARGET_NACL
void BufferGLTest::mapSub() {
if(!Context::current()->isExtensionSupported<Extensions::GL::CHROMIUM::map_sub>())
CORRADE_SKIP(Extensions::GL::CHROMIUM::map_sub::string() + std::string(" is not supported"));

18
src/Magnum/Text/Renderer.cpp

@ -265,6 +265,7 @@ void* AbstractRenderer::bufferMapImplementationFull(Buffer& buffer, GLsizeiptr)
return buffer.map(Buffer::MapAccess::WriteOnly);
}
#ifdef CORRADE_TARGET_NACL
void* AbstractRenderer::bufferMapImplementationSub(Buffer& buffer, GLsizeiptr length) {
return buffer.mapSub(0, length, Buffer::MapAccess::WriteOnly);
}
@ -273,6 +274,7 @@ void AbstractRenderer::bufferUnmapImplementationSub(Buffer& buffer) {
buffer.unmapSub();
}
#endif
#endif
#if !defined(MAGNUM_TARGET_GLES2) || defined(CORRADE_TARGET_EMSCRIPTEN)
inline void* AbstractRenderer::bufferMapImplementation(Buffer& buffer, GLsizeiptr length)
@ -307,14 +309,20 @@ AbstractRenderer::AbstractRenderer(AbstractFont& font, const GlyphCache& cache,
#elif defined(MAGNUM_TARGET_GLES2) && !defined(CORRADE_TARGET_EMSCRIPTEN)
if(Context::current()->isExtensionSupported<Extensions::GL::EXT::map_buffer_range>()) {
bufferMapImplementation = &AbstractRenderer::bufferMapImplementationRange;
} else if(Context::current()->isExtensionSupported<Extensions::GL::CHROMIUM::map_sub>()) {
}
#ifdef CORRADE_TARGET_NACL
else if(Context::current()->isExtensionSupported<Extensions::GL::CHROMIUM::map_sub>()) {
bufferMapImplementation = &AbstractRenderer::bufferMapImplementationSub;
bufferUnmapImplementation = &AbstractRenderer::bufferUnmapImplementationSub;
} else {
}
#endif
else {
MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::OES::mapbuffer);
Warning() << "Text::Renderer: neither" << Extensions::GL::EXT::map_buffer_range::string()
<< "nor" << Extensions::GL::CHROMIUM::map_sub::string()
<< "is supported, using inefficient" << Extensions::GL::OES::mapbuffer::string()
Warning() << "Text::Renderer:" << Extensions::GL::EXT::map_buffer_range::string()
#ifdef CORRADE_TARGET_NACL
<< "or" << Extensions::GL::CHROMIUM::map_sub::string()
#endif
<< "is not supported, using inefficient" << Extensions::GL::OES::mapbuffer::string()
<< "instead";
}
#endif

4
src/Magnum/Text/Renderer.h

@ -136,7 +136,9 @@ class MAGNUM_TEXT_EXPORT AbstractRenderer {
#if defined(MAGNUM_TARGET_GLES2) && !defined(CORRADE_TARGET_EMSCRIPTEN)
typedef void*(*BufferMapImplementation)(Buffer&, GLsizeiptr);
static MAGNUM_TEXT_LOCAL void* bufferMapImplementationFull(Buffer& buffer, GLsizeiptr length);
#ifdef CORRADE_TARGET_NACL
static MAGNUM_TEXT_LOCAL void* bufferMapImplementationSub(Buffer& buffer, GLsizeiptr length);
#endif
static MAGNUM_TEXT_LOCAL void* bufferMapImplementationRange(Buffer& buffer, GLsizeiptr length);
static BufferMapImplementation bufferMapImplementation;
#else
@ -151,7 +153,9 @@ class MAGNUM_TEXT_EXPORT AbstractRenderer {
#if defined(MAGNUM_TARGET_GLES2) && !defined(CORRADE_TARGET_EMSCRIPTEN)
typedef void(*BufferUnmapImplementation)(Buffer&);
static MAGNUM_TEXT_LOCAL void bufferUnmapImplementationDefault(Buffer& buffer);
#ifdef CORRADE_TARGET_NACL
static MAGNUM_TEXT_LOCAL void bufferUnmapImplementationSub(Buffer& buffer);
#endif
static MAGNUM_TEXT_LOCAL BufferUnmapImplementation bufferUnmapImplementation;
#else
#ifndef CORRADE_TARGET_EMSCRIPTEN

7
src/Magnum/Text/Test/RendererGLTest.cpp

@ -262,8 +262,11 @@ void RendererGLTest::mutableText() {
CORRADE_SKIP(Extensions::GL::ARB::map_buffer_range::string() + std::string(" is not supported"));
#elif defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_EMSCRIPTEN)
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::map_buffer_range>() &&
!Context::current()->isExtensionSupported<Extensions::GL::OES::mapbuffer>() &&
!Context::current()->isExtensionSupported<Extensions::GL::CHROMIUM::map_sub>()) {
!Context::current()->isExtensionSupported<Extensions::GL::OES::mapbuffer>()
#ifdef CORRADE_TARGET_NACL
&& !Context::current()->isExtensionSupported<Extensions::GL::CHROMIUM::map_sub>()
#endif
) {
CORRADE_SKIP("No required extension is supported");
}
#endif

1
src/MagnumExternal/OpenGL/GLES2/extensions.txt vendored

@ -47,7 +47,6 @@ extension OES_required_internalformat optional
extension OES_surfaceless_context optional
extension APPLE_texture_format_BGRA8888 optional
extension CHROMIUM_map_sub optional
extension EXT_texture_filter_anisotropic optional
extension EXT_texture_format_BGRA8888 optional
extension EXT_read_format_bgra optional

1
src/MagnumExternal/OpenGL/GLES3/extensions.txt vendored

@ -3,7 +3,6 @@
version 3.1 es
extension APPLE_texture_format_BGRA8888 optional
extension CHROMIUM_map_sub optional
extension EXT_texture_filter_anisotropic optional
extension EXT_texture_format_BGRA8888 optional
extension EXT_read_format_bgra optional

Loading…
Cancel
Save