diff --git a/CMakeLists.txt b/CMakeLists.txt
index 490f45bc3..e5f980ff2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -49,6 +49,11 @@ cmake_dependent_option(WITH_SHAPES "Build Shapes library" ON "NOT WITH_DEBUGTOOL
option(WITH_TEXT "Build Text library" ON)
cmake_dependent_option(WITH_TEXTURETOOLS "Build TextureTools library" ON "NOT WITH_TEXT;NOT WITH_DISTANCEFIELDCONVERTER" ON)
+# EGL context, available everywhere except on platforms which don't support extension loading
+if(NOT CORRADE_TARGET_EMSCRIPTEN AND NOT CORRADE_TARGET_NACL)
+ option(WITH_EGLCONTEXT "Build EglContext library" OFF)
+endif()
+
# NaCl-specific application libraries
if(CORRADE_TARGET_NACL)
option(WITH_NACLAPPLICATION "Build NaClApplication library" OFF)
@@ -61,19 +66,19 @@ elseif(CORRADE_TARGET_ANDROID)
# OS X-specific application libraries
elseif(CORRADE_TARGET_APPLE)
cmake_dependent_option(WITH_WINDOWLESSCGLAPPLICATION "Build WindowlessCglApplication library" OFF "NOT WITH_MAGNUMINFO;NOT WITH_FONTCONVERTER;NOT WITH_DISTANCEFIELDCONVERTER" ON)
- cmake_dependent_option(WITH_CGLCONTEXT "Build CglContext library" OFF "NOT TARGET_GLES" OFF)
+ option(WITH_CGLCONTEXT "Build CglContext library" OFF)
# X11 + GLX/EGL-specific application libraries
elseif(CORRADE_TARGET_UNIX)
option(WITH_GLXAPPLICATION "Build GlxApplication library" OFF)
cmake_dependent_option(WITH_WINDOWLESSGLXAPPLICATION "Build WindowlessGlxApplication library" OFF "NOT WITH_MAGNUMINFO;NOT WITH_FONTCONVERTER;NOT WITH_DISTANCEFIELDCONVERTER" ON)
cmake_dependent_option(WITH_XEGLAPPLICATION "Build XEglApplication library" OFF "TARGET_GLES" OFF)
- cmake_dependent_option(WITH_GLXCONTEXT "Build GlxContext library" OFF "NOT TARGET_GLES" OFF)
+ option(WITH_GLXCONTEXT "Build GlxContext library" OFF)
# Windows-specific application libraries
elseif(CORRADE_TARGET_WINDOWS)
cmake_dependent_option(WITH_WINDOWLESSWGLAPPLICATION "Build WindowlessWglApplication library" OFF "NOT WITH_MAGNUMINFO;NOT WITH_FONTCONVERTER;NOT WITH_DISTANCEFIELDCONVERTER" ON)
- cmake_dependent_option(WITH_WGLCONTEXT "Build WglContext library" OFF "NOT TARGET_GLES" OFF)
+ option(WITH_WGLCONTEXT "Build WglContext library" OFF)
endif()
# Platform-independent (almost) application libraries
diff --git a/Doxyfile b/Doxyfile
index 538c742ca..bbf610f7c 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -262,6 +262,7 @@ ALIASES = \
"extension{2}=\1_\2" \
"extension2{2}=\1_\2" \
"requires_gles30=@xrefitem requires-gles30 \"Requires OpenGL ES 3.0\" \"Functionality requiring OpenGL ES 3.0\"" \
+ "requires_gles31=@xrefitem requires-gles31 \"Requires OpenGL ES 3.1\" \"Functionality requiring OpenGL ES 3.1\"" \
"requires_gl=@xrefitem requires-gl \"Requires desktop OpenGL\" \"Functionality requiring desktop OpenGL (not available in OpenGL ES)\"" \
"requires_gles20=@xrefitem requires-gles20 \"Requires OpenGL ES 2.0\" \"Functionality requiring OpenGL ES 2.0 (not available in ES 3.0 and desktop OpenGL)\"" \
"requires_es_extension=@xrefitem requires-es-extension \"Requires OpenGL ES extension\" \"Functionality requiring specific OpenGL ES extension\"" \
diff --git a/README.md b/README.md
index 83e98b7be..645ecfff7 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,8 @@ Graphics APIs:
* **OpenGL** 2.1 through 4.4, core profile functionality and modern
extensions
-* **OpenGL ES** 2.0, 3.0 and extensions to match desktop OpenGL functionality
+* **OpenGL ES** 2.0, 3.0, 3.1 and extensions to match desktop OpenGL
+ functionality
* **WebGL** 1.0 and extensions to match desktop OpenGL functionality
Platforms:
diff --git a/doc/building.dox b/doc/building.dox
index 475072420..5693d73a4 100644
--- a/doc/building.dox
+++ b/doc/building.dox
@@ -210,6 +210,7 @@ choose to not use any application library (see @ref platform-custom for more
information):
- `WITH_CGLCONTEXT` -- CGL context
+- `WITH_EGLCONTEXT` -- EGL context
- `WITH_GLXCONTEXT` -- GLX context
- `WITH_WGLCONTEXT` -- WGL context
diff --git a/doc/cmake.dox b/doc/cmake.dox
index cea2328cb..46ba9862a 100644
--- a/doc/cmake.dox
+++ b/doc/cmake.dox
@@ -107,6 +107,7 @@ platform-specific context libraries (see @ref platform-custom for more
information):
- `CglContext` -- CGL context
+- `EglContext` -- EGL context
- `GlxContext` -- GLX context
- `WglContext` -- WGL context
diff --git a/doc/mainpage.dox b/doc/mainpage.dox
index 64774d72e..41f8e69f8 100644
--- a/doc/mainpage.dox
+++ b/doc/mainpage.dox
@@ -69,7 +69,8 @@ Graphics APIs:
- **OpenGL** 2.1 through 4.4, core profile functionality and modern
extensions
-- **OpenGL ES** 2.0, 3.0 and extensions to match desktop OpenGL functionality
+- **OpenGL ES** 2.0, 3.0, 3.1 and extensions to match desktop OpenGL
+ functionality
- **WebGL** 1.0 and extensions to match desktop OpenGL functionality
Platforms:
diff --git a/doc/opengl-support.dox b/doc/opengl-support.dox
index 48ce39b86..c1984a2d0 100644
--- a/doc/opengl-support.dox
+++ b/doc/opengl-support.dox
@@ -238,6 +238,11 @@ supported.
Features that have their equivalents implemented in desktop version are
supported.
+@subsection opengl-support-es31 OpenGL ES 3.1
+
+Features that have their equivalents implemented in desktop version are
+supported.
+
@subsection opengl-support-es30-extensions OpenGL ES 2.0 extensions to match ES 3.0 functionality
%Extension | Status
diff --git a/doc/opengl.dox b/doc/opengl.dox
index 3b4713e71..582ad9213 100644
--- a/doc/opengl.dox
+++ b/doc/opengl.dox
@@ -59,6 +59,7 @@ is supported on older Intel GPUs even if they are capable of OpenGL 2.1 only).
- @subpage requires-gl
- @subpage requires-gles20
- @subpage requires-gles30
+- @subpage requires-gles31
- @subpage requires-es-extension
@see @ref building, @ref cmake, @ref MAGNUM_TARGET_GLES,
@@ -82,9 +83,14 @@ is supported on older Intel GPUs even if they are capable of OpenGL 2.1 only).
@page requires-gles20 Functionality requiring OpenGL ES 2.0 (not available on desktop or ES 3.0)
@see @ref MAGNUM_TARGET_GLES2
-@page requires-gles30 Functionality requiring OpenGL ES 3.0
+@page requires-gles30 Functionality requiring at least OpenGL ES 3.0
+
+The following symbols are not defined at all when targeting OpenGL ES 2.0.
+
@see @ref MAGNUM_TARGET_GLES3
+@page requires-gles31 Functionality requiring OpenGL ES 3.1
+
@page requires-es-extension Functionality requiring specific OpenGL ES extension
@see @ref MAGNUM_TARGET_GLES2
diff --git a/doc/platform.dox b/doc/platform.dox
index e6a4199f4..b15efcf0b 100644
--- a/doc/platform.dox
+++ b/doc/platform.dox
@@ -293,6 +293,7 @@ find particular `*Context` library, add its include dir and then link to it.
These platform-specific libraries are available:
- `CglContext` -- CGL context (Mac OS X)
+- `EglContext` -- EGL context (everywhere except Emscripten and NaCl)
- `GlxContext` -- GLX context (X11-based Unix)
- `WglContext` -- WGL context (Windows)
diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake
index 66f41f4fc..3af940f32 100644
--- a/modules/FindMagnum.cmake
+++ b/modules/FindMagnum.cmake
@@ -61,6 +61,7 @@
# WindowlessNaClApplication - Windowless NaCl application
# WindowlessWglApplication - Windowless WGL application
# CglContext - CGL context
+# EglContext - EGL context
# GlxContext - GLX context
# WglContext - WGL context
# Example usage with specifying additional components is:
@@ -430,6 +431,16 @@ foreach(component ${Magnum_FIND_COMPONENTS})
endif()
endif()
+ # EGL context dependencies
+ if(${component} STREQUAL EglContext)
+ find_package(EGL)
+ if(EGL_FOUND)
+ set(_MAGNUM_${_COMPONENT}_LIBRARIES ${EGL_LIBRARIES})
+ else()
+ unset(MAGNUM_${_COMPONENT}_LIBRARY)
+ endif()
+ endif()
+
# No additional dependencies for CGL context
# No additional dependencies for WGL context
diff --git a/package/archlinux/PKGBUILD b/package/archlinux/PKGBUILD
index 6ab801bdb..5a005ec32 100644
--- a/package/archlinux/PKGBUILD
+++ b/package/archlinux/PKGBUILD
@@ -27,6 +27,7 @@ build() {
-DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \
-DWITH_WINDOWLESSGLXAPPLICATION=ON \
+ -DWITH_EGLCONTEXT=ON \
-DWITH_GLXCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_MAGNUMFONTCONVERTER=ON \
diff --git a/package/archlinux/PKGBUILD-android-arm b/package/archlinux/PKGBUILD-android-arm
index 87fc2e959..a23ee7512 100644
--- a/package/archlinux/PKGBUILD-android-arm
+++ b/package/archlinux/PKGBUILD-android-arm
@@ -32,7 +32,8 @@ build() {
-DWITH_OBJIMPORTER=ON \
-DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON \
- -DWITH_ANDROIDAPPLICATION=ON
+ -DWITH_ANDROIDAPPLICATION=ON \
+ -DWITH_EGLCONTEXT=ON
ninja
}
diff --git a/package/archlinux/PKGBUILD-android-x86 b/package/archlinux/PKGBUILD-android-x86
index 0db9c1e59..921d7bbf4 100644
--- a/package/archlinux/PKGBUILD-android-x86
+++ b/package/archlinux/PKGBUILD-android-x86
@@ -32,7 +32,8 @@ build() {
-DWITH_OBJIMPORTER=ON \
-DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON \
- -DWITH_ANDROIDAPPLICATION=ON
+ -DWITH_ANDROIDAPPLICATION=ON \
+ -DWITH_EGLCONTEXT=ON
ninja
}
diff --git a/package/archlinux/PKGBUILD-clang b/package/archlinux/PKGBUILD-clang
index d02919f0d..3882d4229 100644
--- a/package/archlinux/PKGBUILD-clang
+++ b/package/archlinux/PKGBUILD-clang
@@ -31,6 +31,7 @@ build() {
-DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \
-DWITH_WINDOWLESSGLXAPPLICATION=ON \
+ -DWITH_EGLCONTEXT=ON \
-DWITH_GLXCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_MAGNUMFONTCONVERTER=ON \
diff --git a/package/archlinux/PKGBUILD-clang-libc++ b/package/archlinux/PKGBUILD-clang-libc++
index 29fbeb1de..092789cbb 100644
--- a/package/archlinux/PKGBUILD-clang-libc++
+++ b/package/archlinux/PKGBUILD-clang-libc++
@@ -33,6 +33,7 @@ build() {
-DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \
-DWITH_WINDOWLESSGLXAPPLICATION=ON \
+ -DWITH_EGLCONTEXT=ON \
-DWITH_GLXCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_MAGNUMFONTCONVERTER=ON \
diff --git a/package/archlinux/PKGBUILD-es2 b/package/archlinux/PKGBUILD-es2
index 3cbd211ff..78fcaa57e 100644
--- a/package/archlinux/PKGBUILD-es2
+++ b/package/archlinux/PKGBUILD-es2
@@ -22,6 +22,7 @@ build() {
-DTARGET_GLES2=ON \
-DWITH_AUDIO=ON \
-DWITH_XEGLAPPLICATION=ON \
+ -DWITH_EGLCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_OBJIMPORTER=ON \
-DWITH_TGAIMAGECONVERTER=ON \
diff --git a/package/archlinux/PKGBUILD-es2desktop b/package/archlinux/PKGBUILD-es2desktop
index e44afb6ce..27d41d901 100644
--- a/package/archlinux/PKGBUILD-es2desktop
+++ b/package/archlinux/PKGBUILD-es2desktop
@@ -25,6 +25,7 @@ build() {
-DWITH_SDL2APPLICATION=ON \
-DWITH_GLXAPPLICATION=ON \
-DWITH_WINDOWLESSGLXAPPLICATION=ON \
+ -DWITH_EGLCONTEXT=ON \
-DWITH_GLXCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_OBJIMPORTER=ON \
diff --git a/package/archlinux/PKGBUILD-es3 b/package/archlinux/PKGBUILD-es3
index c13f5029f..33348f83a 100644
--- a/package/archlinux/PKGBUILD-es3
+++ b/package/archlinux/PKGBUILD-es3
@@ -22,6 +22,7 @@ build() {
-DTARGET_GLES2=OFF \
-DWITH_AUDIO=ON \
-DWITH_XEGLAPPLICATION=ON \
+ -DWITH_EGLCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_OBJIMPORTER=ON \
-DWITH_TGAIMAGECONVERTER=ON \
diff --git a/package/archlinux/PKGBUILD-es3desktop b/package/archlinux/PKGBUILD-es3desktop
index 1b896a3f4..f808cb972 100644
--- a/package/archlinux/PKGBUILD-es3desktop
+++ b/package/archlinux/PKGBUILD-es3desktop
@@ -25,6 +25,7 @@ build() {
-DWITH_SDL2APPLICATION=ON \
-DWITH_GLXAPPLICATION=ON \
-DWITH_WINDOWLESSGLXAPPLICATION=ON \
+ -DWITH_EGLCONTEXT=ON \
-DWITH_GLXCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_OBJIMPORTER=ON \
diff --git a/package/archlinux/PKGBUILD-gcc47 b/package/archlinux/PKGBUILD-gcc47
index 5311e8836..fefa175e0 100644
--- a/package/archlinux/PKGBUILD-gcc47
+++ b/package/archlinux/PKGBUILD-gcc47
@@ -31,6 +31,7 @@ build() {
-DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \
-DWITH_WINDOWLESSGLXAPPLICATION=ON \
+ -DWITH_EGLCONTEXT=ON \
-DWITH_GLXCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_MAGNUMFONTCONVERTER=ON \
diff --git a/package/archlinux/PKGBUILD-release b/package/archlinux/PKGBUILD-release
index 30a275b13..09bbdcc5a 100644
--- a/package/archlinux/PKGBUILD-release
+++ b/package/archlinux/PKGBUILD-release
@@ -23,6 +23,7 @@ build() {
-DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \
-DWITH_WINDOWLESSGLXAPPLICATION=ON \
+ -DWITH_EGLCONTEXT=ON \
-DWITH_GLXCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_MAGNUMFONTCONVERTER=ON \
diff --git a/package/ci/jenkins-android.xml b/package/ci/jenkins-android.xml
index bc64708ee..a5b1543a2 100644
--- a/package/ci/jenkins-android.xml
+++ b/package/ci/jenkins-android.xml
@@ -79,6 +79,7 @@ cmake .. \
-DBUILD_DEPRECATED=${deprecated_build_flag} \
`#-DWITH_AUDIO=ON` \
-DWITH_ANDROIDAPPLICATION=ON \
+ -DWITH_EGLCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_MAGNUMFONTCONVERTER=ON \
-DWITH_OBJIMPORTER=ON \
diff --git a/package/ci/jenkins.xml b/package/ci/jenkins.xml
index d5cf17832..b7878e11c 100644
--- a/package/ci/jenkins.xml
+++ b/package/ci/jenkins.xml
@@ -143,6 +143,7 @@ cmake .. \
-DWITH_GLXAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \
-DWITH_XEGLAPPLICATION=${es_flag} \
+ -DWITH_EGLCONTEXT=ON \
-DWITH_GLXCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_MAGNUMFONTCONVERTER=${desktop_flag} \
diff --git a/package/debian/rules b/package/debian/rules
index c26b9613d..9752ff134 100755
--- a/package/debian/rules
+++ b/package/debian/rules
@@ -9,6 +9,7 @@ override_dh_auto_configure:
-DWITH_GLUTAPPLICATION=ON \
-DWITH_GLXAPPLICATION=ON \
-DWITH_WINDOWLESSGLXAPPLICATION=ON \
+ -DWITH_EGLCONTEXT=ON \
-DWITH_GLXCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_MAGNUMFONTCONVERTER=ON \
diff --git a/src/Magnum/AbstractFramebuffer.cpp b/src/Magnum/AbstractFramebuffer.cpp
index b57f6597a..f205c4f2d 100644
--- a/src/Magnum/AbstractFramebuffer.cpp
+++ b/src/Magnum/AbstractFramebuffer.cpp
@@ -140,16 +140,28 @@ void AbstractFramebuffer::blit(AbstractFramebuffer& source, AbstractFramebuffer&
}
#ifdef MAGNUM_TARGET_GLES2
-void AbstractFramebuffer::blitImplementationANGLE(const Range2Di&, const Range2Di&, FramebufferBlitMask, FramebufferBlitFilter) {
- /** @todo Re-enable when extension loader is available for ES */
- CORRADE_INTERNAL_ASSERT(false);
- //glBlitFramebufferANGLE(sourceRectangle.left(), sourceRectangle.bottom(), sourceRectangle.right(), sourceRectangle.top(), destinationRectangle.left(), destinationRectangle.bottom(), destinationRectangle.right(), destinationRectangle.top(), GLbitfield(mask), GLenum(filter));
+void AbstractFramebuffer::blitImplementationANGLE(const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, const FramebufferBlitMask mask, const FramebufferBlitFilter filter) {
+ #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glBlitFramebufferANGLE(sourceRectangle.left(), sourceRectangle.bottom(), sourceRectangle.right(), sourceRectangle.top(), destinationRectangle.left(), destinationRectangle.bottom(), destinationRectangle.right(), destinationRectangle.top(), GLbitfield(mask), GLenum(filter));
+ #else
+ static_cast(sourceRectangle);
+ static_cast(destinationRectangle);
+ static_cast(mask);
+ static_cast(filter);
+ CORRADE_ASSERT_UNREACHABLE();
+ #endif
}
-void AbstractFramebuffer::blitImplementationNV(const Range2Di&, const Range2Di&, FramebufferBlitMask, FramebufferBlitFilter) {
- /** @todo Re-enable when extension loader is available for ES */
- CORRADE_INTERNAL_ASSERT(false);
- //glBlitFramebufferNV(sourceRectangle.left(), sourceRectangle.bottom(), sourceRectangle.right(), sourceRectangle.top(), destinationRectangle.left(), destinationRectangle.bottom(), destinationRectangle.right(), destinationRectangle.top(), GLbitfield(mask), GLenum(filter));
+void AbstractFramebuffer::blitImplementationNV(const Range2Di& sourceRectangle, const Range2Di& destinationRectangle, const FramebufferBlitMask mask, const FramebufferBlitFilter filter) {
+ #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glBlitFramebufferNV(sourceRectangle.left(), sourceRectangle.bottom(), sourceRectangle.right(), sourceRectangle.top(), destinationRectangle.left(), destinationRectangle.bottom(), destinationRectangle.right(), destinationRectangle.top(), GLbitfield(mask), GLenum(filter));
+ #else
+ static_cast(sourceRectangle);
+ static_cast(destinationRectangle);
+ static_cast(mask);
+ static_cast(filter);
+ CORRADE_ASSERT_UNREACHABLE();
+ #endif
}
#endif
@@ -218,14 +230,14 @@ void AbstractFramebuffer::read(const Vector2i& offset, const Vector2i& size, Buf
void AbstractFramebuffer::invalidateImplementationNoOp(GLsizei, const GLenum* const) {}
void AbstractFramebuffer::invalidateImplementationDefault(const GLsizei count, const GLenum* const attachments) {
- /** @todo Re-enable when extension loader is available for ES */
#ifndef MAGNUM_TARGET_GLES2
glInvalidateFramebuffer(GLenum(bindInternal()), count, attachments);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glDiscardFramebufferEXT(GLenum(bindInternal()), count, attachments);
#else
static_cast(count);
static_cast(attachments);
- CORRADE_INTERNAL_ASSERT(false);
- //glDiscardFramebufferEXT(GLenum(bindInternal()), count, attachments);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -249,17 +261,20 @@ GLenum AbstractFramebuffer::checkStatusImplementationDSA(const FramebufferTarget
#endif
void AbstractFramebuffer::drawBuffersImplementationDefault(GLsizei count, const GLenum* buffers) {
- /** @todo Re-enable when extension loader is available for ES */
- #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES2
bindInternal(FramebufferTarget::Draw);
#else
- bindInternal(drawTarget);
+ bindInternal(Context::current()->state().framebuffer->drawTarget);
#endif
+
+ #ifndef MAGNUM_TARGET_GLES2
glDrawBuffers(count, buffers);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glDrawBuffersNV(count, buffers);
#else
static_cast(count);
static_cast(buffers);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -270,22 +285,21 @@ void AbstractFramebuffer::drawBuffersImplementationDSA(GLsizei count, const GLen
#endif
void AbstractFramebuffer::drawBufferImplementationDefault(GLenum buffer) {
- /** @todo Re-enable when extension loader is available for ES */
- #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES2
bindInternal(FramebufferTarget::Draw);
#else
- bindInternal(drawTarget);
+ bindInternal(Context::current()->state().framebuffer->drawTarget);
#endif
- #ifndef MAGNUM_TARGET_GLES3
+
+ #ifndef MAGNUM_TARGET_GLES
glDrawBuffer(buffer);
- #else
+ #elif !defined(MAGNUM_TARGET_GLES2)
glDrawBuffers(1, &buffer);
- #endif
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glDrawBuffersNV(1, &buffer);
#else
static_cast(buffer);
- CORRADE_INTERNAL_ASSERT(false);
- //glDrawBuffersNV(1, &buffer);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -296,18 +310,19 @@ void AbstractFramebuffer::drawBufferImplementationDSA(GLenum buffer) {
#endif
void AbstractFramebuffer::readBufferImplementationDefault(GLenum buffer) {
- /** @todo Re-enable when extension loader is available for ES */
- #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES2
bindInternal(FramebufferTarget::Read);
#else
- bindInternal(readTarget);
+ bindInternal(Context::current()->state().framebuffer->readTarget);
#endif
+
+ #ifndef MAGNUM_TARGET_GLES2
glReadBuffer(buffer);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glReadBufferNV(buffer);
#else
static_cast(buffer);
- CORRADE_INTERNAL_ASSERT(false);
- //glReadBufferNV(buffer);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -322,9 +337,10 @@ void AbstractFramebuffer::readImplementationDefault(const Vector2i& offset, cons
}
void AbstractFramebuffer::readImplementationRobustness(const Vector2i& offset, const Vector2i& size, const ColorFormat format, const ColorType type, const std::size_t dataSize, GLvoid* const data) {
- /** @todo Re-enable when extension loader is available for ES */
#ifndef MAGNUM_TARGET_GLES
glReadnPixelsARB(offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), dataSize, data);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glReadnPixelsEXT(offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), dataSize, data);
#else
static_cast(offset);
static_cast(size);
@@ -332,8 +348,7 @@ void AbstractFramebuffer::readImplementationRobustness(const Vector2i& offset, c
static_cast(type);
static_cast(dataSize);
static_cast(data);
- CORRADE_INTERNAL_ASSERT(false);
- //glReadnPixelsEXT(offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), data);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
diff --git a/src/Magnum/AbstractObject.cpp b/src/Magnum/AbstractObject.cpp
index 0b07d3c8f..e59038394 100644
--- a/src/Magnum/AbstractObject.cpp
+++ b/src/Magnum/AbstractObject.cpp
@@ -36,6 +36,7 @@
namespace Magnum {
+#if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
namespace {
inline GLenum extTypeFromKhrIdentifier(GLenum khrIdentifier) {
switch(khrIdentifier) {
@@ -106,6 +107,7 @@ namespace {
CORRADE_ASSERT_UNREACHABLE();
}
}
+#endif
Int AbstractObject::maxLabelLength() {
if(!Context::current()->isExtensionSupported())
@@ -127,28 +129,27 @@ Int AbstractObject::maxLabelLength() {
void AbstractObject::labelImplementationNoOp(GLenum, GLuint, Containers::ArrayReference) {}
void AbstractObject::labelImplementationKhr(const GLenum identifier, const GLuint name, const Containers::ArrayReference label) {
- /** @todo Re-enable when extension loader is available for ES */
#ifndef MAGNUM_TARGET_GLES
glObjectLabel(identifier, name, label.size(), label);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glObjectLabelKHR(identifier, name, label.size(), label);
#else
static_cast(identifier);
static_cast(name);
static_cast(label);
- CORRADE_INTERNAL_ASSERT(false);
- //glObjectLabelKHR(identifier, name, label.size(), label);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
void AbstractObject::labelImplementationExt(const GLenum identifier, const GLuint name, const Containers::ArrayReference label) {
+ #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
const GLenum type = extTypeFromKhrIdentifier(identifier);
- /** @todo Re-enable when extension loader is available for ES */
- #ifndef MAGNUM_TARGET_GLES
glLabelObjectEXT(type, name, label.size(), label);
#else
- static_cast(type);
+ static_cast(identifier);
static_cast(name);
static_cast(label);
- CORRADE_INTERNAL_ASSERT(false);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -157,24 +158,25 @@ std::string AbstractObject::getLabelImplementationNoOp(GLenum, GLuint) { return
std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, const GLuint name) {
/* Get label size (w/o null terminator) */
GLsizei size;
- /** @todo Re-enable when extension loader is available for ES */
#ifndef MAGNUM_TARGET_GLES
glGetObjectLabel(identifier, name, 0, &size, nullptr);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glGetObjectLabelKHR(identifier, name, 0, &size, nullptr);
#else
static_cast(identifier);
static_cast(name);
- CORRADE_INTERNAL_ASSERT(false);
- //glGetObjectLabelKHR(identifier, name, 0, &size, nullptr);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
/* Make place also for the null terminator */
std::string label;
label.resize(size+1);
- /** @todo Re-enable when extension loader is available for ES */
#ifndef MAGNUM_TARGET_GLES
glGetObjectLabel(identifier, name, size+1, nullptr, &label[0]);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glGetObjectLabelKHR(identifier, name, size+1, nullptr, &label[0]);
#else
- //glGetObjectLabelKHR(identifier, name, size+1, nullptr, &label[0]);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
/* Pop null terminator and return the string */
@@ -183,25 +185,25 @@ std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, c
}
std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, const GLuint name) {
- const GLenum type = extTypeFromKhrIdentifier(identifier);
+ GLsizei size;
/* Get label size (w/o null terminator) */
- GLsizei size;
- /** @todo Re-enable when extension loader is available for ES */
- #ifndef MAGNUM_TARGET_GLES
+ #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ const GLenum type = extTypeFromKhrIdentifier(identifier);
glGetObjectLabelEXT(type, name, 0, &size, nullptr);
#else
- static_cast(type);
+ static_cast(identifier);
static_cast(name);
- CORRADE_INTERNAL_ASSERT(false);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
/* Make place also for the null terminator */
std::string label;
label.resize(size+1);
- /** @todo Re-enable when extension loader is available for ES */
- #ifndef MAGNUM_TARGET_GLES
+ #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
glGetObjectLabelEXT(identifier, name, size+1, nullptr, &label[0]);
+ #else
+ CORRADE_ASSERT_UNREACHABLE();
#endif
/* Pop null terminator and return the string */
diff --git a/src/Magnum/AbstractShaderProgram.cpp b/src/Magnum/AbstractShaderProgram.cpp
index 064af490d..7f36d74ac 100644
--- a/src/Magnum/AbstractShaderProgram.cpp
+++ b/src/Magnum/AbstractShaderProgram.cpp
@@ -52,9 +52,13 @@ Int AbstractShaderProgram::maxVertexAttributes() {
return value;
}
-#ifndef MAGNUM_TARGET_GLES
+#ifndef MAGNUM_TARGET_GLES2
Int AbstractShaderProgram::maxAtomicCounterBufferSize() {
+ #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported())
+ #else
+ if(!Context::current()->isVersionSupported(Version::GLES310))
+ #endif
return 0;
GLint& value = Context::current()->state().shaderProgram->maxAtomicCounterBufferSize;
@@ -66,7 +70,11 @@ Int AbstractShaderProgram::maxAtomicCounterBufferSize() {
}
Int AbstractShaderProgram::maxComputeSharedMemorySize() {
+ #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported())
+ #else
+ if(!Context::current()->isVersionSupported(Version::GLES310))
+ #endif
return 0;
GLint& value = Context::current()->state().shaderProgram->maxComputeSharedMemorySize;
@@ -78,7 +86,11 @@ Int AbstractShaderProgram::maxComputeSharedMemorySize() {
}
Int AbstractShaderProgram::maxComputeWorkGroupInvocations() {
+ #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported())
+ #else
+ if(!Context::current()->isVersionSupported(Version::GLES310))
+ #endif
return 0;
GLint& value = Context::current()->state().shaderProgram->maxComputeWorkGroupInvocations;
@@ -90,7 +102,11 @@ Int AbstractShaderProgram::maxComputeWorkGroupInvocations() {
}
Int AbstractShaderProgram::maxImageUnits() {
+ #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported())
+ #else
+ if(!Context::current()->isVersionSupported(Version::GLES310))
+ #endif
return 0;
GLint& value = Context::current()->state().shaderProgram->maxImageUnits;
@@ -100,7 +116,9 @@ Int AbstractShaderProgram::maxImageUnits() {
return value;
}
+#endif
+#ifndef MAGNUM_TARGET_GLES
Int AbstractShaderProgram::maxImageSamples() {
if(!Context::current()->isExtensionSupported())
return 0;
@@ -112,9 +130,15 @@ Int AbstractShaderProgram::maxImageSamples() {
return value;
}
+#endif
+#ifndef MAGNUM_TARGET_GLES2
Int AbstractShaderProgram::maxCombinedShaderOutputResources() {
+ #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported() || !Context::current()->isExtensionSupported())
+ #else
+ if(!Context::current()->isVersionSupported(Version::GLES310))
+ #endif
return 0;
GLint& value = Context::current()->state().shaderProgram->maxCombinedShaderOutputResources;
@@ -126,7 +150,11 @@ Int AbstractShaderProgram::maxCombinedShaderOutputResources() {
}
Long AbstractShaderProgram::maxShaderStorageBlockSize() {
+ #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported())
+ #else
+ if(!Context::current()->isVersionSupported(Version::GLES310))
+ #endif
return 0;
GLint64& value = Context::current()->state().shaderProgram->maxShaderStorageBlockSize;
@@ -154,9 +182,13 @@ Int AbstractShaderProgram::maxUniformBlockSize() {
}
#endif
-#ifndef MAGNUM_TARGET_GLES
+#ifndef MAGNUM_TARGET_GLES2
Int AbstractShaderProgram::maxUniformLocations() {
+ #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported())
+ #else
+ if(!Context::current()->isVersionSupported(Version::GLES310))
+ #endif
return 0;
GLint& value = Context::current()->state().shaderProgram->maxUniformLocations;
@@ -376,15 +408,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const GLfloat* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniform1fv(_id, location, count, values);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniform1fvEXT(_id, location, count, values);
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniform1fvEXT(_id, location, count, values);
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -404,15 +436,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<2, GLfloat>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniform2fv(_id, location, count, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniform2fvEXT(_id, location, count, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniform2fvEXT(_id, location, count, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -432,15 +464,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<3, GLfloat>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniform3fv(_id, location, count, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniform3fvEXT(_id, location, count, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniform3fvEXT(_id, location, count, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -460,15 +492,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<4, GLfloat>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniform4fv(_id, location, count, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniform4fvEXT(_id, location, count, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniform4fvEXT(_id, location, count, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -488,15 +520,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const GLint* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniform1iv(_id, location, count, values);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniform1ivEXT(_id, location, count, values);
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniform1ivEXT(_id, location, count, values);
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -516,15 +548,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<2, GLint>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniform2iv(_id, location, count, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniform2ivEXT(_id, location, count, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniform2ivEXT(_id, location, count, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -544,15 +576,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<3, GLint>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniform3iv(_id, location, count, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniform3ivEXT(_id, location, count, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniform3ivEXT(_id, location, count, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -572,15 +604,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<4, GLint>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniform4iv(_id, location, count, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniform4ivEXT(_id, location, count, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniform4ivEXT(_id, location, count, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -601,15 +633,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const GLuint* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniform1uiv(_id, location, count, values);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniform1uivEXT(_id, location, count, values);
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniform1uivEXT(_id, location, count, values);
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -629,15 +661,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<2, GLuint>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniform2uiv(_id, location, count, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniform2uivEXT(_id, location, count, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniform2uivEXT(_id, location, count, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -657,15 +689,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<3, GLuint>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniform3uiv(_id, location, count, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniform3uivEXT(_id, location, count, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniform3uivEXT(_id, location, count, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -685,15 +717,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::Vector<4, GLuint>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniform4uiv(_id, location, count, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniform4uivEXT(_id, location, count, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniform4uivEXT(_id, location, count, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -784,15 +816,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 2, GLfloat>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniformMatrix2fv(_id, location, count, GL_FALSE, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniformMatrix2fvEXT(_id, location, count, GL_FALSE, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniformMatrix2fvEXT(_id, location, count, GL_FALSE, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -812,15 +844,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 3, GLfloat>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniformMatrix3fv(_id, location, count, GL_FALSE, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniformMatrix3fvEXT(_id, location, count, GL_FALSE, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniformMatrix3fvEXT(_id, location, count, GL_FALSE, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -840,15 +872,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 4, GLfloat>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniformMatrix4fv(_id, location, count, GL_FALSE, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniformMatrix4fvEXT(_id, location, count, GL_FALSE, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniformMatrix4fvEXT(_id, location, count, GL_FALSE, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -869,15 +901,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 3, GLfloat>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniformMatrix2x3fv(_id, location, count, GL_FALSE, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniformMatrix2x3fvEXT(_id, location, count, GL_FALSE, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniformMatrix2x3fvEXT(_id, location, count, GL_FALSE, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -897,15 +929,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 2, GLfloat>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniformMatrix3x2fv(_id, location, count, GL_FALSE, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniformMatrix3x2fv(_id, location, count, GL_FALSE, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniformMatrix3x2fv(_id, location, count, GL_FALSE, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -925,15 +957,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<2, 4, GLfloat>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniformMatrix2x4fv(_id, location, count, GL_FALSE, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniformMatrix2x4fvEXT(_id, location, count, GL_FALSE, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniformMatrix2x4fvEXT(_id, location, count, GL_FALSE, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -953,15 +985,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 2, GLfloat>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniformMatrix4x2fv(_id, location, count, GL_FALSE, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniformMatrix4x2fvEXT(_id, location, count, GL_FALSE, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniformMatrix4x2fvEXT(_id, location, count, GL_FALSE, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -981,15 +1013,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<3, 4, GLfloat>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniformMatrix3x4fv(_id, location, count, GL_FALSE, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniformMatrix3x4fvEXT(_id, location, count, GL_FALSE, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniformMatrix3x4fvEXT(_id, location, count, GL_FALSE, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -1009,15 +1041,15 @@ void AbstractShaderProgram::uniformImplementationDefault(const GLint location, c
}
void AbstractShaderProgram::uniformImplementationSSO(const GLint location, const GLsizei count, const Math::RectangularMatrix<4, 3, GLfloat>* const values) {
- /** @todo Enable when extension loader for ES is available */
#ifndef MAGNUM_TARGET_GLES
glProgramUniformMatrix4x3fv(_id, location, count, GL_FALSE, values[0].data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glProgramUniformMatrix4x3fvEXT(_id, location, count, GL_FALSE, values[0].data());
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glProgramUniformMatrix4x3fvEXT(_id, location, count, GL_FALSE, values[0].data());
static_cast(location);
static_cast(count);
static_cast(values);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
diff --git a/src/Magnum/AbstractShaderProgram.h b/src/Magnum/AbstractShaderProgram.h
index b77b46cbc..74c8e31a1 100644
--- a/src/Magnum/AbstractShaderProgram.h
+++ b/src/Magnum/AbstractShaderProgram.h
@@ -219,8 +219,8 @@ Int normalMatrixUniform = uniformLocation("normalMatrix");
@requires_gl43 %Extension @extension{ARB,explicit_uniform_location} for
explicit uniform location instead of using
@ref Magnum::AbstractShaderProgram::uniformLocation() "uniformLocation()".
-@requires_gl Explicit uniform location is not supported in OpenGL ES. Use
- @ref Magnum::AbstractShaderProgram::uniformLocation() "uniformLocation()"
+@requires_gles31 Explicit uniform location is not supported in OpenGL ES 3.0
+ and older. Use @ref Magnum::AbstractShaderProgram::uniformLocation() "uniformLocation()"
instead.
@anchor AbstractShaderProgram-texture-units
@@ -252,8 +252,8 @@ setUniform(uniformLocation("specularTexture"), 1);
@requires_gl42 %Extension @extension{ARB,shading_language_420pack} for explicit
texture binding unit instead of using
@ref Magnum::AbstractShaderProgram::setUniform(Int, const T&) "setUniform(Int, Int)".
-@requires_gl Explicit texture binding unit is not supported in OpenGL ES. Use
- @ref Magnum::AbstractShaderProgram::setUniform(Int, const T&) "setUniform(Int, Int)"
+@requires_gles31 Explicit texture binding unit is not supported in OpenGL ES
+ 3.0 and older. Use @ref Magnum::AbstractShaderProgram::setUniform(Int, const T&) "setUniform(Int, Int)"
instead.
@anchor AbstractShaderProgram-rendering-workflow
@@ -352,15 +352,15 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
*/
static Int maxVertexAttributes();
- #ifndef MAGNUM_TARGET_GLES
+ #ifndef MAGNUM_TARGET_GLES2
/**
* @brief Max supported atomic counter buffer size
*
* The result is cached, repeated queries don't result in repeated
- * OpenGL calls. If extension @extension{ARB,shader_atomic_counters} is
- * not available, returns `0`.
+ * OpenGL calls. If neither extension @extension{ARB,shader_atomic_counters}
+ * (part of OpenGL 4.2) nor OpenGL ES 3.1 is available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_ATOMIC_COUNTER_BUFFER_SIZE}
- * @requires_gl Atomic counters are not available in OpenGL ES.
+ * @requires_gles30 Not defined in OpenGL ES 2.0
*/
static Int maxAtomicCounterBufferSize();
@@ -368,10 +368,10 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
* @brief Max supported compute shared memory size
*
* The result is cached, repeated queries don't result in repeated
- * OpenGL calls. If extension @extension{ARB,compute_shader} is not
- * available, returns `0`.
+ * OpenGL calls. If neither extension @extension{ARB,compute_shader}
+ * (part of OpenGL 4.3) nor OpenGL ES 3.1 is available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_COMPUTE_SHARED_MEMORY_SIZE}
- * @requires_gl Compute shaders are not available in OpenGL ES.
+ * @requires_gles30 Not defined in OpenGL ES 2.0
*/
static Int maxComputeSharedMemorySize();
@@ -379,10 +379,10 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
* @brief Max supported compute work group invocation count
*
* The result is cached, repeated queries don't result in repeated
- * OpenGL calls. If extension @extension{ARB,compute_shader} is not
- * available, returns `0`.
+ * OpenGL calls. If neither extension @extension{ARB,compute_shader}
+ * (part of OpenGL 4.3) nor OpenGL ES 3.1 is available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_COMPUTE_WORK_GROUP_INVOCATIONS}
- * @requires_gl Compute shaders are not available in OpenGL ES.
+ * @requires_gles30 Not defined in OpenGL ES 2.0
*/
static Int maxComputeWorkGroupInvocations();
@@ -393,32 +393,37 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
*
* The result is cached, repeated queries don't result in repeated
* OpenGL calls. If extension @extension{ARB,shader_image_load_store}
- * is not available, returns `0`.
+ * (part of OpenGL 4.2) or OpenGL ES 3.1 is not available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_IMAGE_UNITS}
- * @requires_gl %Image load/store is not available in OpenGL ES.
+ * @requires_gles30 Not defined in OpenGL ES 2.0
*/
static Int maxImageUnits();
+ #endif
+ #ifndef MAGNUM_TARGET_GLES
/**
* @brief Max supported image sample count
*
* The result is cached, repeated queries don't result in repeated
* OpenGL calls. If extension @extension{ARB,shader_image_load_store}
- * is not available, returns `0`.
+ * (part of OpenGL 4.2) is not available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_IMAGE_SAMPLES}
- * @requires_gl %Image load/store is not available in OpenGL ES.
+ * @requires_gl Multisample image load/store is not available in OpenGL
+ * ES.
*/
static Int maxImageSamples();
+ #endif
+ #ifndef MAGNUM_TARGET_GLES2
/**
* @brief Max supported combined shader output resource count
*
* The result is cached, repeated queries don't result in repeated
- * OpenGL calls. If neither @extension{ARB,shader_image_load_store}
- * nor @extension{ARB,shader_storage_buffer_object} extension is
- * available, returns `0`.
+ * OpenGL calls. If neither extension @extension{ARB,shader_image_load_store}
+ * (part of OpenGL 4.2) nor extension @extension{ARB,shader_storage_buffer_object}
+ * (part of OpenGL 4.3) nor OpenGL ES 3.1 is available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_COMBINED_SHADER_OUTPUT_RESOURCES}
- * @requires_gl %Image load/store is not available in OpenGL ES.
+ * @requires_gles30 Not defined in OpenGL ES 2.0
*/
static Int maxCombinedShaderOutputResources();
@@ -426,50 +431,44 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
* @brief Max supported shader storage block size
*
* The result is cached, repeated queries don't result in repeated
- * OpenGL calls. If extension @extension{ARB,shader_storage_buffer_object}
- * is not available, returns `0`.
+ * OpenGL calls. If neither extension @extension{ARB,shader_storage_buffer_object}
+ * (part of OpenGL 4.3) nor OpenGL ES 3.1 is available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_SHADER_STORAGE_BLOCK_SIZE}
- * @requires_gl %Shader storage is not available in OpenGL ES.
+ * @requires_gles30 Not defined in OpenGL ES 2.0
*/
static Long maxShaderStorageBlockSize();
- #endif
- #ifndef MAGNUM_TARGET_GLES2
/**
* @brief Max supported uniform block size
*
* The result is cached, repeated queries don't result in repeated
* OpenGL calls. If extension @extension{ARB,uniform_buffer_object}
- * is not available, returns `0`.
+ * (part of OpenGL 3.1) is not available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_UNIFORM_BLOCK_SIZE}
- * @requires_gles30 Uniform blocks are not available in OpenGL ES 2.0.
+ * @requires_gles30 Uniform blocks are not available in OpenGL ES 2.0
*/
static Int maxUniformBlockSize();
- #endif
- #ifndef MAGNUM_TARGET_GLES
/**
* @brief Max supported explicit uniform location count
*
* The result is cached, repeated queries don't result in repeated
- * OpenGL calls. If extension @extension{ARB,explicit_uniform_location}
- * is not available, returns `0`.
+ * OpenGL calls. If neither extension @extension{ARB,explicit_uniform_location}
+ * (part of OpenGL 4.3) nor OpenGL ES 3.1 is available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_UNIFORM_LOCATIONS}
- * @requires_gl Explicit uniform location is not supported in OpenGL ES.
+ * @requires_gles30 Not defined in OpenGL ES 2.0
*/
static Int maxUniformLocations();
- #endif
- #ifndef MAGNUM_TARGET_GLES2
/**
* @brief Min supported program texel offset
*
* The result is cached, repeated queries don't result in repeated
- * OpenGL calls. If extension @extension{EXT,gpu_shader4} is not
- * available, returns `0`.
+ * OpenGL calls. If extension @extension{EXT,gpu_shader4} (part of
+ * OpenGL 3.0) is not available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MIN_PROGRAM_TEXEL_OFFSET}
* @requires_gles30 %Texture lookup with offset is not available in
- * OpenGL ES 2.0.
+ * OpenGL ES 2.0
*/
static Int minTexelOffset();
@@ -477,11 +476,11 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
* @brief Max supported program texel offset
*
* The result is cached, repeated queries don't result in repeated
- * OpenGL calls. If extension @extension{EXT,gpu_shader4} is not
- * available, returns `0`.
+ * OpenGL calls. If extension @extension{EXT,gpu_shader4} (part of
+ * OpenGL 3.0) is not available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_PROGRAM_TEXEL_OFFSET}
* @requires_gles30 %Texture lookup with offset is not available in
- * OpenGL ES 2.0.
+ * OpenGL ES 2.0
*/
static Int maxTexelOffset();
#endif
diff --git a/src/Magnum/AbstractTexture.cpp b/src/Magnum/AbstractTexture.cpp
index 5f4069bb2..480dc7959 100644
--- a/src/Magnum/AbstractTexture.cpp
+++ b/src/Magnum/AbstractTexture.cpp
@@ -62,9 +62,13 @@ Float AbstractTexture::maxLodBias() {
}
#endif
-#ifndef MAGNUM_TARGET_GLES
+#ifndef MAGNUM_TARGET_GLES2
Int AbstractTexture::maxColorSamples() {
+ #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported())
+ #else
+ if(!Context::current()->isVersionSupported(Version::GLES310))
+ #endif
return 0;
GLint& value = Context::current()->state().texture->maxColorSamples;
@@ -77,7 +81,11 @@ Int AbstractTexture::maxColorSamples() {
}
Int AbstractTexture::maxDepthSamples() {
+ #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported())
+ #else
+ if(!Context::current()->isVersionSupported(Version::GLES310))
+ #endif
return 0;
GLint& value = Context::current()->state().texture->maxDepthSamples;
@@ -90,7 +98,11 @@ Int AbstractTexture::maxDepthSamples() {
}
Int AbstractTexture::maxIntegerSamples() {
+ #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported())
+ #else
+ if(!Context::current()->isVersionSupported(Version::GLES310))
+ #endif
return 0;
GLint& value = Context::current()->state().texture->maxIntegerSamples;
@@ -327,7 +339,7 @@ void AbstractTexture::setCompareFunction(const Sampler::CompareFunction function
, GLenum(function));
}
-#ifndef MAGNUM_TARGET_GLES
+#ifndef MAGNUM_TARGET_GLES2
void AbstractTexture::setDepthStencilMode(const Sampler::DepthStencilMode mode) {
(this->*Context::current()->state().texture->parameteriImplementation)(GL_DEPTH_STENCIL_TEXTURE_MODE, GLenum(mode));
}
@@ -818,16 +830,18 @@ void AbstractTexture::setMaxAnisotropyImplementationExt(GLfloat anisotropy) {
(this->*Context::current()->state().texture->parameterfImplementation)(GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy);
}
-#ifndef MAGNUM_TARGET_GLES
+#ifndef MAGNUM_TARGET_GLES2
void AbstractTexture::getLevelParameterImplementationDefault(GLenum target, GLint level, GLenum parameter, GLint* values) {
bindInternal();
glGetTexLevelParameteriv(target, level, parameter, values);
}
+#ifndef MAGNUM_TARGET_GLES
void AbstractTexture::getLevelParameterImplementationDSA(GLenum target, GLint level, GLenum parameter, GLint* values) {
glGetTextureLevelParameterivEXT(_id, target, level, parameter, values);
}
#endif
+#endif
#ifndef MAGNUM_TARGET_GLES
void AbstractTexture::storageImplementationFallback(const GLenum target, const GLsizei levels, const TextureFormat internalFormat, const Math::Vector<1, GLsizei>& size) {
@@ -895,16 +909,16 @@ void AbstractTexture::storageImplementationFallback(const GLenum target, const G
void AbstractTexture::storageImplementationDefault(GLenum target, GLsizei levels, TextureFormat internalFormat, const Vector2i& size) {
bindInternal();
- /** @todo Re-enable when extension loader is available for ES */
#ifndef MAGNUM_TARGET_GLES2
glTexStorage2D(target, levels, GLenum(internalFormat), size.x(), size.y());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glTexStorage2DEXT(target, levels, GLenum(internalFormat), size.x(), size.y());
#else
static_cast(target);
static_cast(levels);
static_cast(internalFormat);
static_cast(size);
- CORRADE_INTERNAL_ASSERT(false);
- //glTexStorage2DEXT(target, levels, GLenum(internalFormat), size.x(), size.y());
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -949,16 +963,16 @@ void AbstractTexture::storageImplementationFallback(GLenum target, GLsizei level
void AbstractTexture::storageImplementationDefault(GLenum target, GLsizei levels, TextureFormat internalFormat, const Vector3i& size) {
bindInternal();
- /** @todo Re-enable when extension loader is available for ES */
#ifndef MAGNUM_TARGET_GLES2
glTexStorage3D(target, levels, GLenum(internalFormat), size.x(), size.y(), size.z());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glTexStorage3DEXT(target, levels, GLenum(internalFormat), size.x(), size.y(), size.z());
#else
static_cast(target);
static_cast(levels);
static_cast(internalFormat);
static_cast(size);
- CORRADE_INTERNAL_ASSERT(false);
- //glTexStorage3DEXT(target, levels, GLenum(internalFormat), size.x(), size.y(), size.z());
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -973,12 +987,16 @@ void AbstractTexture::storageMultisampleImplementationFallback(const GLenum targ
bindInternal();
glTexImage2DMultisample(target, samples, GLenum(internalFormat), size.x(), size.y(), fixedSampleLocations);
}
+#endif
+#ifndef MAGNUM_TARGET_GLES2
void AbstractTexture::storageMultisampleImplementationDefault(const GLenum target, const GLsizei samples, const TextureFormat internalFormat, const Vector2i& size, const GLboolean fixedSampleLocations) {
bindInternal();
glTexStorage2DMultisample(target, samples, GLenum(internalFormat), size.x(), size.y(), fixedSampleLocations);
}
+#endif
+#ifndef MAGNUM_TARGET_GLES
void AbstractTexture::storageMultisampleImplementationDSA(const GLenum target, const GLsizei samples, const TextureFormat internalFormat, const Vector2i& size, const GLboolean fixedSampleLocations) {
glTextureStorage2DMultisampleEXT(_id, target, samples, GLenum(internalFormat), size.x(), size.y(), fixedSampleLocations);
}
@@ -1038,9 +1056,10 @@ void AbstractTexture::imageImplementationDSA(GLenum target, GLint level, Texture
void AbstractTexture::imageImplementationDefault(GLenum target, GLint level, TextureFormat internalFormat, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data) {
bindInternal();
- /** @todo Re-enable when extension loader is available for ES */
#ifndef MAGNUM_TARGET_GLES2
glTexImage3D(target, level, GLint(internalFormat), size.x(), size.y(), size.z(), 0, GLenum(format), GLenum(type), data);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glTexImage3DOES(target, level, GLint(internalFormat), size.x(), size.y(), size.z(), 0, GLenum(format), GLenum(type), data);
#else
static_cast(target);
static_cast(level);
@@ -1049,8 +1068,7 @@ void AbstractTexture::imageImplementationDefault(GLenum target, GLint level, Tex
static_cast(format);
static_cast(type);
static_cast(data);
- CORRADE_INTERNAL_ASSERT(false);
- //glTexImage3DOES(target, level, GLint(internalFormat), size.x(), size.y(), size.z(), 0, GLenum(format), GLenum(type), data);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -1084,9 +1102,10 @@ void AbstractTexture::subImageImplementationDSA(GLenum target, GLint level, cons
void AbstractTexture::subImageImplementationDefault(GLenum target, GLint level, const Vector3i& offset, const Vector3i& size, ColorFormat format, ColorType type, const GLvoid* data) {
bindInternal();
- /** @todo Re-enable when extension loader is available for ES */
#ifndef MAGNUM_TARGET_GLES2
glTexSubImage3D(target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), GLenum(type), data);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glTexSubImage3DOES(target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), GLenum(type), data);
#else
static_cast(target);
static_cast(level);
@@ -1095,8 +1114,7 @@ void AbstractTexture::subImageImplementationDefault(GLenum target, GLint level,
static_cast(format);
static_cast(type);
static_cast(data);
- CORRADE_INTERNAL_ASSERT(false);
- //glTexSubImage3DOES(target, level, offset.x(), offset.y(), offset.z(), size.x(), size.y(), size.z(), GLenum(format), GLenum(type), data);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -1159,7 +1177,9 @@ Math::Vector<1, GLint> AbstractTexture::DataHelper<1>::imageSize(AbstractTexture
(texture.*Context::current()->state().texture->getLevelParameterivImplementation)(target, level, GL_TEXTURE_WIDTH, &value[0]);
return value;
}
+#endif
+#ifndef MAGNUM_TARGET_GLES2
Vector2i AbstractTexture::DataHelper<2>::imageSize(AbstractTexture& texture, const GLenum target, const GLint level) {
const Implementation::TextureState& state = *Context::current()->state().texture;
@@ -1194,11 +1214,13 @@ void AbstractTexture::DataHelper<3>::setStorage(AbstractTexture& texture, const
(texture.*Context::current()->state().texture->storage3DImplementation)(target, levels, internalFormat, size);
}
-#ifndef MAGNUM_TARGET_GLES
+#ifndef MAGNUM_TARGET_GLES2
void AbstractTexture::DataHelper<2>::setStorageMultisample(AbstractTexture& texture, const GLenum target, const GLsizei samples, const TextureFormat internalFormat, const Vector2i& size, const GLboolean fixedSampleLocations) {
(texture.*Context::current()->state().texture->storage2DMultisampleImplementation)(target, samples, internalFormat, size, fixedSampleLocations);
}
+#endif
+#ifndef MAGNUM_TARGET_GLES
void AbstractTexture::DataHelper<3>::setStorageMultisample(AbstractTexture& texture, const GLenum target, const GLsizei samples, const TextureFormat internalFormat, const Vector3i& size, const GLboolean fixedSampleLocations) {
(texture.*Context::current()->state().texture->storage3DMultisampleImplementation)(target, samples, internalFormat, size, fixedSampleLocations);
}
diff --git a/src/Magnum/AbstractTexture.h b/src/Magnum/AbstractTexture.h
index 902518328..09c19c3e8 100644
--- a/src/Magnum/AbstractTexture.h
+++ b/src/Magnum/AbstractTexture.h
@@ -159,15 +159,15 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
static Float maxLodBias();
#endif
- #ifndef MAGNUM_TARGET_GLES
+ #ifndef MAGNUM_TARGET_GLES2
/**
* @brief Max supported color sample count
*
* The result is cached, repeated queries don't result in repeated
- * OpenGL calls. If extension @extension{ARB,texture_multisample} is
- * not available, returns `0`.
+ * OpenGL calls. If neither extension @extension{ARB,texture_multisample}
+ * (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_COLOR_TEXTURE_SAMPLES}
- * @requires_gl Multisample textures are not available in OpenGL ES.
+ * @requires_gles30 Not defined in OpenGL ES 2.0
*/
static Int maxColorSamples();
@@ -175,10 +175,10 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
* @brief Max supported depth sample count
*
* The result is cached, repeated queries don't result in repeated
- * OpenGL calls. If extension @extension{ARB,texture_multisample} is
- * not available, returns `0`.
+ * OpenGL calls. If neither extension @extension{ARB,texture_multisample}
+ * (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_DEPTH_TEXTURE_SAMPLES}
- * @requires_gl Multisample textures are not available in OpenGL ES.
+ * @requires_gles30 Not defined in OpenGL ES 2.0
*/
static Int maxDepthSamples();
@@ -186,10 +186,10 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
* @brief Max supported integer sample count
*
* The result is cached, repeated queries don't result in repeated
- * OpenGL calls. If extension @extension{ARB,texture_multisample} is
- * not available, returns `0`.
+ * OpenGL calls. If neither extension @extension{ARB,texture_multisample}
+ * (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_INTEGER_SAMPLES}
- * @requires_gl Multisample textures are not available in OpenGL ES.
+ * @requires_gles30 Not defined in OpenGL ES 2.0
*/
static Int maxIntegerSamples();
#endif
@@ -341,7 +341,7 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
void setCompareMode(Sampler::CompareMode mode);
void setCompareFunction(Sampler::CompareFunction function);
- #ifndef MAGNUM_TARGET_GLES
+ #ifndef MAGNUM_TARGET_GLES2
void setDepthStencilMode(Sampler::DepthStencilMode mode);
#endif
void invalidateImage(Int level);
@@ -394,10 +394,12 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
void MAGNUM_LOCAL setMaxAnisotropyImplementationNoOp(GLfloat);
void MAGNUM_LOCAL setMaxAnisotropyImplementationExt(GLfloat anisotropy);
- #ifndef MAGNUM_TARGET_GLES
+ #ifndef MAGNUM_TARGET_GLES2
void MAGNUM_LOCAL getLevelParameterImplementationDefault(GLenum target, GLint level, GLenum parameter, GLint* values);
+ #ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL getLevelParameterImplementationDSA(GLenum target, GLint level, GLenum parameter, GLint* values);
#endif
+ #endif
void MAGNUM_LOCAL mipmapImplementationDefault();
#ifndef MAGNUM_TARGET_GLES
@@ -424,9 +426,15 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
#ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL storageMultisampleImplementationFallback(GLenum target, GLsizei samples, TextureFormat internalFormat, const Vector2i& size, GLboolean fixedsamplelocations);
+ #endif
+ #ifndef MAGNUM_TARGET_GLES2
void MAGNUM_LOCAL storageMultisampleImplementationDefault(GLenum target, GLsizei samples, TextureFormat internalFormat, const Vector2i& size, GLboolean fixedsamplelocations);
+ #endif
+ #ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL storageMultisampleImplementationDSA(GLenum target, GLsizei samples, TextureFormat internalFormat, const Vector2i& size, GLboolean fixedsamplelocations);
+ #endif
+ #ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL storageMultisampleImplementationFallback(GLenum target, GLsizei samples, TextureFormat internalFormat, const Vector3i& size, GLboolean fixedsamplelocations);
void MAGNUM_LOCAL storageMultisampleImplementationDefault(GLenum target, GLsizei samples, TextureFormat internalFormat, const Vector3i& size, GLboolean fixedsamplelocations);
void MAGNUM_LOCAL storageMultisampleImplementationDSA(GLenum target, GLsizei samples, TextureFormat internalFormat, const Vector3i& size, GLboolean fixedsamplelocations);
@@ -520,7 +528,7 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<2> {
};
#endif
- #ifndef MAGNUM_TARGET_GLES
+ #ifndef MAGNUM_TARGET_GLES2
static Vector2i imageSize(AbstractTexture& texture, GLenum target, GLint level);
#endif
@@ -528,7 +536,9 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<2> {
static void setStorage(AbstractTexture& texture, GLenum target, GLsizei levels, TextureFormat internalFormat, const Vector2i& size);
+ #ifndef MAGNUM_TARGET_GLES2
static void setStorageMultisample(AbstractTexture& texture, GLenum target, GLsizei samples, TextureFormat internalFormat, const Vector2i& size, GLboolean fixedSampleLocations);
+ #endif
static void setImage(AbstractTexture& texture, GLenum target, GLint level, TextureFormat internalFormat, const ImageReference2D& image);
#ifndef MAGNUM_TARGET_GLES2
@@ -557,7 +567,7 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<3> {
};
#endif
- #ifndef MAGNUM_TARGET_GLES
+ #ifndef MAGNUM_TARGET_GLES2
static Vector3i imageSize(AbstractTexture& texture, GLenum target, GLint level);
#endif
@@ -565,7 +575,9 @@ template<> struct MAGNUM_EXPORT AbstractTexture::DataHelper<3> {
static void setStorage(AbstractTexture& texture, GLenum target, GLsizei levels, TextureFormat internalFormat, const Vector3i& size);
+ #ifndef MAGNUM_TARGET_GLES
static void setStorageMultisample(AbstractTexture& texture, GLenum target, GLsizei samples, TextureFormat internalFormat, const Vector3i& size, GLboolean fixedSampleLocations);
+ #endif
static void setImage(AbstractTexture& texture, GLenum target, GLint level, TextureFormat internalFormat, const ImageReference3D& image);
#ifndef MAGNUM_TARGET_GLES2
diff --git a/src/Magnum/Buffer.cpp b/src/Magnum/Buffer.cpp
index 75411ae09..e6c704ba5 100644
--- a/src/Magnum/Buffer.cpp
+++ b/src/Magnum/Buffer.cpp
@@ -48,9 +48,15 @@ Int Buffer::minMapAlignment() {
return value;
}
+#endif
+#ifndef MAGNUM_TARGET_GLES2
Int Buffer::maxAtomicCounterBindings() {
+ #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported())
+ #else
+ if(!Context::current()->isVersionSupported(Version::GLES310))
+ #endif
return 0;
GLint& value = Context::current()->state().buffer->maxAtomicCounterBindings;
@@ -62,7 +68,11 @@ Int Buffer::maxAtomicCounterBindings() {
}
Int Buffer::maxShaderStorageBindings() {
+ #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported())
+ #else
+ if(!Context::current()->isVersionSupported(Version::GLES310))
+ #endif
return 0;
GLint& value = Context::current()->state().buffer->maxShaderStorageBindings;
@@ -74,7 +84,11 @@ Int Buffer::maxShaderStorageBindings() {
}
Int Buffer::shaderStorageOffsetAlignment() {
+ #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported())
+ #else
+ if(!Context::current()->isVersionSupported(Version::GLES310))
+ #endif
return 0;
GLint& value = Context::current()->state().buffer->shaderStorageOffsetAlignment;
@@ -212,15 +226,14 @@ void* Buffer::map(const MapAccess access) {
#ifdef MAGNUM_TARGET_GLES2
void* Buffer::mapSub(const GLintptr offset, const GLsizeiptr length, const MapAccess access) {
- /** @todo Enable also in Emscripten (?) when extension loader is available */
#ifdef CORRADE_TARGET_NACL
CORRADE_ASSERT(!_mappedBuffer, "Buffer::mapSub(): the buffer is already mapped", nullptr);
return _mappedBuffer = glMapBufferSubDataCHROMIUM(GLenum(bindInternal(_targetHint)), offset, length, GLenum(access));
#else
- CORRADE_INTERNAL_ASSERT(false);
static_cast(offset);
static_cast(length);
static_cast(access);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
#endif
@@ -238,13 +251,12 @@ bool Buffer::unmap() { return (this->*Context::current()->state().buffer->unmapI
#ifdef MAGNUM_TARGET_GLES2
void Buffer::unmapSub() {
- /** @todo Enable also in Emscripten (?) when extension loader is available */
#ifdef CORRADE_TARGET_NACL
CORRADE_ASSERT(_mappedBuffer, "Buffer::unmapSub(): the buffer is not mapped", );
glUnmapBufferSubDataCHROMIUM(_mappedBuffer);
_mappedBuffer = nullptr;
#else
- CORRADE_INTERNAL_ASSERT(false);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
#endif
@@ -324,13 +336,13 @@ void Buffer::invalidateSubImplementationARB(GLintptr offset, GLsizeiptr length)
#endif
void* Buffer::mapImplementationDefault(MapAccess access) {
- /** @todo Re-enable when extension loader is available for ES */
#ifndef MAGNUM_TARGET_GLES
return glMapBuffer(GLenum(bindInternal(_targetHint)), GLenum(access));
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ return glMapBufferOES(GLenum(bindInternal(_targetHint)), GLenum(access));
#else
static_cast(access);
- CORRADE_INTERNAL_ASSERT(false);
- //return glMapBufferOES(GLenum(bindInternal(_targetHint)), GLenum(access));
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -341,15 +353,15 @@ void* Buffer::mapImplementationDSA(MapAccess access) {
#endif
void* Buffer::mapRangeImplementationDefault(GLintptr offset, GLsizeiptr length, MapFlags access) {
- /** @todo Re-enable when extension loader is available for ES */
#ifndef MAGNUM_TARGET_GLES2
return glMapBufferRange(GLenum(bindInternal(_targetHint)), offset, length, GLenum(access));
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ return glMapBufferRangeEXT(GLenum(bindInternal(_targetHint)), offset, length, GLenum(access));
#else
static_cast(offset);
static_cast(length);
static_cast(access);
- CORRADE_INTERNAL_ASSERT(false);
- //return glMapBufferRangeEXT(GLenum(bindInternal(_targetHint)), offset, length, GLenum(access));
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -360,14 +372,14 @@ void* Buffer::mapRangeImplementationDSA(GLintptr offset, GLsizeiptr length, MapF
#endif
void Buffer::flushMappedRangeImplementationDefault(GLintptr offset, GLsizeiptr length) {
- /** @todo Re-enable when extension loader is available for ES */
#ifndef MAGNUM_TARGET_GLES2
glFlushMappedBufferRange(GLenum(bindInternal(_targetHint)), offset, length);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glFlushMappedBufferRangeEXT(GLenum(bindInternal(_targetHint)), offset, length);
#else
static_cast(offset);
static_cast(length);
- CORRADE_INTERNAL_ASSERT(false);
- //glFlushMappedBufferRangeEXT(GLenum(bindInternal(_targetHint)), offset, length);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -378,12 +390,12 @@ void Buffer::flushMappedRangeImplementationDSA(GLintptr offset, GLsizeiptr lengt
#endif
bool Buffer::unmapImplementationDefault() {
- /** @todo Re-enable when extension loader is available for ES */
#ifndef MAGNUM_TARGET_GLES2
return glUnmapBuffer(GLenum(bindInternal(_targetHint)));
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ return glUnmapBufferOES(GLenum(bindInternal(_targetHint)));
#else
- CORRADE_INTERNAL_ASSERT(false);
- //return glUnmapBufferOES(GLenum(bindInternal(_targetHint)));
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -398,14 +410,10 @@ Debug operator<<(Debug debug, Buffer::Target value) {
switch(value) {
#define _c(value) case Buffer::Target::value: return debug << "Buffer::Target::" #value;
_c(Array)
- #ifndef MAGNUM_TARGET_GLES
- _c(AtomicCounter)
- #endif
#ifndef MAGNUM_TARGET_GLES2
+ _c(AtomicCounter)
_c(CopyRead)
_c(CopyWrite)
- #endif
- #ifndef MAGNUM_TARGET_GLES
_c(DispatchIndirect)
_c(DrawIndirect)
#endif
@@ -413,9 +421,9 @@ Debug operator<<(Debug debug, Buffer::Target value) {
#ifndef MAGNUM_TARGET_GLES2
_c(PixelPack)
_c(PixelUnpack)
+ _c(ShaderStorage)
#endif
#ifndef MAGNUM_TARGET_GLES
- _c(ShaderStorage)
_c(Texture)
#endif
#ifndef MAGNUM_TARGET_GLES2
diff --git a/src/Magnum/Buffer.h b/src/Magnum/Buffer.h
index 3c5611914..a1aba4dfe 100644
--- a/src/Magnum/Buffer.h
+++ b/src/Magnum/Buffer.h
@@ -219,11 +219,12 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
/** Used for storing vertex attributes. */
Array = GL_ARRAY_BUFFER,
- #ifndef MAGNUM_TARGET_GLES
+ #ifndef MAGNUM_TARGET_GLES2
/**
* Used for storing atomic counters.
* @requires_gl42 %Extension @extension{ARB,shader_atomic_counters}
- * @requires_gl Atomic counters are not available in OpenGL ES.
+ * @requires_gles31 Atomic counters are not available in OpenGL ES
+ * 3.0 and older.
*/
AtomicCounter = GL_ATOMIC_COUNTER_BUFFER,
#endif
@@ -246,18 +247,20 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
CopyWrite = GL_COPY_WRITE_BUFFER,
#endif
- #ifndef MAGNUM_TARGET_GLES
+ #ifndef MAGNUM_TARGET_GLES2
/**
* Indirect compute dispatch commands.
* @requires_gl43 %Extension @extension{ARB,compute_shader}
- * @requires_gl Compute shaders are not available in OpenGL ES.
+ * @requires_gles31 Compute shaders are not available in OpenGL ES
+ * 3.0 and older.
*/
DispatchIndirect = GL_DISPATCH_INDIRECT_BUFFER,
/**
* Used for supplying arguments for indirect drawing.
* @requires_gl40 %Extension @extension{ARB,draw_indirect}
- * @requires_gl Indirect drawing not available in OpenGL ES.
+ * @requires_gles31 Indirect drawing not available in OpenGL ES 3.0
+ * and older.
*/
DrawIndirect = GL_DRAW_INDIRECT_BUFFER,
#endif
@@ -283,14 +286,17 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
PixelUnpack = GL_PIXEL_UNPACK_BUFFER,
#endif
- #ifndef MAGNUM_TARGET_GLES
+ #ifndef MAGNUM_TARGET_GLES2
/**
* Used for shader storage.
* @requires_gl43 %Extension @extension{ARB,shader_storage_buffer_object}
- * @requires_gl Shader storage is not available in OpenGL ES.
+ * @requires_gles31 Shader storage is not available in OpenGL ES
+ * 3.0 and older.
*/
ShaderStorage = GL_SHADER_STORAGE_BUFFER,
+ #endif
+ #ifndef MAGNUM_TARGET_GLES
/**
* Source for texel fetches. See @ref BufferTexture.
* @requires_gl31 %Extension @extension{ARB,texture_buffer_object}
@@ -442,21 +448,23 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @brief Minimal supported mapping alignment
*
* The result is cached, repeated queries don't result in repeated
- * OpenGL calls. If extension @extension{ARB,map_buffer_alignment} is
- * not available, returns `0`.
+ * OpenGL calls. If extension @extension{ARB,map_buffer_alignment}
+ * (part of OpenGL 4.2) is not available, returns `0`.
* @see @ref map(), @fn_gl{Get} with @def_gl{MIN_MAP_BUFFER_ALIGNMENT}
* @requires_gl No minimal value is specified for OpenGL ES.
*/
static Int minMapAlignment();
+ #endif
+ #ifndef MAGNUM_TARGET_GLES2
/**
* @brief Max supported atomic counter buffer binding count
*
* The result is cached, repeated queries don't result in repeated
- * OpenGL calls. If extension @extension{ARB,shader_atomic_counters} is
- * not available, returns `0`.
+ * OpenGL calls. If neither extension @extension{ARB,shader_atomic_counters}
+ * (part of OpenGL 4.2) nor OpenGL ES 3.1 is available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_ATOMIC_COUNTER_BUFFER_BINDINGS}
- * @requires_gl Atomic counters are not available in OpenGL ES.
+ * @requires_gles30 Not defined in OpenGL ES 2.0
*/
static Int maxAtomicCounterBindings();
@@ -464,10 +472,10 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @brief Max supported shader storage buffer binding count
*
* The result is cached, repeated queries don't result in repeated
- * OpenGL calls. If extension @extension{ARB,shader_storage_buffer_object}
- * is not available, returns `0`.
+ * OpenGL calls. If neither extension @extension{ARB,shader_storage_buffer_object}
+ * (part of OpenGL 4.3) nor OpenGL ES 3.1 is available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_SHADER_STORAGE_BUFFER_BINDINGS}
- * @requires_gl Atomic counters are not available in OpenGL ES.
+ * @requires_gles30 Not defined in OpenGL ES 2.0
*/
static Int maxShaderStorageBindings();
@@ -475,10 +483,10 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @brief Alignment of shader storage buffer binding offset
*
* The result is cached, repeated queries don't result in repeated
- * OpenGL calls. If extension @extension{ARB,shader_storage_buffer_object}
- * is not available, returns `0`.
+ * OpenGL calls. If neither extension @extension{ARB,shader_storage_buffer_object}
+ * (part of OpenGL 4.3) nor OpenGL ES 3.1 is available, returns `0`.
* @see @fn_gl{Get} with @def_gl{SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT}
- * @requires_gl Atomic counters are not available in OpenGL ES.
+ * @requires_gles30 Not defined in OpenGL ES 2.0
*/
static Int shaderStorageOffsetAlignment();
#endif
@@ -489,7 +497,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
*
* The result is cached, repeated queries don't result in repeated
* OpenGL calls. If extension @extension{ARB,uniform_buffer_object}
- * is not available, returns `0`.
+ * (part of OpenGL 3.1) is not available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_UNIFORM_BUFFER_BINDINGS}
* @requires_gles30 Uniform blocks are not available in OpenGL ES 2.0.
*/
diff --git a/src/Magnum/CMakeLists.txt b/src/Magnum/CMakeLists.txt
index 38b7a1242..d6db799e4 100644
--- a/src/Magnum/CMakeLists.txt
+++ b/src/Magnum/CMakeLists.txt
@@ -143,26 +143,30 @@ if(NOT TARGET_GLES)
set(Magnum_HEADERS ${Magnum_HEADERS}
BufferTexture.h
CubeMapTextureArray.h
- MultisampleTexture.h
RectangleTexture.h)
set(Magnum_SRCS ${Magnum_SRCS}
BufferTexture.cpp
CubeMapTextureArray.cpp
- MultisampleTexture.cpp
- RectangleTexture.cpp
- $)
+ RectangleTexture.cpp)
endif()
# Non-ES2 stuff
if(NOT TARGET_GLES2)
set(Magnum_HEADERS ${Magnum_HEADERS}
BufferImage.h
+ MultisampleTexture.h
TextureArray.h)
set(Magnum_SRCS ${Magnum_SRCS}
BufferImage.cpp
+ MultisampleTexture.cpp
TextureArray.cpp)
endif()
+# Link in GL function pointer variables on platforms that support it
+if(NOT CORRADE_TARGET_EMSCRIPTEN AND NOT CORRADE_TARGET_NACL)
+ list(APPEND Magnum_SRCS $)
+endif()
+
# Files shared between main library and math unit test library
set(MagnumMath_SRCS
Math/Functions.cpp
diff --git a/src/Magnum/Context.cpp b/src/Magnum/Context.cpp
index 42dc883ea..dc3c24611 100644
--- a/src/Magnum/Context.cpp
+++ b/src/Magnum/Context.cpp
@@ -281,6 +281,7 @@ const std::vector& Extension::extensions(Version version) {
#else
case Version::GLES200: return empty;
case Version::GLES300:
+ case Version::GLES310:
#ifdef MAGNUM_TARGET_GLES2
return extensionsES300;
#else
@@ -396,6 +397,7 @@ Context::Context(void functionLoader()) {
#else
Version::GLES200,
Version::GLES300,
+ Version::GLES310,
#endif
Version::None
};
diff --git a/src/Magnum/CubeMapTexture.h b/src/Magnum/CubeMapTexture.h
index d98d1f8c8..93ba1ffc7 100644
--- a/src/Magnum/CubeMapTexture.h
+++ b/src/Magnum/CubeMapTexture.h
@@ -238,7 +238,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
return *this;
}
- #ifndef MAGNUM_TARGET_GLES
+ #ifndef MAGNUM_TARGET_GLES2
/** @copydoc Texture::setDepthStencilMode() */
CubeMapTexture& setDepthStencilMode(Sampler::DepthStencilMode mode) {
AbstractTexture::setDepthStencilMode(mode);
@@ -246,14 +246,15 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
}
#endif
- #ifndef MAGNUM_TARGET_GLES
+ #ifndef MAGNUM_TARGET_GLES2
/**
* @brief %Image size in given mip level
* @param coordinate Coordinate
* @param level Mip level
*
* See @ref Texture::imageSize() for more information.
- * @requires_gl %Texture image queries are not available in OpenGL ES.
+ * @requires_gles31 %Texture image size queries are not available in
+ * OpenGL ES 3.0 and older.
*/
Vector2i imageSize(Coordinate coordinate, Int level) {
return DataHelper<2>::imageSize(*this, GLenum(coordinate), level);
diff --git a/src/Magnum/DebugMessage.cpp b/src/Magnum/DebugMessage.cpp
index ef9f0685f..a444ee618 100644
--- a/src/Magnum/DebugMessage.cpp
+++ b/src/Magnum/DebugMessage.cpp
@@ -36,8 +36,7 @@ namespace Magnum {
namespace {
-/** @todo Re-enable when extension wrangler is available for ES */
-#ifndef MAGNUM_TARGET_GLES
+#if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
void
#ifdef CORRADE_TARGET_WINDOWS
APIENTRY
@@ -113,27 +112,26 @@ void DebugMessage::insertInternal(const Source source, const Type type, const Un
void DebugMessage::insertImplementationNoOp(Source, Type, UnsignedInt, Severity, const Containers::ArrayReference) {}
void DebugMessage::insertImplementationKhr(const Source source, const Type type, const UnsignedInt id, const Severity severity, const Containers::ArrayReference string) {
- /** @todo Re-enable when extension wrangler is available for ES */
#ifndef MAGNUM_TARGET_GLES
glDebugMessageInsert(GLenum(source), GLenum(type), id, GLenum(severity), string.size(), string.data());
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glDebugMessageInsertKHR(GLenum(source), GLenum(type), id, GLenum(severity), string.size(), string.data());
#else
static_cast(source);
static_cast(type);
static_cast(id);
static_cast(severity);
static_cast(string);
- CORRADE_INTERNAL_ASSERT(false);
- //glDebugMessageInsertEXT(GLenum(source), GLenum(type), id, GLenum(severity), string.size(), string.data());
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
void DebugMessage::insertImplementationExt(Source, Type, UnsignedInt, Severity, const Containers::ArrayReference string) {
- /** @todo Re-enable when extension wrangler is available for ES */
- #ifndef MAGNUM_TARGET_GLES
+ #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
glInsertEventMarkerEXT(string.size(), string.data());
#else
static_cast(string);
- CORRADE_INTERNAL_ASSERT(false);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -150,17 +148,17 @@ void DebugMessage::setEnabledInternal(const GLenum source, const GLenum type, co
void DebugMessage::controlImplementationNoOp(GLenum, GLenum, GLenum, std::initializer_list, bool) {}
void DebugMessage::controlImplementationKhr(const GLenum source, const GLenum type, const GLenum severity, const std::initializer_list ids, const bool enabled) {
- /** @todo Re-enable when extension wrangler is available for ES */
#ifndef MAGNUM_TARGET_GLES
glDebugMessageControl(source, type, severity, ids.size(), ids.begin(), enabled);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glDebugMessageControlKHR(source, type, severity, ids.size(), ids.begin(), enabled);
#else
static_cast(source);
static_cast(type);
static_cast(severity);
static_cast(ids);
static_cast(enabled);
- CORRADE_INTERNAL_ASSERT(false);
- //glDebugMessageControlKHR(source, type, severity, ids.size(), ids.begin(), enabled);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -173,23 +171,23 @@ void DebugMessage::callbackImplementationKhr(const Callback callback, const void
/* Adding callback */
if(!original && callback) {
- /** @todo Re-enable when extension wrangler is available for ES */
#ifndef MAGNUM_TARGET_GLES
glDebugMessageCallback(callbackWrapper, userParam);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glDebugMessageCallbackKHR(callbackWrapper, userParam);
#else
static_cast(userParam);
- CORRADE_INTERNAL_ASSERT(false);
- //glDebugMessageCallbackEXT(callbackWrapper, userParam);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
/* Deleting callback */
} else if(original && !callback) {
- /** @todo Re-enable when extension wrangler is available for ES */
#ifndef MAGNUM_TARGET_GLES
glDebugMessageCallback(nullptr, nullptr);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glDebugMessageCallbackKHR(nullptr, nullptr);
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glDebugMessageCallbackEXT(nullptr, nullptr);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
}
diff --git a/src/Magnum/Framebuffer.cpp b/src/Magnum/Framebuffer.cpp
index 03aec516a..d09a23e14 100644
--- a/src/Magnum/Framebuffer.cpp
+++ b/src/Magnum/Framebuffer.cpp
@@ -36,12 +36,12 @@
#ifndef MAGNUM_TARGET_GLES2
#include "Magnum/BufferImage.h"
+#include "Magnum/MultisampleTexture.h"
#include "Magnum/TextureArray.h"
#endif
#ifndef MAGNUM_TARGET_GLES
#include "Magnum/CubeMapTextureArray.h"
-#include "Magnum/MultisampleTexture.h"
#include "Magnum/RectangleTexture.h"
#endif
@@ -190,7 +190,9 @@ Framebuffer& Framebuffer::attachTexture(const BufferAttachment attachment, Recta
(this->*Context::current()->state().framebuffer->texture2DImplementation)(attachment, GL_TEXTURE_RECTANGLE, texture.id(), 0);
return *this;
}
+#endif
+#ifndef MAGNUM_TARGET_GLES2
Framebuffer& Framebuffer::attachTexture(const BufferAttachment attachment, MultisampleTexture2D& texture) {
(this->*Context::current()->state().framebuffer->texture2DImplementation)(attachment, GL_TEXTURE_2D_MULTISAMPLE, texture.id(), 0);
return *this;
@@ -276,16 +278,16 @@ void Framebuffer::texture2DImplementationDSA(BufferAttachment attachment, GLenum
#endif
void Framebuffer::textureLayerImplementationDefault(BufferAttachment attachment, GLuint textureId, GLint mipLevel, GLint layer) {
- /** @todo Re-enable when extension loader is available for ES 2.0 */
#ifndef MAGNUM_TARGET_GLES2
glFramebufferTextureLayer(GLenum(bindInternal()), GLenum(attachment), textureId, mipLevel, layer);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glFramebufferTexture3DOES(GLenum(bindInternal()), GLenum(attachment), GL_TEXTURE_3D_OES, textureId, mipLevel, layer);
#else
static_cast(attachment);
static_cast(textureId);
static_cast(mipLevel);
static_cast(layer);
- CORRADE_INTERNAL_ASSERT(false);
- //glFramebufferTexture3DOES(GLenum(bindInternal()), GLenum(attachment), GL_TEXTURE_3D_OES, texture.id(), mipLevel, layer);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
diff --git a/src/Magnum/Framebuffer.h b/src/Magnum/Framebuffer.h
index 613878540..0759f611e 100644
--- a/src/Magnum/Framebuffer.h
+++ b/src/Magnum/Framebuffer.h
@@ -539,10 +539,13 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje
* @requires_gl Rectangle textures are not available in OpenGL ES.
*/
Framebuffer& attachTexture(BufferAttachment attachment, RectangleTexture& texture);
+ #endif
+ #ifndef MAGNUM_TARGET_GLES2
/** @overload
* @requires_gl32 %Extension @extension{ARB,texture_multisample}
- * @requires_gl Multisample textures are not available in OpenGL ES.
+ * @requires_gles31 Multisample textures are not available in OpenGL ES
+ * 3.0 and older.
*/
Framebuffer& attachTexture(BufferAttachment attachment, MultisampleTexture2D& texture);
#endif
@@ -608,7 +611,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje
/** @overload
* @requires_gl32 %Extension @extension{ARB,texture_multisample}
- * @requires_gl Multisample textures are not available in OpenGL ES.
+ * @requires_gl Multisample array textures are not available in OpenGL ES.
*/
Framebuffer& attachTextureLayer(BufferAttachment attachment, MultisampleTexture2DArray& texture, Int layer);
#endif
diff --git a/src/Magnum/Implementation/BufferState.cpp b/src/Magnum/Implementation/BufferState.cpp
index e123a6547..dda1acb73 100644
--- a/src/Magnum/Implementation/BufferState.cpp
+++ b/src/Magnum/Implementation/BufferState.cpp
@@ -36,24 +36,22 @@ namespace Magnum { namespace Implementation {
const Buffer::Target BufferState::targetForIndex[] = {
Buffer::Target::Array,
- Buffer::Target::ElementArray
+ Buffer::Target::ElementArray,
#ifndef MAGNUM_TARGET_GLES2
- ,
Buffer::Target::CopyRead,
Buffer::Target::CopyWrite,
Buffer::Target::PixelPack,
Buffer::Target::PixelUnpack,
Buffer::Target::TransformFeedback,
- Buffer::Target::Uniform
- #endif
- #ifndef MAGNUM_TARGET_GLES
- ,
+ Buffer::Target::Uniform,
Buffer::Target::AtomicCounter,
Buffer::Target::DispatchIndirect,
Buffer::Target::DrawIndirect,
Buffer::Target::ShaderStorage,
+ #ifndef MAGNUM_TARGET_GLES
Buffer::Target::Texture
#endif
+ #endif
};
std::size_t BufferState::indexForTarget(Buffer::Target target) {
@@ -67,14 +65,14 @@ std::size_t BufferState::indexForTarget(Buffer::Target target) {
case Buffer::Target::PixelUnpack: return 6;
case Buffer::Target::TransformFeedback: return 7;
case Buffer::Target::Uniform: return 8;
- #endif
- #ifndef MAGNUM_TARGET_GLES
case Buffer::Target::AtomicCounter: return 9;
case Buffer::Target::DispatchIndirect: return 10;
case Buffer::Target::DrawIndirect: return 11;
case Buffer::Target::ShaderStorage: return 12;
+ #ifndef MAGNUM_TARGET_GLES
case Buffer::Target::Texture: return 13;
#endif
+ #endif
}
CORRADE_ASSERT_UNREACHABLE();
@@ -83,9 +81,9 @@ std::size_t BufferState::indexForTarget(Buffer::Target target) {
BufferState::BufferState(Context& context, std::vector& extensions): bindings()
#ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES
- , minMapAlignment(0), maxAtomicCounterBindings(0), maxShaderStorageBindings(0), shaderStorageOffsetAlignment(0)
+ , minMapAlignment(0)
#endif
- , maxUniformBindings(0)
+ , maxAtomicCounterBindings(0), maxShaderStorageBindings(0), shaderStorageOffsetAlignment(0), maxUniformBindings(0)
#endif
{
#ifndef MAGNUM_TARGET_GLES
diff --git a/src/Magnum/Implementation/BufferState.h b/src/Magnum/Implementation/BufferState.h
index 9c255c37a..48ccba415 100644
--- a/src/Magnum/Implementation/BufferState.h
+++ b/src/Magnum/Implementation/BufferState.h
@@ -32,13 +32,11 @@ namespace Magnum { namespace Implementation {
struct BufferState {
#ifndef MAGNUM_TARGET_GLES
static const std::size_t TargetCount = 13+1;
- #else
- #ifndef MAGNUM_TARGET_GLES2
- static const std::size_t TargetCount = 8+1;
+ #elif !defined(MAGNUM_TARGET_GLES2)
+ static const std::size_t TargetCount = 12+1;
#else
static const std::size_t TargetCount = 2+1;
#endif
- #endif
/* Target <-> index mapping */
static std::size_t indexForTarget(Buffer::Target target);
@@ -72,10 +70,10 @@ struct BufferState {
GLint
#ifndef MAGNUM_TARGET_GLES
minMapAlignment,
+ #endif
maxAtomicCounterBindings,
maxShaderStorageBindings,
shaderStorageOffsetAlignment,
- #endif
maxUniformBindings;
#endif
};
diff --git a/src/Magnum/Implementation/ShaderProgramState.cpp b/src/Magnum/Implementation/ShaderProgramState.cpp
index 680ad4bad..37fc7aa32 100644
--- a/src/Magnum/Implementation/ShaderProgramState.cpp
+++ b/src/Magnum/Implementation/ShaderProgramState.cpp
@@ -34,11 +34,11 @@
namespace Magnum { namespace Implementation {
ShaderProgramState::ShaderProgramState(Context& context, std::vector& extensions): current(0), maxVertexAttributes(0)
- #ifndef MAGNUM_TARGET_GLES
- , maxAtomicCounterBufferSize(0), maxComputeSharedMemorySize(0), maxComputeWorkGroupInvocations(0), maxImageUnits(0), maxImageSamples(0), maxCombinedShaderOutputResources(0), maxUniformLocations(0), maxShaderStorageBlockSize(0)
- #endif
#ifndef MAGNUM_TARGET_GLES2
- , minTexelOffset(0), maxTexelOffset(0), maxUniformBlockSize(0)
+ , maxAtomicCounterBufferSize(0), maxComputeSharedMemorySize(0), maxComputeWorkGroupInvocations(0), maxImageUnits(0), maxCombinedShaderOutputResources(0), maxUniformLocations(0), minTexelOffset(0), maxTexelOffset(0), maxUniformBlockSize(0), maxShaderStorageBlockSize(0)
+ #endif
+ #ifndef MAGNUM_TARGET_GLES
+ , maxImageSamples(0)
#endif
{
#ifndef MAGNUM_TARGET_GLES
diff --git a/src/Magnum/Implementation/ShaderProgramState.h b/src/Magnum/Implementation/ShaderProgramState.h
index bf4416868..0ce583620 100644
--- a/src/Magnum/Implementation/ShaderProgramState.h
+++ b/src/Magnum/Implementation/ShaderProgramState.h
@@ -92,19 +92,21 @@ struct ShaderProgramState {
GLuint current;
GLint maxVertexAttributes;
- #ifndef MAGNUM_TARGET_GLES
+ #ifndef MAGNUM_TARGET_GLES2
GLint maxAtomicCounterBufferSize,
maxComputeSharedMemorySize,
maxComputeWorkGroupInvocations,
maxImageUnits,
- maxImageSamples,
maxCombinedShaderOutputResources,
- maxUniformLocations;
+ maxUniformLocations,
+ minTexelOffset,
+ maxTexelOffset,
+ maxUniformBlockSize;
GLint64 maxShaderStorageBlockSize;
#endif
- #ifndef MAGNUM_TARGET_GLES2
- GLint minTexelOffset, maxTexelOffset, maxUniformBlockSize;
+ #ifndef MAGNUM_TARGET_GLES
+ GLint maxImageSamples;
#endif
};
diff --git a/src/Magnum/Implementation/ShaderState.h b/src/Magnum/Implementation/ShaderState.h
index beba26ef6..a8f3a3cf3 100644
--- a/src/Magnum/Implementation/ShaderState.h
+++ b/src/Magnum/Implementation/ShaderState.h
@@ -35,7 +35,10 @@ struct ShaderState {
explicit ShaderState():
maxVertexOutputComponents{}, maxFragmentInputComponents{},
#ifndef MAGNUM_TARGET_GLES
- maxTessellationControlInputComponents{}, maxTessellationControlOutputComponents{}, maxTessellationControlTotalOutputComponents{}, maxTessellationEvaluationInputComponents{}, maxTessellationEvaluationOutputComponents{}, maxGeometryInputComponents{}, maxGeometryOutputComponents{}, maxGeometryTotalOutputComponents{}, maxAtomicCounterBuffers{}, maxCombinedAtomicCounterBuffers{}, maxAtomicCounters{}, maxCombinedAtomicCounters{}, maxImageUniforms{}, maxCombinedImageUniforms{}, maxShaderStorageBlocks{}, maxCombinedShaderStorageBlocks{},
+ maxTessellationControlInputComponents{}, maxTessellationControlOutputComponents{}, maxTessellationControlTotalOutputComponents{}, maxTessellationEvaluationInputComponents{}, maxTessellationEvaluationOutputComponents{}, maxGeometryInputComponents{}, maxGeometryOutputComponents{}, maxGeometryTotalOutputComponents{},
+ #endif
+ #ifndef MAGNUM_TARGET_GLES2
+ maxAtomicCounterBuffers{}, maxCombinedAtomicCounterBuffers{}, maxAtomicCounters{}, maxCombinedAtomicCounters{}, maxImageUniforms{}, maxCombinedImageUniforms{}, maxShaderStorageBlocks{}, maxCombinedShaderStorageBlocks{},
#endif
maxTextureImageUnits{}, maxTextureImageUnitsCombined{},
#ifndef MAGNUM_TARGET_GLES2
@@ -66,6 +69,8 @@ struct ShaderState {
maxGeometryInputComponents,
maxGeometryOutputComponents,
maxGeometryTotalOutputComponents;
+ #endif
+ #ifndef MAGNUM_TARGET_GLES2
GLint maxAtomicCounterBuffers[StageCount];
GLint maxCombinedAtomicCounterBuffers;
GLint maxAtomicCounters[StageCount];
diff --git a/src/Magnum/Implementation/TextureState.cpp b/src/Magnum/Implementation/TextureState.cpp
index 4dc90673d..9badb9faa 100644
--- a/src/Magnum/Implementation/TextureState.cpp
+++ b/src/Magnum/Implementation/TextureState.cpp
@@ -50,8 +50,11 @@ TextureState::TextureState(Context& context, std::vector& extension
maxLodBias{0.0f},
#endif
maxMaxAnisotropy(0.0f), currentTextureUnit(0)
+ #ifndef MAGNUM_TARGET_GLES2
+ , maxColorSamples(0), maxDepthSamples(0), maxIntegerSamples(0)
+ #endif
#ifndef MAGNUM_TARGET_GLES
- , maxColorSamples(0), maxDepthSamples(0), maxIntegerSamples(0), bufferOffsetAlignment(0)
+ , bufferOffsetAlignment(0)
#endif
{
/* Bind implementation */
@@ -113,6 +116,8 @@ TextureState::TextureState(Context& context, std::vector& extension
#ifndef MAGNUM_TARGET_GLES
parameterIuivImplementation = &AbstractTexture::parameterIImplementationDefault;
parameterIivImplementation = &AbstractTexture::parameterIImplementationDefault;
+ #endif
+ #ifndef MAGNUM_TARGET_GLES2
getLevelParameterivImplementation = &AbstractTexture::getLevelParameterImplementationDefault;
#endif
mipmapImplementation = &AbstractTexture::mipmapImplementationDefault;
@@ -213,6 +218,8 @@ TextureState::TextureState(Context& context, std::vector& extension
storage2DMultisampleImplementation = &AbstractTexture::storageMultisampleImplementationFallback;
storage3DMultisampleImplementation = &AbstractTexture::storageMultisampleImplementationFallback;
}
+ #elif !defined(MAGNUM_TARGET_GLES2)
+ storage2DMultisampleImplementation = &AbstractTexture::storageMultisampleImplementationDefault;
#endif
/* Anisotropic filter implementation */
diff --git a/src/Magnum/Implementation/TextureState.h b/src/Magnum/Implementation/TextureState.h
index 4fc60b07d..b51a2af9a 100644
--- a/src/Magnum/Implementation/TextureState.h
+++ b/src/Magnum/Implementation/TextureState.h
@@ -71,7 +71,7 @@ struct TextureState {
void(AbstractTexture::*parameterIivImplementation)(GLenum, const GLint*);
#endif
void(AbstractTexture::*setMaxAnisotropyImplementation)(GLfloat);
- #ifndef MAGNUM_TARGET_GLES
+ #ifndef MAGNUM_TARGET_GLES2
void(AbstractTexture::*getLevelParameterivImplementation)(GLenum, GLint, GLenum, GLint*);
#endif
void(AbstractTexture::*mipmapImplementation)();
@@ -80,8 +80,10 @@ struct TextureState {
#endif
void(AbstractTexture::*storage2DImplementation)(GLenum, GLsizei, TextureFormat, const Vector2i&);
void(AbstractTexture::*storage3DImplementation)(GLenum, GLsizei, TextureFormat, const Vector3i&);
- #ifndef MAGNUM_TARGET_GLES
+ #ifndef MAGNUM_TARGET_GLES2
void(AbstractTexture::*storage2DMultisampleImplementation)(GLenum, GLsizei, TextureFormat, const Vector2i&, GLboolean);
+ #endif
+ #ifndef MAGNUM_TARGET_GLES
void(AbstractTexture::*storage3DMultisampleImplementation)(GLenum, GLsizei, TextureFormat, const Vector3i&, GLboolean);
void(AbstractTexture::*getImageImplementation)(GLenum, GLint, ColorFormat, ColorType, std::size_t, GLvoid*);
void(AbstractTexture::*image1DImplementation)(GLenum, GLint, TextureFormat, const Math::Vector<1, GLsizei>&, ColorFormat, ColorType, const GLvoid*);
@@ -117,11 +119,13 @@ struct TextureState {
#endif
GLfloat maxMaxAnisotropy;
GLint currentTextureUnit;
- #ifndef MAGNUM_TARGET_GLES
+ #ifndef MAGNUM_TARGET_GLES2
GLint maxColorSamples,
maxDepthSamples,
- maxIntegerSamples,
- bufferOffsetAlignment;
+ maxIntegerSamples;
+ #endif
+ #ifndef MAGNUM_TARGET_GLES
+ GLint bufferOffsetAlignment;
#endif
std::vector> bindings;
diff --git a/src/Magnum/Implementation/setupDriverWorkarounds.cpp b/src/Magnum/Implementation/setupDriverWorkarounds.cpp
index ca7c0bb70..7c4c05049 100644
--- a/src/Magnum/Implementation/setupDriverWorkarounds.cpp
+++ b/src/Magnum/Implementation/setupDriverWorkarounds.cpp
@@ -48,13 +48,8 @@ void Context::setupDriverWorkarounds() {
_setRequiredVersion(GL::ARB::shading_language_420pack, GL320);
#endif
- #ifdef MAGNUM_TARGET_GLES
- /* Disable extensions for which we need extension loader, as they would
- crash otherwise. */
- /** @todo Remove this when extension loader for ES is available */
- #ifndef CORRADE_TARGET_NACL
- _setRequiredVersion(GL::CHROMIUM::map_sub, None);
- #endif
+ /* Disable extensions not available on NaCl and Emscripten */
+ #if defined(CORRADE_TARGET_NACL) || defined(CORRADE_TARGET_EMSCRIPTEN)
_setRequiredVersion(GL::EXT::multi_draw_arrays, None);
_setRequiredVersion(GL::EXT::debug_label, None);
_setRequiredVersion(GL::EXT::debug_marker, None);
@@ -65,16 +60,12 @@ void Context::setupDriverWorkarounds() {
_setRequiredVersion(GL::KHR::debug, None);
_setRequiredVersion(GL::NV::read_buffer_front, None);
_setRequiredVersion(GL::OES::mapbuffer, None);
- #ifdef MAGNUM_TARGET_GLES2
_setRequiredVersion(GL::ANGLE::framebuffer_blit, None);
_setRequiredVersion(GL::ANGLE::framebuffer_multisample, None);
_setRequiredVersion(GL::ANGLE::instanced_arrays, None);
_setRequiredVersion(GL::APPLE::framebuffer_multisample, None);
_setRequiredVersion(GL::EXT::discard_framebuffer, None);
_setRequiredVersion(GL::EXT::blend_minmax, None);
- #ifndef CORRADE_TARGET_NACL
- _setRequiredVersion(GL::EXT::occlusion_query_boolean, None);
- #endif
_setRequiredVersion(GL::EXT::texture_storage, None);
_setRequiredVersion(GL::EXT::map_buffer_range, None);
_setRequiredVersion(GL::EXT::instanced_arrays, None);
@@ -89,6 +80,11 @@ void Context::setupDriverWorkarounds() {
_setRequiredVersion(GL::OES::texture_3D, None);
_setRequiredVersion(GL::OES::vertex_array_object, None);
#endif
+
+ /* Disable extensions not available on Emscripten */
+ #ifdef CORRADE_TARGET_EMSCRIPTEN
+ _setRequiredVersion(GL::CHROMIUM::map_sub, None);
+ _setRequiredVersion(GL::EXT::occlusion_query_boolean, None);
#endif
#undef _setRequiredVersion
diff --git a/src/Magnum/Magnum.h b/src/Magnum/Magnum.h
index 4d16d875c..f8ce5d5ff 100644
--- a/src/Magnum/Magnum.h
+++ b/src/Magnum/Magnum.h
@@ -603,12 +603,14 @@ enum class MeshPrimitive: GLenum;
class Mesh;
class MeshView;
-#ifndef MAGNUM_TARGET_GLES
+#ifndef MAGNUM_TARGET_GLES2
/* MultisampleTextureSampleLocations enum used only in the function */
template class MultisampleTexture;
typedef MultisampleTexture<2> MultisampleTexture2D;
+#ifndef MAGNUM_TARGET_GLES
typedef MultisampleTexture<3> MultisampleTexture2DArray;
#endif
+#endif
/* AbstractQuery is not used directly */
class PrimitiveQuery;
diff --git a/src/Magnum/Mesh.cpp b/src/Magnum/Mesh.cpp
index c9ed84d0c..6789cef00 100644
--- a/src/Magnum/Mesh.cpp
+++ b/src/Magnum/Mesh.cpp
@@ -285,14 +285,14 @@ void Mesh::drawInternal(Int count, Int baseVertex, Int instanceCount, GLintptr i
}
void Mesh::bindVAO(GLuint vao) {
- /** @todo Re-enable when extension loader is available for ES */
GLuint& current = Context::current()->state().mesh->currentVAO;
if(current != vao) {
#ifndef MAGNUM_TARGET_GLES2
glBindVertexArray(current = vao);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glBindVertexArrayOES(current = vao);
#else
- CORRADE_INTERNAL_ASSERT(false);
- //glBindVertexArrayOES(current = vao);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
}
@@ -300,12 +300,12 @@ void Mesh::bindVAO(GLuint vao) {
void Mesh::createImplementationDefault() { _id = 0; }
void Mesh::createImplementationVAO() {
- /** @todo Get some extension wrangler instead to avoid linker errors to glGenVertexArrays() on ES2 */
#ifndef MAGNUM_TARGET_GLES2
glGenVertexArrays(1, &_id);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glGenVertexArraysOES(1, &_id);
#else
- //glGenVertexArraysOES(1, &_id);
- CORRADE_INTERNAL_ASSERT(false);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
CORRADE_INTERNAL_ASSERT(_id != Implementation::State::DisengagedBinding);
}
@@ -313,12 +313,12 @@ void Mesh::createImplementationVAO() {
void Mesh::destroyImplementationDefault() {}
void Mesh::destroyImplementationVAO() {
- /** @todo Get some extension wrangler instead to avoid linker errors to glDeleteVertexArrays() on ES2 */
#ifndef MAGNUM_TARGET_GLES2
glDeleteVertexArrays(1, &_id);
+ #elif !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glDeleteVertexArraysOES(1, &_id);
#else
- //glDeleteVertexArraysOES(1, &_id);
- CORRADE_INTERNAL_ASSERT(false);
+ CORRADE_ASSERT_UNREACHABLE();
#endif
}
@@ -426,24 +426,33 @@ void Mesh::vertexAttribPointer(const LongAttribute& attribute) {
#ifdef MAGNUM_TARGET_GLES2
void Mesh::vertexAttribDivisorImplementationANGLE(const GLuint index, const GLuint divisor) {
- //glVertexAttribDivisorANGLE(index, divisor);
- CORRADE_INTERNAL_ASSERT(false);
+ #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glVertexAttribDivisorANGLE(index, divisor);
+ #else
static_cast(index);
static_cast(divisor);
+ CORRADE_ASSERT_UNREACHABLE();
+ #endif
}
void Mesh::vertexAttribDivisorImplementationEXT(const GLuint index, const GLuint divisor) {
- //glVertexAttribDivisorEXT(index, divisor);
- CORRADE_INTERNAL_ASSERT(false);
+ #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glVertexAttribDivisorEXT(index, divisor);
+ #else
static_cast(index);
static_cast(divisor);
+ CORRADE_ASSERT_UNREACHABLE();
+ #endif
}
void Mesh::vertexAttribDivisorImplementationNV(const GLuint index, const GLuint divisor) {
- //glVertexAttribDivisorNV(index, divisor);
- CORRADE_INTERNAL_ASSERT(false);
+ #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glVertexAttribDivisorNV(index, divisor);
+ #else
static_cast(index);
static_cast(divisor);
+ CORRADE_ASSERT_UNREACHABLE();
+ #endif
}
#endif
@@ -501,51 +510,69 @@ void Mesh::unbindImplementationVAO() {}
#ifdef MAGNUM_TARGET_GLES2
void Mesh::drawArraysInstancedImplementationANGLE(const GLint baseVertex, const GLsizei count, const GLsizei instanceCount) {
- //glDrawArraysInstancedANGLE(GLenum(_primitive), baseVertex, count, instanceCount);
- CORRADE_INTERNAL_ASSERT(false);
+ #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glDrawArraysInstancedANGLE(GLenum(_primitive), baseVertex, count, instanceCount);
+ #else
static_cast(baseVertex);
static_cast(count);
static_cast(instanceCount);
+ CORRADE_ASSERT_UNREACHABLE();
+ #endif
}
void Mesh::drawArraysInstancedImplementationEXT(const GLint baseVertex, const GLsizei count, const GLsizei instanceCount) {
- //glDrawArraysInstancedEXT(GLenum(_primitive), baseVertex, count, instanceCount);
- CORRADE_INTERNAL_ASSERT(false);
+ #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glDrawArraysInstancedEXT(GLenum(_primitive), baseVertex, count, instanceCount);
+ #else
static_cast(baseVertex);
static_cast(count);
static_cast(instanceCount);
+ CORRADE_ASSERT_UNREACHABLE();
+ #endif
}
void Mesh::drawArraysInstancedImplementationNV(const GLint baseVertex, const GLsizei count, const GLsizei instanceCount) {
- //glDrawArraysInstancedNV(GLenum(_primitive), baseVertex, count, instanceCount);
- CORRADE_INTERNAL_ASSERT(false);
+ #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glDrawArraysInstancedNV(GLenum(_primitive), baseVertex, count, instanceCount);
+ #else
static_cast(baseVertex);
static_cast(count);
static_cast(instanceCount);
+ CORRADE_ASSERT_UNREACHABLE();
+ #endif
}
void Mesh::drawElementsInstancedImplementationANGLE(const GLsizei count, const GLintptr indexOffset, const GLsizei instanceCount) {
- //glDrawElementsInstancedANGLE(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast(indexOffset), instanceCount);
- CORRADE_INTERNAL_ASSERT(false);
+ #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glDrawElementsInstancedANGLE(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast(indexOffset), instanceCount);
+ #else
static_cast(count);
static_cast(indexOffset);
static_cast(instanceCount);
+ CORRADE_ASSERT_UNREACHABLE();
+ #endif
}
void Mesh::drawElementsInstancedImplementationEXT(const GLsizei count, const GLintptr indexOffset, const GLsizei instanceCount) {
- //glDrawElementsInstancedEXT(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast(indexOffset), instanceCount);
- CORRADE_INTERNAL_ASSERT(false);
+ #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glDrawElementsInstancedEXT(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast(indexOffset), instanceCount);
+ #else
static_cast(count);
static_cast(indexOffset);
static_cast(instanceCount);
+ CORRADE_ASSERT_UNREACHABLE();
+ #endif
}
void Mesh::drawElementsInstancedImplementationNV(const GLsizei count, const GLintptr indexOffset, const GLsizei instanceCount) {
- //glDrawElementsInstancedNV(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast(indexOffset), instanceCount);
- CORRADE_INTERNAL_ASSERT(false);
+ #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
+ glDrawElementsInstancedNV(GLenum(_primitive), count, GLenum(_indexType), reinterpret_cast(indexOffset), instanceCount);
+ #else
static_cast(count);
static_cast(indexOffset);
static_cast(instanceCount);
+ CORRADE_ASSERT_UNREACHABLE();
+ #endif
}
#endif
diff --git a/src/Magnum/MeshView.cpp b/src/Magnum/MeshView.cpp
index d6dc21bf0..10a071811 100644
--- a/src/Magnum/MeshView.cpp
+++ b/src/Magnum/MeshView.cpp
@@ -95,9 +95,10 @@ void MeshView::multiDrawImplementationDefault(std::initializer_list Vector2i MAGNUM_EXPORT maxMultisampleTextureSize<2>() {
+ #ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported())
- return {};
+ #else
+ if(!Context::current()->isVersionSupported(Version::GLES310))
+ #endif
+ return Vector2i{0};
return Vector2i{Implementation::maxTextureSideSize()};
}
+#ifndef MAGNUM_TARGET_GLES
template<> Vector3i MAGNUM_EXPORT maxMultisampleTextureSize<3>() {
if(!Context::current()->isExtensionSupported())
- return {};
+ return Vector3i{0};
return {Vector2i{Implementation::maxTextureSideSize()}, Implementation::max3DTextureDepth()};
}
+#endif
}}
#endif
diff --git a/src/Magnum/MultisampleTexture.h b/src/Magnum/MultisampleTexture.h
index 97794042a..7133a1447 100644
--- a/src/Magnum/MultisampleTexture.h
+++ b/src/Magnum/MultisampleTexture.h
@@ -25,7 +25,7 @@
DEALINGS IN THE SOFTWARE.
*/
-#ifndef MAGNUM_TARGET_GLES
+#ifndef MAGNUM_TARGET_GLES2
/** @file
* @brief Class @ref Magnum::MultisampleTexture, typedef @ref Magnum::MultisampleTexture2D, @ref Magnum::MultisampleTexture2DArray
*/
@@ -35,17 +35,21 @@
#include "Magnum/DimensionTraits.h"
#include "Magnum/Math/Vector3.h"
-#ifndef MAGNUM_TARGET_GLES
+#ifndef MAGNUM_TARGET_GLES2
namespace Magnum {
namespace Implementation {
template constexpr GLenum multisampleTextureTarget();
template<> inline constexpr GLenum multisampleTextureTarget<2>() { return GL_TEXTURE_2D_MULTISAMPLE; }
+ #ifndef MAGNUM_TARGET_GLES
template<> inline constexpr GLenum multisampleTextureTarget<3>() { return GL_TEXTURE_2D_MULTISAMPLE_ARRAY; }
+ #endif
template typename DimensionTraits::VectorType maxMultisampleTextureSize();
template<> MAGNUM_EXPORT Vector2i maxMultisampleTextureSize<2>();
+ #ifndef MAGNUM_TARGET_GLES
template<> MAGNUM_EXPORT Vector3i maxMultisampleTextureSize<3>();
+ #endif
}
/**
@@ -83,7 +87,10 @@ shaders.
@ref TextureArray, @ref CubeMapTexture, @ref CubeMapTextureArray,
@ref RectangleTexture, @ref BufferTexture
@requires_gl32 %Extension @extension{ARB,texture_multisample}
-@requires_gl Multisample textures are not available in OpenGL ES.
+@requires_gles31 Multisample textures are not available in OpenGL ES 3.0 and
+ older.
+@requires_gl 2D array multisample textures are not available in OpenGL ES, only
+ 2D ones.
*/
template class MultisampleTexture: public AbstractTexture {
public:
@@ -93,8 +100,9 @@ template class MultisampleTexture: public AbstractTextur
* @brief Max supported multisample texture size
*
* The result is cached, repeated queries don't result in repeated
- * OpenGL calls. If extension @extension{ARB,texture_multisample} (part
- * of OpenGL 3.2) is not available, returns zero vector.
+ * OpenGL calls. If neither extension @extension{ARB,texture_multisample}
+ * (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns zero
+ * vector.
* @see @fn_gl{Get} with @def_gl{MAX_TEXTURE_SIZE} and
* @def_gl{MAX_3D_TEXTURE_SIZE}
*/
@@ -187,11 +195,25 @@ template class MultisampleTexture: public AbstractTextur
#endif
};
-/** @brief Two-dimensional multisample texture */
+/**
+@brief Two-dimensional multisample texture
+
+@requires_gl32 %Extension @extension{ARB,texture_multisample}
+@requires_gles31 Multisample textures are not available in OpenGL ES 3.0 and
+ older.
+*/
typedef MultisampleTexture<2> MultisampleTexture2D;
-/** @brief Two-dimensional multisample texture array */
+#ifndef MAGNUM_TARGET_GLES
+/**
+@brief Two-dimensional multisample texture array
+
+@requires_gl32 %Extension @extension{ARB,texture_multisample}
+@requires_gl Only @ref Magnum::MultisampleTexture2D "MultisampleTexture2D" is
+ available in OpenGL ES.
+*/
typedef MultisampleTexture<3> MultisampleTexture2DArray;
+#endif
}
#else
diff --git a/src/Magnum/OpenGL.h b/src/Magnum/OpenGL.h
index fc7a69b54..aedede4cb 100644
--- a/src/Magnum/OpenGL.h
+++ b/src/Magnum/OpenGL.h
@@ -33,41 +33,29 @@
#include "Magnum/configure.h"
-/** @todo Remove NaCl workaround when not needed */
-
/* Desktop OpenGL */
#ifndef MAGNUM_TARGET_GLES
#include "MagnumExternal/OpenGL/GL/flextGL.h"
-/* NaCl has its own gl2.h, the official one causes linker issues. Additionaly
- to NaCl's gl2ext.h we are including our own to prevent undeclared symbol
- errors with some recent extensions. */
+/* Special case for NaCl */
#elif defined(CORRADE_TARGET_NACL)
- /* Enable function prototypes (the supported ones shouldn't fail at link time) */
- #define GL_GLEXT_PROTOTYPES
+ /* No extension loading */
+ #include "MagnumExternal/OpenGL/GLES2/flextGLNaCl.h"
- #include
+ /* Needed for NaCl-specific extensions */
+ #define GL_GLEXT_PROTOTYPES
+ #define GLES2_GET_FUN(name) GLES2##name
#include
- /* We need to define missing types for new extensions */
- #include
- typedef struct __GLsync *GLsync;
- typedef std::uint64_t GLuint64;
- typedef std::int64_t GLint64;
- #undef __gl2ext_h_
- #include "MagnumExternal/OpenGL/GLES2/gl2ext.h"
+/* Special case for Emscripten (no extension loading) */
+#elif defined(CORRADE_TARGET_EMSCRIPTEN)
+ #include "MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h"
/* Generic OpenGL ES */
+#elif defined(MAGNUM_TARGET_GLES2)
+ #include "MagnumExternal/OpenGL/GLES2/flextGL.h"
#else
- #include "MagnumExternal/OpenGL/KHR/khrplatform.h"
- #ifndef MAGNUM_TARGET_GLES2
- #include "MagnumExternal/OpenGL/GLES3/gl3platform.h"
- #include "MagnumExternal/OpenGL/GLES3/gl3.h"
- #else
- #include "MagnumExternal/OpenGL/GLES2/gl2platform.h"
- #include "MagnumExternal/OpenGL/GLES2/gl2.h"
- #endif
- #include "MagnumExternal/OpenGL/GLES2/gl2ext.h"
+ #include "MagnumExternal/OpenGL/GLES3/flextGL.h"
#endif
#endif
diff --git a/src/Magnum/Platform/CMakeLists.txt b/src/Magnum/Platform/CMakeLists.txt
index 28b59013d..9180cf20c 100644
--- a/src/Magnum/Platform/CMakeLists.txt
+++ b/src/Magnum/Platform/CMakeLists.txt
@@ -37,16 +37,19 @@ set(MagnumPlatform_FILES )
install(FILES ${MagnumPlatform_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Platform)
# Decide about platform-specific context for cross-platform toolkits
-if((WITH_GLUTAPPLICATION OR WITH_SDL2APPLICATION) AND NOT MAGNUM_TARGET_GLES)
- if(CORRADE_TARGET_APPLE)
+if(WITH_GLUTAPPLICATION OR WITH_SDL2APPLICATION)
+ if(CORRADE_TARGET_APPLE AND NOT MAGNUM_TARGET_GLES)
set(NEED_CGLCONTEXT 1)
set(MagnumSomeContext_OBJECTS $)
- elseif(CORRADE_TARGET_WINDOWS)
+ elseif(CORRADE_TARGET_WINDOWS AND NOT MAGNUM_TARGET_GLES)
set(NEED_WGLCONTEXT 1)
set(MagnumSomeContext_OBJECTS $)
- elseif(CORRADE_TARGET_UNIX)
+ elseif(CORRADE_TARGET_UNIX AND (NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES))
set(NEED_GLXCONTEXT 1)
set(MagnumSomeContext_OBJECTS $)
+ elseif(MAGNUM_TARGET_GLES AND NOT CORRADE_TARGET_EMSCRIPTEN AND NOT CORRADE_TARGET_NACL)
+ set(NEED_EGLCONTEXT 1)
+ set(MagnumSomeContext_OBJECTS $)
endif()
endif()
@@ -56,11 +59,14 @@ if(WITH_ANDROIDAPPLICATION)
message(FATAL_ERROR "AndroidApplication is available only when targeting Android. Set WITH_ANDROIDAPPLICATION to OFF to skip building it.")
endif()
+ set(NEED_EGLCONTEXT 1)
+
include_directories(${ANDROID_NATIVE_APP_GLUE_INCLUDE_DIR})
set(MagnumAndroidApplication_SRCS
AndroidApplication.cpp
- Implementation/Egl.cpp)
+ Implementation/Egl.cpp
+ $)
set(MagnumAndroidApplication_HEADERS
AndroidApplication.h)
set(MagnumAndroidApplication_PRIVATE_HEADERS
@@ -190,17 +196,13 @@ endif()
if(WITH_GLXAPPLICATION)
set(NEED_ABSTRACTXAPPLICATION 1)
set(NEED_GLXCONTEXTHANDLER 1)
- if(NOT MAGNUM_TARGET_GLES)
- set(NEED_GLXCONTEXT 1)
- endif()
+ set(NEED_GLXCONTEXT 1)
set(MagnumGlxApplication_SRCS
GlxApplication.cpp
$
- $)
- if(NOT MAGNUM_TARGET_GLES)
- list(APPEND MagnumWindowlessGlxApplication_SRCS $)
- endif()
+ $
+ $)
set(MagnumGlxApplication_HEADERS GlxApplication.h)
add_library(MagnumGlxApplication STATIC
@@ -218,11 +220,13 @@ endif()
if(WITH_XEGLAPPLICATION)
set(NEED_ABSTRACTXAPPLICATION 1)
set(NEED_EGLCONTEXTHANDLER 1)
+ set(NEED_EGLCONTEXT 1)
set(MagnumXEglApplication_SRCS
XEglApplication.cpp
$
- $)
+ $
+ $)
set(MagnumXEglApplication_HEADERS XEglApplication.h)
add_library(MagnumXEglApplication STATIC
@@ -245,14 +249,11 @@ endif()
# Windowless GLX application
if(WITH_WINDOWLESSGLXAPPLICATION)
- if(NOT MAGNUM_TARGET_GLES)
- set(NEED_GLXCONTEXT 1)
- endif()
+ set(NEED_GLXCONTEXT 1)
- set(MagnumWindowlessGlxApplication_SRCS WindowlessGlxApplication.cpp)
- if(NOT MAGNUM_TARGET_GLES)
- list(APPEND MagnumWindowlessGlxApplication_SRCS $)
- endif()
+ set(MagnumWindowlessGlxApplication_SRCS
+ WindowlessGlxApplication.cpp
+ $)
set(MagnumWindowlessGlxApplication_HEADERS WindowlessGlxApplication.h)
add_library(MagnumWindowlessGlxApplication STATIC
@@ -365,10 +366,13 @@ if(NEED_EGLCONTEXTHANDLER)
endif()
# Platform-specific sources for context library
+set(MagnumContext_SRCS Implementation/OpenGLFunctionLoader.cpp)
if(NOT MAGNUM_TARGET_GLES)
- set(MagnumContext_SRCS
- Implementation/OpenGLFunctionLoader.cpp
- ../../MagnumExternal/OpenGL/GL/flextGLPlatform.cpp)
+ list(APPEND MagnumContext_SRCS ../../MagnumExternal/OpenGL/GL/flextGLPlatform.cpp)
+elseif(MAGNUM_TARGET_GLES AND MAGNUM_TARGET_GLES2)
+ list(APPEND MagnumContext_SRCS ../../MagnumExternal/OpenGL/GLES2/flextGLPlatform.cpp)
+elseif(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_GLES2)
+ list(APPEND MagnumContext_SRCS ../../MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp)
endif()
# CGL context
@@ -389,6 +393,22 @@ if(NEED_CGLCONTEXT OR WITH_CGLCONTEXT)
endif()
endif()
+# EGL context
+if(NEED_EGLCONTEXT OR WITH_EGLCONTEXT)
+ add_library(MagnumEglContextObjects OBJECT ${MagnumContext_SRCS})
+ set_target_properties(MagnumEglContextObjects PROPERTIES COMPILE_DEFINITIONS "MAGNUM_PLATFORM_USE_EGL")
+
+ # Also create proper static library, if requested
+ if(WITH_EGLCONTEXT)
+ add_library(MagnumEglContext STATIC $)
+ set_target_properties(MagnumEglContext PROPERTIES DEBUG_POSTFIX "-d")
+ install(TARGETS MagnumEglContext
+ RUNTIME DESTINATION ${MAGNUM_BINARY_INSTALL_DIR}
+ LIBRARY DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR}
+ ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
+ endif()
+endif()
+
# GLX context
if(NEED_GLXCONTEXT OR WITH_GLXCONTEXT)
add_library(MagnumGlxContextObjects OBJECT ${MagnumContext_SRCS})
diff --git a/src/Magnum/Platform/Context.h b/src/Magnum/Platform/Context.h
index e08615409..f0503c9c9 100644
--- a/src/Magnum/Platform/Context.h
+++ b/src/Magnum/Platform/Context.h
@@ -52,7 +52,7 @@ class Context: public Magnum::Context {
* @fn_gl{GetString} with @def_gl{EXTENSIONS}
*/
explicit Context():
- #ifndef MAGNUM_TARGET_GLES
+ #if !defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(CORRADE_TARGET_NACL)
Magnum::Context{flextGLInit} {}
#else
Magnum::Context{nullptr} {}
diff --git a/src/Magnum/Platform/Implementation/OpenGLFunctionLoader.cpp b/src/Magnum/Platform/Implementation/OpenGLFunctionLoader.cpp
index c86805634..239f7b545 100644
--- a/src/Magnum/Platform/Implementation/OpenGLFunctionLoader.cpp
+++ b/src/Magnum/Platform/Implementation/OpenGLFunctionLoader.cpp
@@ -42,6 +42,10 @@
#elif defined(CORRADE_TARGET_UNIX) && defined(MAGNUM_PLATFORM_USE_GLX)
#include
+/* EGL-specific includes */
+#elif defined(MAGNUM_PLATFORM_USE_EGL)
+#include
+
/* Otherwise unsupported */
#else
#error Unsupported platform
@@ -92,6 +96,16 @@ auto OpenGLFunctionLoader::load(const char* const name) -> FunctionPointer {
return glXGetProcAddressARB(reinterpret_cast(name));
}
+/* EGL-specific implementation */
+#elif defined(MAGNUM_PLATFORM_USE_EGL)
+OpenGLFunctionLoader::OpenGLFunctionLoader() = default;
+
+OpenGLFunctionLoader::~OpenGLFunctionLoader() = default;
+
+auto OpenGLFunctionLoader::load(const char* const name) -> FunctionPointer {
+ return eglGetProcAddress(name);
+}
+
/* Otherwise unsupported */
#else
#error Unsupported platform
diff --git a/src/Magnum/Platform/Implementation/OpenGLFunctionLoader.h b/src/Magnum/Platform/Implementation/OpenGLFunctionLoader.h
index 3772d8c2c..9521b033d 100644
--- a/src/Magnum/Platform/Implementation/OpenGLFunctionLoader.h
+++ b/src/Magnum/Platform/Implementation/OpenGLFunctionLoader.h
@@ -63,6 +63,9 @@ class OpenGLFunctionLoader {
/* GLX-specific handles (nothing needed) */
#elif defined(CORRADE_TARGET_UNIX) && defined(MAGNUM_PLATFORM_USE_GLX)
+ /* EGL-specific handles (nothing needed) */
+ #elif defined(MAGNUM_PLATFORM_USE_EGL)
+
/* Otherwise unsupported */
#else
#error Unsupported platform
diff --git a/src/Magnum/Platform/NaClApplication.h b/src/Magnum/Platform/NaClApplication.h
index dc13c5bef..2d9341681 100644
--- a/src/Magnum/Platform/NaClApplication.h
+++ b/src/Magnum/Platform/NaClApplication.h
@@ -32,6 +32,10 @@
#include
#include
#include
+
+/* Needs to be first */
+#include "Magnum/OpenGL.h"
+
#include
#include
#include
diff --git a/src/Magnum/Platform/WindowlessNaClApplication.h b/src/Magnum/Platform/WindowlessNaClApplication.h
index 9fdbcef81..89123b501 100644
--- a/src/Magnum/Platform/WindowlessNaClApplication.h
+++ b/src/Magnum/Platform/WindowlessNaClApplication.h
@@ -32,6 +32,10 @@
#include
#include
#include
+
+/* Needs to be first */
+#include "Magnum/OpenGL.h"
+
#include
#include
#include
diff --git a/src/Magnum/Platform/magnum-info.cpp b/src/Magnum/Platform/magnum-info.cpp
index 69d18e660..6b046a693 100644
--- a/src/Magnum/Platform/magnum-info.cpp
+++ b/src/Magnum/Platform/magnum-info.cpp
@@ -40,8 +40,10 @@
#include "Magnum/Extensions.h"
#include "Magnum/Framebuffer.h"
#include "Magnum/Mesh.h"
-#ifndef MAGNUM_TARGET_GLES
+#ifndef MAGNUM_TARGET_GLES2
#include "Magnum/MultisampleTexture.h"
+#endif
+#ifndef MAGNUM_TARGET_GLES
#include "Magnum/RectangleTexture.h"
#endif
#include "Magnum/Renderbuffer.h"
@@ -315,6 +317,8 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat
_l(Shader::maxTextureImageUnits(Shader::Type::TessellationControl))
_l(Shader::maxTextureImageUnits(Shader::Type::TessellationEvaluation))
_l(Shader::maxTextureImageUnits(Shader::Type::Geometry))
+ #endif
+ #ifndef MAGNUM_TARGET_GLES2
_l(Shader::maxTextureImageUnits(Shader::Type::Compute))
#endif
_l(Shader::maxTextureImageUnits(Shader::Type::Fragment))
@@ -324,18 +328,12 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat
_l(Shader::maxUniformComponents(Shader::Type::TessellationControl))
_l(Shader::maxUniformComponents(Shader::Type::TessellationEvaluation))
_l(Shader::maxUniformComponents(Shader::Type::Geometry))
+ #endif
+ #ifndef MAGNUM_TARGET_GLES2
_l(Shader::maxUniformComponents(Shader::Type::Compute))
#endif
_l(Shader::maxUniformComponents(Shader::Type::Fragment))
- #ifndef MAGNUM_TARGET_GLES
- _l(AbstractShaderProgram::maxUniformLocations())
- #endif
_l(AbstractShaderProgram::maxVertexAttributes())
- #ifndef MAGNUM_TARGET_GLES
- _l(AbstractTexture::maxColorSamples())
- _l(AbstractTexture::maxDepthSamples())
- _l(AbstractTexture::maxIntegerSamples())
- #endif
#ifndef MAGNUM_TARGET_GLES2
_l(AbstractTexture::maxLodBias())
#endif
@@ -344,7 +342,7 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat
#endif
_lvec(Texture2D::maxSize())
#ifndef MAGNUM_TARGET_GLES2
- _lvec(Texture3D::maxSize())
+ _lvec(Texture3D::maxSize()) /* Checked ES2 version below */
#endif
#ifndef MAGNUM_TARGET_GLES
@@ -353,14 +351,34 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat
_l(AbstractFramebuffer::maxDualSourceDrawBuffers())
}
+ #endif
- if(c->isExtensionSupported()) {
+ #ifndef MAGNUM_TARGET_GLES2
+ #ifndef MAGNUM_TARGET_GLES
+ if(c->isExtensionSupported())
+ #endif
+ {
+ #ifndef MAGNUM_TARGET_GLES
_h(ARB::compute_shader)
+ #endif
_l(AbstractShaderProgram::maxComputeSharedMemorySize())
_l(AbstractShaderProgram::maxComputeWorkGroupInvocations())
}
+ #ifndef MAGNUM_TARGET_GLES
+ if(c->isExtensionSupported())
+ #endif
+ {
+ #ifndef MAGNUM_TARGET_GLES
+ _h(ARB::explicit_uniform_location)
+ #endif
+
+ _l(AbstractShaderProgram::maxUniformLocations())
+ }
+ #endif
+
+ #ifndef MAGNUM_TARGET_GLES
if(c->isExtensionSupported()) {
_h(ARB::geometry_shader4)
@@ -368,57 +386,86 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat
_l(Shader::maxGeometryOutputComponents())
_l(Shader::maxGeometryTotalOutputComponents())
}
+ #endif
- if(c->isExtensionSupported()) {
+ #ifndef MAGNUM_TARGET_GLES2
+ #ifndef MAGNUM_TARGET_GLES
+ if(c->isExtensionSupported())
+ #endif
+ {
+ #ifndef MAGNUM_TARGET_GLES
_h(ARB::shader_atomic_counters)
+ #endif
_l(Buffer::maxAtomicCounterBindings())
_l(Shader::maxAtomicCounterBuffers(Shader::Type::Vertex))
+ #ifndef MAGNUM_TARGET_GLES
_l(Shader::maxAtomicCounterBuffers(Shader::Type::TessellationControl))
_l(Shader::maxAtomicCounterBuffers(Shader::Type::TessellationEvaluation))
_l(Shader::maxAtomicCounterBuffers(Shader::Type::Geometry))
+ #endif
_l(Shader::maxAtomicCounterBuffers(Shader::Type::Compute))
_l(Shader::maxAtomicCounterBuffers(Shader::Type::Fragment))
_l(Shader::maxCombinedAtomicCounterBuffers())
_l(Shader::maxAtomicCounters(Shader::Type::Vertex))
+ #ifndef MAGNUM_TARGET_GLES
_l(Shader::maxAtomicCounters(Shader::Type::TessellationControl))
_l(Shader::maxAtomicCounters(Shader::Type::TessellationEvaluation))
_l(Shader::maxAtomicCounters(Shader::Type::Geometry))
+ #endif
_l(Shader::maxAtomicCounters(Shader::Type::Compute))
_l(Shader::maxAtomicCounters(Shader::Type::Fragment))
_l(Shader::maxCombinedAtomicCounters())
_l(AbstractShaderProgram::maxAtomicCounterBufferSize())
}
- if(c->isExtensionSupported()) {
+ #ifndef MAGNUM_TARGET_GLES
+ if(c->isExtensionSupported())
+ #endif
+ {
+ #ifndef MAGNUM_TARGET_GLES
_h(ARB::shader_image_load_store)
+ #endif
_l(Shader::maxImageUniforms(Shader::Type::Vertex))
+ #ifndef MAGNUM_TARGET_GLES
_l(Shader::maxImageUniforms(Shader::Type::TessellationControl))
_l(Shader::maxImageUniforms(Shader::Type::TessellationEvaluation))
_l(Shader::maxImageUniforms(Shader::Type::Geometry))
+ #endif
_l(Shader::maxImageUniforms(Shader::Type::Compute))
_l(Shader::maxImageUniforms(Shader::Type::Fragment))
_l(Shader::maxCombinedImageUniforms())
_l(AbstractShaderProgram::maxCombinedShaderOutputResources())
_l(AbstractShaderProgram::maxImageUnits())
+ #ifndef MAGNUM_TARGET_GLES
_l(AbstractShaderProgram::maxImageSamples())
+ #endif
}
- if(c->isExtensionSupported()) {
+ #ifndef MAGNUM_TARGET_GLES
+ if(c->isExtensionSupported