From 61d9697f002144bfa62ada89df30996373a1e2e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 23 May 2015 12:42:53 +0200 Subject: [PATCH] First-class WebGL support, part 13: reduce version enum. --- src/Magnum/Context.cpp | 4 ++++ src/Magnum/Platform/magnum-info.cpp | 2 ++ src/Magnum/Version.cpp | 3 +++ src/Magnum/Version.h | 6 ++++-- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Magnum/Context.cpp b/src/Magnum/Context.cpp index ae866d25d..36a9da270 100644 --- a/src/Magnum/Context.cpp +++ b/src/Magnum/Context.cpp @@ -323,8 +323,10 @@ const std::vector& Extension::extensions(Version version) { #else return empty; #endif + #ifndef MAGNUM_TARGET_WEBGL case Version::GLES310: return empty; #endif + #endif } CORRADE_ASSERT_UNREACHABLE(); @@ -435,8 +437,10 @@ Context::Context(void functionLoader()) { #else Version::GLES200, Version::GLES300, + #ifndef MAGNUM_TARGET_WEBGL Version::GLES310, #endif + #endif Version::None }; diff --git a/src/Magnum/Platform/magnum-info.cpp b/src/Magnum/Platform/magnum-info.cpp index 2feb77656..578a4fa57 100644 --- a/src/Magnum/Platform/magnum-info.cpp +++ b/src/Magnum/Platform/magnum-info.cpp @@ -261,8 +261,10 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat Version::GL450, #else Version::GLES300, + #ifndef MAGNUM_TARGET_WEBGL Version::GLES310, #endif + #endif Version::None }; std::size_t future = 0; diff --git a/src/Magnum/Version.cpp b/src/Magnum/Version.cpp index c9745b14f..18b1dc0f3 100644 --- a/src/Magnum/Version.cpp +++ b/src/Magnum/Version.cpp @@ -46,6 +46,9 @@ Debug operator<<(Debug debug, Version value) { _c(GL430, "OpenGL 4.3") _c(GL440, "OpenGL 4.4") _c(GL450, "OpenGL 4.5") + #elif defined(MAGNUM_TARGET_WEBGL) + _c(GLES200, "WebGL 1.0") + _c(GLES300, "WebGL 2.0") #else _c(GLES200, "OpenGL ES 2.0") _c(GLES300, "OpenGL ES 3.0") diff --git a/src/Magnum/Version.h b/src/Magnum/Version.h index 46aee0d23..2300e2e97 100644 --- a/src/Magnum/Version.h +++ b/src/Magnum/Version.h @@ -58,7 +58,7 @@ enum class Version: Int { #endif /** - * @brief OpenGL ES 2.0, GLSL ES 1.00 + * @brief OpenGL ES 2.0 or WebGL 1.0, GLSL ES 1.00 * * All the functionality is present in OpenGL 4.2 (extension * @extension{ARB,ES2_compatibility}), so on desktop OpenGL this is @@ -71,7 +71,7 @@ enum class Version: Int { #endif /** - * @brief OpenGL ES 3.0, GLSL ES 3.00 + * @brief OpenGL ES 3.0 or WebGL 2.0, GLSL ES 3.00 * * All the functionality is present in OpenGL 4.3 (extension * @extension{ARB,ES3_compatibility}), so on desktop OpenGL this is the @@ -83,6 +83,7 @@ enum class Version: Int { GLES300 = 300, #endif + #ifndef MAGNUM_TARGET_WEBGL /** * @brief OpenGL ES 3.1, GLSL ES 3.10 * @@ -95,6 +96,7 @@ enum class Version: Int { #else GLES310 = 310 #endif + #endif }; /** @brief Enum value from major and minor version number */