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 Extension | Status
------------------------------------------- | ------ ------------------------------------------- | ------
@es_extension{APPLE,texture_format_BGRA8888} | done @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,texture_format_BGRA8888} | done
@es_extension{EXT,read_format_bgra} | done @es_extension{EXT,read_format_bgra} | done
@es_extension2{EXT,multi_draw_arrays,multi_draw_arrays} | 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); 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) { 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); CORRADE_ASSERT(!_mappedBuffer, "Buffer::mapSub(): the buffer is already mapped", nullptr);
return _mappedBuffer = glMapBufferSubDataCHROMIUM(GLenum(bindSomewhereInternal(_targetHint)), offset, length, GLenum(access)); 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 #endif
@ -369,15 +362,11 @@ Buffer& Buffer::flushMappedRange(const GLintptr offset, const GLsizeiptr length)
bool Buffer::unmap() { return (this->*Context::current()->state().buffer->unmapImplementation)(); } bool Buffer::unmap() { return (this->*Context::current()->state().buffer->unmapImplementation)(); }
#ifdef MAGNUM_TARGET_GLES2 #ifdef CORRADE_TARGET_NACL
void Buffer::unmapSub() { void Buffer::unmapSub() {
#ifdef CORRADE_TARGET_NACL
CORRADE_ASSERT(_mappedBuffer, "Buffer::unmapSub(): the buffer is not mapped", ); CORRADE_ASSERT(_mappedBuffer, "Buffer::unmapSub(): the buffer is not mapped", );
glUnmapBufferSubDataCHROMIUM(_mappedBuffer); glUnmapBufferSubDataCHROMIUM(_mappedBuffer);
_mappedBuffer = nullptr; _mappedBuffer = nullptr;
#else
CORRADE_ASSERT_UNREACHABLE();
#endif
} }
#endif #endif
#endif #endif

4
src/Magnum/Buffer.h

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

2
src/Magnum/Context.cpp

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

2
src/Magnum/Extensions.h

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

6
src/Magnum/Test/BufferGLTest.cpp

@ -50,7 +50,7 @@ struct BufferGLTest: AbstractOpenGLTester {
void data(); void data();
void map(); void map();
#ifdef MAGNUM_TARGET_GLES2 #ifdef CORRADE_TARGET_NACL
void mapSub(); void mapSub();
#endif #endif
void mapRange(); void mapRange();
@ -75,7 +75,7 @@ BufferGLTest::BufferGLTest() {
&BufferGLTest::data, &BufferGLTest::data,
&BufferGLTest::map, &BufferGLTest::map,
#ifdef MAGNUM_TARGET_GLES2 #ifdef CORRADE_TARGET_NACL
&BufferGLTest::mapSub, &BufferGLTest::mapSub,
#endif #endif
&BufferGLTest::mapRange, &BufferGLTest::mapRange,
@ -288,7 +288,7 @@ void BufferGLTest::map() {
#endif #endif
} }
#ifdef MAGNUM_TARGET_GLES2 #ifdef CORRADE_TARGET_NACL
void BufferGLTest::mapSub() { void BufferGLTest::mapSub() {
if(!Context::current()->isExtensionSupported<Extensions::GL::CHROMIUM::map_sub>()) if(!Context::current()->isExtensionSupported<Extensions::GL::CHROMIUM::map_sub>())
CORRADE_SKIP(Extensions::GL::CHROMIUM::map_sub::string() + std::string(" is not supported")); 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); return buffer.map(Buffer::MapAccess::WriteOnly);
} }
#ifdef CORRADE_TARGET_NACL
void* AbstractRenderer::bufferMapImplementationSub(Buffer& buffer, GLsizeiptr length) { void* AbstractRenderer::bufferMapImplementationSub(Buffer& buffer, GLsizeiptr length) {
return buffer.mapSub(0, length, Buffer::MapAccess::WriteOnly); return buffer.mapSub(0, length, Buffer::MapAccess::WriteOnly);
} }
@ -273,6 +274,7 @@ void AbstractRenderer::bufferUnmapImplementationSub(Buffer& buffer) {
buffer.unmapSub(); buffer.unmapSub();
} }
#endif #endif
#endif
#if !defined(MAGNUM_TARGET_GLES2) || defined(CORRADE_TARGET_EMSCRIPTEN) #if !defined(MAGNUM_TARGET_GLES2) || defined(CORRADE_TARGET_EMSCRIPTEN)
inline void* AbstractRenderer::bufferMapImplementation(Buffer& buffer, GLsizeiptr length) 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) #elif defined(MAGNUM_TARGET_GLES2) && !defined(CORRADE_TARGET_EMSCRIPTEN)
if(Context::current()->isExtensionSupported<Extensions::GL::EXT::map_buffer_range>()) { if(Context::current()->isExtensionSupported<Extensions::GL::EXT::map_buffer_range>()) {
bufferMapImplementation = &AbstractRenderer::bufferMapImplementationRange; 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; bufferMapImplementation = &AbstractRenderer::bufferMapImplementationSub;
bufferUnmapImplementation = &AbstractRenderer::bufferUnmapImplementationSub; bufferUnmapImplementation = &AbstractRenderer::bufferUnmapImplementationSub;
} else { }
#endif
else {
MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::OES::mapbuffer); MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::OES::mapbuffer);
Warning() << "Text::Renderer: neither" << Extensions::GL::EXT::map_buffer_range::string() Warning() << "Text::Renderer:" << Extensions::GL::EXT::map_buffer_range::string()
<< "nor" << Extensions::GL::CHROMIUM::map_sub::string() #ifdef CORRADE_TARGET_NACL
<< "is supported, using inefficient" << Extensions::GL::OES::mapbuffer::string() << "or" << Extensions::GL::CHROMIUM::map_sub::string()
#endif
<< "is not supported, using inefficient" << Extensions::GL::OES::mapbuffer::string()
<< "instead"; << "instead";
} }
#endif #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) #if defined(MAGNUM_TARGET_GLES2) && !defined(CORRADE_TARGET_EMSCRIPTEN)
typedef void*(*BufferMapImplementation)(Buffer&, GLsizeiptr); typedef void*(*BufferMapImplementation)(Buffer&, GLsizeiptr);
static MAGNUM_TEXT_LOCAL void* bufferMapImplementationFull(Buffer& buffer, GLsizeiptr length); static MAGNUM_TEXT_LOCAL void* bufferMapImplementationFull(Buffer& buffer, GLsizeiptr length);
#ifdef CORRADE_TARGET_NACL
static MAGNUM_TEXT_LOCAL void* bufferMapImplementationSub(Buffer& buffer, GLsizeiptr length); static MAGNUM_TEXT_LOCAL void* bufferMapImplementationSub(Buffer& buffer, GLsizeiptr length);
#endif
static MAGNUM_TEXT_LOCAL void* bufferMapImplementationRange(Buffer& buffer, GLsizeiptr length); static MAGNUM_TEXT_LOCAL void* bufferMapImplementationRange(Buffer& buffer, GLsizeiptr length);
static BufferMapImplementation bufferMapImplementation; static BufferMapImplementation bufferMapImplementation;
#else #else
@ -151,7 +153,9 @@ class MAGNUM_TEXT_EXPORT AbstractRenderer {
#if defined(MAGNUM_TARGET_GLES2) && !defined(CORRADE_TARGET_EMSCRIPTEN) #if defined(MAGNUM_TARGET_GLES2) && !defined(CORRADE_TARGET_EMSCRIPTEN)
typedef void(*BufferUnmapImplementation)(Buffer&); typedef void(*BufferUnmapImplementation)(Buffer&);
static MAGNUM_TEXT_LOCAL void bufferUnmapImplementationDefault(Buffer& buffer); static MAGNUM_TEXT_LOCAL void bufferUnmapImplementationDefault(Buffer& buffer);
#ifdef CORRADE_TARGET_NACL
static MAGNUM_TEXT_LOCAL void bufferUnmapImplementationSub(Buffer& buffer); static MAGNUM_TEXT_LOCAL void bufferUnmapImplementationSub(Buffer& buffer);
#endif
static MAGNUM_TEXT_LOCAL BufferUnmapImplementation bufferUnmapImplementation; static MAGNUM_TEXT_LOCAL BufferUnmapImplementation bufferUnmapImplementation;
#else #else
#ifndef CORRADE_TARGET_EMSCRIPTEN #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")); CORRADE_SKIP(Extensions::GL::ARB::map_buffer_range::string() + std::string(" is not supported"));
#elif defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_EMSCRIPTEN) #elif defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_EMSCRIPTEN)
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::map_buffer_range>() && if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::map_buffer_range>() &&
!Context::current()->isExtensionSupported<Extensions::GL::OES::mapbuffer>() && !Context::current()->isExtensionSupported<Extensions::GL::OES::mapbuffer>()
!Context::current()->isExtensionSupported<Extensions::GL::CHROMIUM::map_sub>()) { #ifdef CORRADE_TARGET_NACL
&& !Context::current()->isExtensionSupported<Extensions::GL::CHROMIUM::map_sub>()
#endif
) {
CORRADE_SKIP("No required extension is supported"); CORRADE_SKIP("No required extension is supported");
} }
#endif #endif

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

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

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

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

Loading…
Cancel
Save