Browse Source

Adapt to Emscripten version macro rename.

The <emscripten/version.h> header is now taken care of by Corrade's
configure.h, along with providing macro aliases for backwards
compatibility, so I can delete a lot of duplicated code everywhere.
next
Vladimír Vondruš 4 weeks ago
parent
commit
fa85cad498
  1. 11
      src/Magnum/DebugTools/BufferData.cpp
  2. 13
      src/Magnum/DebugTools/BufferData.h
  3. 6
      src/Magnum/GL/Buffer.cpp
  4. 14
      src/Magnum/GL/Buffer.h
  5. 2
      src/Magnum/GL/Implementation/BufferState.cpp
  6. 12
      src/Magnum/GL/Implementation/BufferState.h
  7. 22
      src/Magnum/GL/Implementation/MeshState.cpp
  8. 12
      src/Magnum/GL/Implementation/RendererState.cpp
  9. 13
      src/Magnum/GL/Implementation/driverSpecific.cpp
  10. 10
      src/Magnum/GL/Mesh.cpp
  11. 20
      src/Magnum/GL/Mesh.h
  12. 12
      src/Magnum/GL/Renderer.cpp
  13. 8
      src/Magnum/Platform/EmscriptenApplication.cpp
  14. 28
      src/Magnum/Platform/EmscriptenApplication.h
  15. 2
      src/Magnum/Platform/Sdl2Application.cpp
  16. 14
      src/Magnum/Platform/Sdl2Application.h
  17. 28
      src/Magnum/Platform/Test/EmscriptenApplicationTest.cpp
  18. 4
      src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp
  19. 12
      src/Magnum/Platform/WindowlessEglApplication.cpp
  20. 16
      src/Magnum/Platform/gl-info.cpp

11
src/Magnum/DebugTools/BufferData.cpp

@ -25,20 +25,11 @@
DEALINGS IN THE SOFTWARE.
*/
/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version
3.1.4 moved them to a version header and version 3.1.23 dropped the
backwards compatibility. To work consistently on all versions, including the
header only if the version macros aren't present.
https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a
https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */
#include <Corrade/configure.h>
#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__)
#include <emscripten/version.h>
#endif
/* Don't compile this file on Emscripten < 2.0.17. Because it's easier to do
that here than through CMake. */
#if !defined(__EMSCRIPTEN_major__) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20017
#if !defined(__EMSCRIPTEN_MAJOR__) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20017
#include "BufferData.h"
#include <Corrade/Containers/Array.h>

13
src/Magnum/DebugTools/BufferData.h

@ -27,24 +27,15 @@
DEALINGS IN THE SOFTWARE.
*/
#if defined(MAGNUM_TARGET_GL) && !(defined(MAGNUM_TARGET_WEBGL) && (defined(MAGNUM_TARGET_GLES2) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ < 20017))
#if defined(MAGNUM_TARGET_GL) && !(defined(MAGNUM_TARGET_WEBGL) && (defined(MAGNUM_TARGET_GLES2) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ < 20017))
/** @file
* @brief Function @ref Magnum::DebugTools::bufferData(), @ref Magnum::DebugTools::bufferSubData()
*/
#endif
#include "Magnum/configure.h"
/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version
3.1.4 moved them to a version header and version 3.1.23 dropped the
backwards compatibility. To work consistently on all versions, including the
header only if the version macros aren't present.
https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a
https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */
#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__)
#include <emscripten/version.h>
#endif
#if defined(MAGNUM_TARGET_GL) && !(defined(MAGNUM_TARGET_WEBGL) && (defined(MAGNUM_TARGET_GLES2) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ < 20017))
#if defined(MAGNUM_TARGET_GL) && !(defined(MAGNUM_TARGET_WEBGL) && (defined(MAGNUM_TARGET_GLES2) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ < 20017))
#include <Corrade/Containers/Containers.h>
#include "Magnum/Magnum.h"

6
src/Magnum/GL/Buffer.cpp

@ -394,7 +394,7 @@ Int Buffer::size() {
return size;
}
#if !defined(MAGNUM_TARGET_GLES) || (defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2) && __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20017)
#if !defined(MAGNUM_TARGET_GLES) || (defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2) && __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20017)
Containers::Array<char> Buffer::data() {
return subData(0, size());
}
@ -437,7 +437,7 @@ Buffer& Buffer::flushMappedRange(const GLintptr offset, const GLsizeiptr length)
bool Buffer::unmap() { return Context::current().state().buffer.unmapImplementation(*this); }
#endif
#if !defined(MAGNUM_TARGET_GLES) || (defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2) && __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20017)
#if !defined(MAGNUM_TARGET_GLES) || (defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2) && __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20017)
Containers::Array<char> Buffer::subData(const GLintptr offset, const GLsizeiptr size) {
Containers::Array<char> data{NoInit, std::size_t(size)};
if(size)
@ -545,7 +545,7 @@ void Buffer::getParameterImplementationDSA(Buffer& self, const GLenum value, GLi
}
#endif
#if !defined(MAGNUM_TARGET_GLES) || (defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2) && __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20017)
#if !defined(MAGNUM_TARGET_GLES) || (defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2) && __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20017)
void Buffer::getSubDataImplementationDefault(Buffer& self, const GLintptr offset, const GLsizeiptr size, GLvoid* const data) {
glGetBufferSubData(GLenum(self.bindSomewhereInternal(self._targetHint)), offset, size, data);
}

14
src/Magnum/GL/Buffer.h

@ -42,16 +42,6 @@
#include "Magnum/GL/AbstractObject.h"
#include "Magnum/GL/GL.h"
/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version
3.1.4 moved them to a version header and version 3.1.23 dropped the
backwards compatibility. To work consistently on all versions, including the
header only if the version macros aren't present.
https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a
https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */
#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__)
#include <emscripten/version.h>
#endif
#ifdef MAGNUM_BUILD_DEPRECATED
/* For label() / setLabel(), which used to be a std::string. Not ideal for the
return type, but at least something. */
@ -1171,7 +1161,7 @@ class MAGNUM_GL_EXPORT Buffer: public AbstractObject {
*/
Int size();
#if !defined(MAGNUM_TARGET_GLES) || (defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2) && __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20017)
#if !defined(MAGNUM_TARGET_GLES) || (defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2) && __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20017)
/**
* @brief Buffer data
*
@ -1447,7 +1437,7 @@ class MAGNUM_GL_EXPORT Buffer: public AbstractObject {
static void MAGNUM_GL_LOCAL getParameterImplementationDSA(Buffer& self, GLenum value, GLint* data);
#endif
#if !defined(MAGNUM_TARGET_GLES) || (defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2) && __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20017)
#if !defined(MAGNUM_TARGET_GLES) || (defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2) && __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20017)
static void MAGNUM_GL_LOCAL getSubDataImplementationDefault(Buffer& self, GLintptr offset, GLsizeiptr size, GLvoid* data);
#endif
#ifndef MAGNUM_TARGET_GLES

2
src/Magnum/GL/Implementation/BufferState.cpp

@ -157,7 +157,7 @@ BufferState::BufferState(Context& context, Containers::StaticArrayView<Implement
storageImplementation = &Buffer::storageImplementationDefault;
#endif
getParameterImplementation = &Buffer::getParameterImplementationDefault;
#if !defined(MAGNUM_TARGET_GLES) || (defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2) && __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20017)
#if !defined(MAGNUM_TARGET_GLES) || (defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2) && __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20017)
getSubDataImplementation = &Buffer::getSubDataImplementationDefault;
#endif
dataImplementation = &Buffer::dataImplementationDefault;

12
src/Magnum/GL/Implementation/BufferState.h

@ -29,16 +29,6 @@
#include "Magnum/GL/Buffer.h"
/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version
3.1.4 moved them to a version header and version 3.1.23 dropped the
backwards compatibility. To work consistently on all versions, including the
header only if the version macros aren't present.
https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a
https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */
#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__)
#include <emscripten/version.h>
#endif
namespace Magnum { namespace GL { namespace Implementation {
struct BufferState {
@ -73,7 +63,7 @@ struct BufferState {
void(*storageImplementation)(Buffer&, Containers::ArrayView<const void>, Buffer::StorageFlags);
#endif
void(*getParameterImplementation)(Buffer&, GLenum, GLint*);
#if !defined(MAGNUM_TARGET_GLES) || (defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2) && __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20017)
#if !defined(MAGNUM_TARGET_GLES) || (defined(MAGNUM_TARGET_WEBGL) && !defined(MAGNUM_TARGET_GLES2) && __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20017)
void(*getSubDataImplementation)(Buffer&, GLintptr, GLsizeiptr, GLvoid*);
#endif
void(*dataImplementation)(Buffer&, GLsizeiptr, const GLvoid*, BufferUsage);

22
src/Magnum/GL/Implementation/MeshState.cpp

@ -34,16 +34,6 @@
#include "State.h"
/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version
3.1.4 moved them to a version header and version 3.1.23 dropped the
backwards compatibility. To work consistently on all versions, including the
header only if the version macros aren't present.
https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a
https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */
#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__)
#include <emscripten/version.h>
#endif
namespace Magnum { namespace GL { namespace Implementation {
using namespace Containers::Literals;
@ -192,7 +182,7 @@ MeshState::MeshState(Context& context, ContextState& contextState, Containers::S
/* The WEBGL extension uses the same entrypoints as the ANGLE extension
it was based on, so it's the same as above. Only available since
1.39.15: https://github.com/emscripten-core/emscripten/pull/11054 */
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 13915
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 13915
drawElementsBaseVertexImplementation = Mesh::drawElementsBaseVertexImplementationANGLE;
drawRangeElementsBaseVertexImplementation = Mesh::drawRangeElementsBaseVertexImplementationANGLE;
drawElementsInstancedBaseVertexImplementation = Mesh::drawElementsInstancedBaseVertexImplementationANGLE;
@ -242,7 +232,7 @@ MeshState::MeshState(Context& context, ContextState& contextState, Containers::S
/* The WEBGL extension uses the same entrypoints as the ANGLE extension
it was based on. Only available since 1.39.15:
https://github.com/emscripten-core/emscripten/pull/11054 */
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 13915
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 13915
drawArraysInstancedBaseInstanceImplementation = glDrawArraysInstancedBaseInstanceANGLE;
/* This variant isn't in the ext, emulated using
glDrawElementsInstancedBaseVertexBaseInstanceANGLE */
@ -297,7 +287,7 @@ MeshState::MeshState(Context& context, ContextState& contextState, Containers::S
/* The WEBGL extension uses the same entrypoints as the ANGLE
extension it was based on. Only available since 2.0.0:
https://github.com/emscripten-core/emscripten/pull/11650 */
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20000
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20000
multiDrawArraysImplementation = glMultiDrawArraysANGLE;
multiDrawElementsImplementation = glMultiDrawElementsANGLE;
#else
@ -351,7 +341,7 @@ MeshState::MeshState(Context& context, ContextState& contextState, Containers::S
/* The WEBGL extension uses the same entrypoints as the ANGLE
extension it was based on, so it's the same as above. Only
available since 2.0.5: https://github.com/emscripten-core/emscripten/pull/12282 */
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20005
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20005
multiDrawElementsBaseVertexImplementation = Mesh::multiDrawElementsBaseVertexImplementationANGLE;
#else
/* In Context::setupDriverWorkarounds() we make sure the extension
@ -386,7 +376,7 @@ MeshState::MeshState(Context& context, ContextState& contextState, Containers::S
/* The WEBGL extension uses the same entrypoints as the ANGLE
extension it was based on. Only available since 2.0.0:
https://github.com/emscripten-core/emscripten/pull/11650 */
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20000
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20000
multiDrawArraysInstancedImplementation = glMultiDrawArraysInstancedANGLE;
multiDrawElementsInstancedImplementation = glMultiDrawElementsInstancedANGLE;
#else
@ -417,7 +407,7 @@ MeshState::MeshState(Context& context, ContextState& contextState, Containers::S
/* The WEBGL extension uses the same entrypoints as the ANGLE
extension it was based on. Only available since 2.0.0:
https://github.com/emscripten-core/emscripten/pull/11650 */
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20000
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20000
multiDrawArraysInstancedBaseInstanceImplementation = glMultiDrawArraysInstancedBaseInstanceANGLE;
multiDrawElementsInstancedBaseVertexBaseInstanceImplementation = glMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE;
#else

12
src/Magnum/GL/Implementation/RendererState.cpp

@ -32,16 +32,6 @@
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version
3.1.4 moved them to a version header and version 3.1.23 dropped the
backwards compatibility. To work consistently on all versions, including the
header only if the version macros aren't present.
https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a
https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */
#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__)
#include <emscripten/version.h>
#endif
namespace Magnum { namespace GL { namespace Implementation {
using namespace Containers::Literals;
@ -240,7 +230,7 @@ RendererState::RendererState(Context& context, ContextState& contextState, Conta
Extensions::ANGLE::polygon_mode::string();
polygonModeImplementation = glPolygonModeANGLE;
} else
#elif __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 30166
#elif __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 30166
if(context.isExtensionSupported<Extensions::WEBGL::polygon_mode>()) {
extensions[Extensions::WEBGL::polygon_mode::Index] =
Extensions::WEBGL::polygon_mode::string();

13
src/Magnum/GL/Implementation/driverSpecific.cpp

@ -34,11 +34,6 @@
#include "Magnum/Math/Range.h"
#if defined(MAGNUM_TARGET_WEBGL) && defined(CORRADE_TARGET_EMSCRIPTEN)
/* Including any Emscripten header should also make __EMSCRIPTEN_major__ etc
macros available, independently of whether they're passed implicitly (before
version 3.1.23) or taken from a version header (after version 3.1.4).
https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a
https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */
#include <emscripten/emscripten.h>
#include <emscripten/html5.h>
#endif
@ -797,7 +792,7 @@ void Context::setupDriverWorkarounds() {
2.0.0: https://github.com/emscripten-core/emscripten/pull/11650
However, the extension is advertised even on older versions and we have
no way to link to those entrypoints there. */
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ < 20000
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ < 20000
_setRequiredVersion(WEBGL::multi_draw, None);
#endif
/* EXT_clip_control, EXT_polygon_offset_clamp and WEBGL_polygon_mode
@ -805,7 +800,7 @@ void Context::setupDriverWorkarounds() {
https://github.com/emscripten-core/emscripten/pull/20841
However, the extension is advertised even on older versions and we have
no way to link to those entrypoints there. */
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ < 30166
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ < 30166
_setRequiredVersion(EXT::clip_control, None);
_setRequiredVersion(EXT::polygon_offset_clamp, None);
_setRequiredVersion(WEBGL::polygon_mode, None);
@ -813,12 +808,12 @@ void Context::setupDriverWorkarounds() {
#ifndef MAGNUM_TARGET_GLES2
/* WEBGL_multi_draw_instanced_base_vertex_base_instance only since
Emscripten 2.0.5: https://github.com/emscripten-core/emscripten/pull/12282 */
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ < 20005
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ < 20005
_setRequiredVersion(WEBGL::multi_draw_instanced_base_vertex_base_instance, None);
#endif
/* WEBGL_draw_instanced_base_vertex_base_instance only since Emscripten
1.39.15: https://github.com/emscripten-core/emscripten/pull/11054 */
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ < 13915
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ < 13915
_setRequiredVersion(WEBGL::draw_instanced_base_vertex_base_instance, None);
#endif
#endif

10
src/Magnum/GL/Mesh.cpp

@ -1436,7 +1436,7 @@ void Mesh::unbindImplementationVAO(Mesh&) {}
#ifdef MAGNUM_TARGET_GLES
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
#if !defined(MAGNUM_TARGET_GLES2) && (!defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 13915)
#if !defined(MAGNUM_TARGET_GLES2) && (!defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 13915)
void Mesh::drawElementsBaseVertexImplementationANGLE(GLenum mode, GLsizei count, GLenum type, const void* indices, GLint baseVertex) {
glDrawElementsInstancedBaseVertexBaseInstanceANGLE(mode, count, type, indices, 1, baseVertex, 0);
}
@ -1448,7 +1448,7 @@ void Mesh::drawElementsBaseVertexImplementationAssert(GLenum, GLsizei, GLenum, c
#endif
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 13915
#if !defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 13915
void Mesh::drawRangeElementsBaseVertexImplementationANGLE(const GLenum mode, GLuint, GLuint, GLsizei count, GLenum type, const void* indices, GLint baseVertex) {
glDrawElementsInstancedBaseVertexBaseInstanceANGLE(mode, count, type, indices, 1, baseVertex, 0);
}
@ -1462,7 +1462,7 @@ void Mesh::drawArraysInstancedBaseInstanceImplementationAssert(GLenum, GLint, GL
CORRADE_ASSERT_UNREACHABLE("GL::AbstractShaderProgram::draw(): no extension available for instanced mesh draw with base instance specification", );
}
#if !defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 13915
#if !defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 13915
void Mesh::drawElementsInstancedBaseInstanceImplementationANGLE(const GLenum mode, const GLsizei count, const GLenum type, const void* const indices, const GLsizei instanceCount, const GLuint baseInstance) {
glDrawElementsInstancedBaseVertexBaseInstanceANGLE(mode, count, type, indices, instanceCount, 0, baseInstance);
}
@ -1476,7 +1476,7 @@ void Mesh::drawElementsInstancedBaseVertexBaseInstanceImplementationAssert(GLenu
CORRADE_ASSERT_UNREACHABLE("GL::AbstractShaderProgram::draw(): no extension available for instanced indexed mesh draw with base vertex and base instance specification", );
}
#if !defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 13915
#if !defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 13915
void Mesh::drawElementsInstancedBaseVertexImplementationANGLE(GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei instanceCount, GLint baseVertex) {
glDrawElementsInstancedBaseVertexBaseInstanceANGLE(mode, count, type, indices, instanceCount, baseVertex, 0);
}
@ -1489,7 +1489,7 @@ void Mesh::drawElementsInstancedBaseVertexImplementationAssert(GLenum, GLsizei,
#endif
#ifdef MAGNUM_TARGET_GLES
#if !defined(MAGNUM_TARGET_GLES2) && (!defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20005)
#if !defined(MAGNUM_TARGET_GLES2) && (!defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20005)
void Mesh::multiDrawElementsBaseVertexImplementationANGLE(const GLenum mode, const GLsizei* const count, const GLenum type, const void* const* const indices, const GLsizei drawCount, const GLint* const baseVertex) {
/** @todo merge with the allocation in multiDrawImplementationDefault */
Containers::ArrayView<GLsizei> instanceCount;

20
src/Magnum/GL/Mesh.h

@ -39,16 +39,6 @@
#include "Magnum/GL/Buffer.h"
#include "Magnum/GL/GL.h"
/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version
3.1.4 moved them to a version header and version 3.1.23 dropped the
backwards compatibility. To work consistently on all versions, including the
header only if the version macros aren't present.
https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a
https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */
#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__)
#include <emscripten/version.h>
#endif
#ifdef MAGNUM_BUILD_DEPRECATED
/* For label() / setLabel(), which used to be a std::string. Not ideal for the
return type, but at least something. */
@ -1391,28 +1381,28 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject {
#ifdef MAGNUM_TARGET_GLES
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
#if !defined(MAGNUM_TARGET_GLES2) && (!defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 13915)
#if !defined(MAGNUM_TARGET_GLES2) && (!defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 13915)
static void MAGNUM_GL_LOCAL drawElementsBaseVertexImplementationANGLE(GLenum mode, GLsizei count, GLenum type, const void* indices, GLint baseVertex);
#endif
static void MAGNUM_GL_LOCAL drawElementsBaseVertexImplementationAssert(GLenum, GLsizei, GLenum, const void*, GLint);
#endif
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 13915
#if !defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 13915
static void MAGNUM_GL_LOCAL drawRangeElementsBaseVertexImplementationANGLE(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void* indices, GLint baseVertex);
#endif
static void MAGNUM_GL_LOCAL drawRangeElementsBaseVertexImplementationAssert(GLenum, GLuint, GLuint, GLsizei, GLenum, const void*, GLint);
static void MAGNUM_GL_LOCAL drawArraysInstancedBaseInstanceImplementationAssert(GLenum, GLint, GLsizei, GLsizei, GLuint);
#if !defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 13915
#if !defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 13915
static void MAGNUM_GL_LOCAL drawElementsInstancedBaseInstanceImplementationANGLE(GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei instanceCount, GLuint baseInstance);
#endif
static void MAGNUM_GL_LOCAL drawElementsInstancedBaseInstanceImplementationAssert(GLenum, GLsizei, GLenum, const void*, GLsizei, GLuint);
static void MAGNUM_GL_LOCAL drawElementsInstancedBaseVertexBaseInstanceImplementationAssert(GLenum, GLsizei, GLenum, const void*, GLsizei, GLint, GLuint);
#if !defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 13915
#if !defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 13915
static void MAGNUM_GL_LOCAL drawElementsInstancedBaseVertexImplementationANGLE(GLenum mode, GLsizei count, GLenum type, const void* indices, GLsizei instanceCount, GLint baseVertex);
#endif
static void MAGNUM_GL_LOCAL drawElementsInstancedBaseVertexImplementationAssert(GLenum, GLsizei, GLenum, const void*, GLsizei, GLint);
@ -1420,7 +1410,7 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject {
#endif
#ifdef MAGNUM_TARGET_GLES
#if !defined(MAGNUM_TARGET_GLES2) && (!defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20005)
#if !defined(MAGNUM_TARGET_GLES2) && (!defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20005)
static MAGNUM_GL_LOCAL void multiDrawElementsBaseVertexImplementationANGLE(GLenum mode, const GLsizei* count, GLenum type, const void* const* indices, GLsizei drawCount, const GLint* baseVertex);
#endif
static MAGNUM_GL_LOCAL void multiDrawElementsBaseVertexImplementationAssert(GLenum, const GLsizei*, GLenum, const void* const*, GLsizei, const GLint*);

12
src/Magnum/GL/Renderer.cpp

@ -34,16 +34,6 @@
#include "Magnum/GL/Implementation/State.h"
#include "Magnum/GL/Implementation/RendererState.h"
/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version
3.1.4 moved them to a version header and version 3.1.23 dropped the
backwards compatibility. To work consistently on all versions, including the
header only if the version macros aren't present.
https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a
https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */
#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__)
#include <emscripten/version.h>
#endif
namespace Magnum { namespace GL {
Range1D Renderer::lineWidthRange() {
@ -343,7 +333,7 @@ void Renderer::depthRangefImplementationDefault(const Float near, const Float fa
void Renderer::setClipControl(const ClipOrigin origin, const ClipDepth depth) {
#ifndef MAGNUM_TARGET_GLES
glClipControl(GLenum(origin), GLenum(depth));
#elif !defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 30166
#elif !defined(MAGNUM_TARGET_WEBGL) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 30166
glClipControlEXT(GLenum(origin), GLenum(depth));
#else
static_cast<void>(origin);

8
src/Magnum/Platform/EmscriptenApplication.cpp

@ -667,7 +667,7 @@ void EmscriptenApplication::setupCallbacks(bool resizable) {
[](int, const EmscriptenMouseEvent* event, void* userData) -> EM_BOOL {
auto& app = *static_cast<EmscriptenApplication*>(userData);
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027
/* If the event timestamp is the same (bit-exact, in fact) as the
timestamp of the last touch event, it's a compatibility mouse
event. Ignore. On Chrome at least, the mouseup will have the
@ -707,7 +707,7 @@ void EmscriptenApplication::setupCallbacks(bool resizable) {
[](int, const EmscriptenMouseEvent* event, void* userData) -> EM_BOOL {
auto& app = *static_cast<EmscriptenApplication*>(userData);
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027
/* If the event timestamp is the same (bit-exact, in fact) as the
timestamp of the last touch event, it's a compatibility mouse
event. Ignore. On Chrome at least, the mouseup will have the
@ -763,7 +763,7 @@ void EmscriptenApplication::setupCallbacks(bool resizable) {
return e.isAccepted();
}));
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027
/* Touch events are available on older Emscripten as well, but the events
don't expose the timestamp field, which is *essential* for ignoring
compatibility mouse events synthesized from touch. Favoring correctness
@ -1110,7 +1110,7 @@ void EmscriptenApplication::pointerReleaseEvent(PointerEvent& event) {
MouseEvent mouseEvent{event.event<EmscriptenMouseEvent>()};
mouseReleaseEvent(mouseEvent);
} else {
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027
/* Clear the recorded timestap of the last touch end event, which then
makes the compatibility mouse events go through */
_lastTouchEventTimestamp = Constantsd::nan();

28
src/Magnum/Platform/EmscriptenApplication.h

@ -58,16 +58,6 @@
#endif
#if defined(CORRADE_TARGET_EMSCRIPTEN) || defined(DOXYGEN_GENERATING_OUTPUT)
/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version
3.1.4 moved them to a version header and version 3.1.23 dropped the
backwards compatibility. To work consistently on all versions, including the
header only if the version macros aren't present.
https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a
https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */
#ifndef __EMSCRIPTEN_major__
#include <emscripten/version.h>
#endif
#ifndef DOXYGEN_GENERATING_OUTPUT
struct EmscriptenFocusEvent;
struct EmscriptenKeyboardEvent;
@ -78,9 +68,9 @@ struct EmscriptenUiEvent;
/* The typedef changed in 3.1.49, https://github.com/emscripten-core/emscripten/commit/40cbc2164400a7c27218b9655f1830bfc882bb01,
and then again in 3.1.54, https://github.com/emscripten-core/emscripten/commit/38f9ad86a18ccc3aad911a13ffd5b89d3df304ae */
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 30154
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 30154
typedef std::uintptr_t EMSCRIPTEN_WEBGL_CONTEXT_HANDLE;
#elif __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 30149
#elif __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 30149
typedef std::intptr_t EMSCRIPTEN_WEBGL_CONTEXT_HANDLE;
#else
typedef int EMSCRIPTEN_WEBGL_CONTEXT_HANDLE;
@ -1147,7 +1137,7 @@ class EmscriptenApplication {
Vector2 _previousMouseMovePosition{Constants::nan()};
Vector2 _lastKnownDevicePixelRatio;
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027
/* We have no way to query previous touch positions, so we have to
maintain them like this. The id is ~Int{} if given slot is unused,
32 is what EmscriptenTouchEvent uses for the touch list. */
@ -1437,7 +1427,7 @@ enum class EmscriptenApplication::PointerEventSource: UnsignedByte {
*/
Mouse,
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027 || defined(DOXYGEN_GENERATING_OUTPUT)
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027 || defined(DOXYGEN_GENERATING_OUTPUT)
/**
* The event is coming from a touch contact
* @note Available since Emscripten 2.0.27.
@ -1487,7 +1477,7 @@ enum class EmscriptenApplication::Pointer: UnsignedByte {
*/
MouseButton5 = 1 << 4,
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027 || defined(DOXYGEN_GENERATING_OUTPUT)
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027 || defined(DOXYGEN_GENERATING_OUTPUT)
/**
* Finger
* @note Available since Emscripten 2.0.27.
@ -2199,7 +2189,7 @@ class EmscriptenApplication::PointerEvent: public InputEvent {
friend EmscriptenApplication;
explicit PointerEvent(const EmscriptenMouseEvent& event, Pointer pointer, EmscriptenApplication::Modifiers modifiers, const Vector2& position): _event{&event}, _source{PointerEventSource::Mouse}, _primary{true}, _pointer{pointer}, _modifiers{modifiers}, _id{~Int{}}, _position{position} {}
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027
explicit PointerEvent(const EmscriptenTouchEvent& event, bool primary, Int id, EmscriptenApplication::Modifiers modifiers, const Vector2& position): _event{&event}, _source{PointerEventSource::Touch}, _primary{primary}, _pointer{Pointer::Finger}, _modifiers{modifiers}, _id{id}, _position{position} {}
#endif
@ -2220,7 +2210,7 @@ template<> inline const EmscriptenMouseEvent& EmscriptenApplication::PointerEven
return *static_cast<const EmscriptenMouseEvent*>(_event);
}
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027
template<> inline const EmscriptenTouchEvent& EmscriptenApplication::PointerEvent::event<EmscriptenTouchEvent>() const {
CORRADE_ASSERT(_source == PointerEventSource::Touch,
"Platform::EmscriptenApplication::PointerEvent::event(): not a touch event",
@ -2385,7 +2375,7 @@ class EmscriptenApplication::PointerMoveEvent: public InputEvent {
friend EmscriptenApplication;
explicit PointerMoveEvent(const EmscriptenMouseEvent& event, Containers::Optional<Pointer> pointer, Pointers pointers, EmscriptenApplication::Modifiers modifiers, const Vector2& position, const Vector2& relativePosition): _event{&event}, _source{PointerEventSource::Mouse}, _primary{true}, _pointer{pointer}, _pointers{pointers}, _modifiers{modifiers}, _id{~Int{}}, _position{position}, _relativePosition{relativePosition} {}
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027
explicit PointerMoveEvent(const EmscriptenTouchEvent& event, bool primary, Int id, EmscriptenApplication::Modifiers modifiers, const Vector2& position, const Vector2& relativePosition): _event{&event}, _source{PointerEventSource::Touch}, _primary{primary}, _pointer{}, _pointers{Pointer::Finger}, _modifiers{modifiers}, _id{id}, _position{position}, _relativePosition{relativePosition} {}
#endif
@ -2408,7 +2398,7 @@ template<> inline const EmscriptenMouseEvent& EmscriptenApplication::PointerMove
return *static_cast<const EmscriptenMouseEvent*>(_event);
}
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027
template<> inline const EmscriptenTouchEvent& EmscriptenApplication::PointerMoveEvent::event<EmscriptenTouchEvent>() const {
CORRADE_ASSERT(_source == PointerEventSource::Touch,
"Platform::EmscriptenApplication::PointerEvent::event(): not a touch event",

2
src/Magnum/Platform/Sdl2Application.cpp

@ -132,7 +132,7 @@ Containers::StringView Sdl2Application::scanCodeName(const UnsignedInt scanCode)
#endif
/* https://github.com/emscripten-core/emscripten/pull/18060 */
#if !defined(CORRADE_TARGET_EMSCRIPTEN) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 30125
#if !defined(CORRADE_TARGET_EMSCRIPTEN) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 30125
Containers::Optional<UnsignedInt> Sdl2Application::keyToScanCode(const Key key) {
static_assert(SDL_SCANCODE_UNKNOWN == 0, "assumed SDL_SCANCODE_UNKNOWN to be 0");
if(const SDL_Scancode scanCode = SDL_GetScancodeFromKey(SDL_Keycode(key)))

14
src/Magnum/Platform/Sdl2Application.h

@ -86,18 +86,6 @@
#include <Corrade/Containers/StringStl.h>
#endif
#if defined(CORRADE_TARGET_EMSCRIPTEN) || defined(DOXYGEN_GENERATING_OUTPUT)
/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version
3.1.4 moved them to a version header and version 3.1.23 dropped the
backwards compatibility. To work consistently on all versions, including the
header only if the version macros aren't present.
https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a
https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */
#ifndef __EMSCRIPTEN_major__
#include <emscripten/version.h>
#endif
#endif
#ifndef DOXYGEN_GENERATING_OUTPUT
union SDL_Event; /* for anyEvent() */
#endif
@ -627,7 +615,7 @@ class Sdl2Application {
static Containers::StringView scanCodeName(UnsignedInt scanCode);
#endif
#if !defined(CORRADE_TARGET_EMSCRIPTEN) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 30125
#if !defined(CORRADE_TARGET_EMSCRIPTEN) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 30125
/**
* @brief Scan code for given key
* @m_since_latest

28
src/Magnum/Platform/Test/EmscriptenApplicationTest.cpp

@ -36,16 +36,6 @@
#include "Magnum/Math/Color.h"
#include "Magnum/Math/ConfigurationValue.h"
/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version
3.1.4 moved them to a version header and version 3.1.23 dropped the
backwards compatibility. To work consistently on all versions, including the
header only if the version macros aren't present.
https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a
https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */
#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__)
#include <emscripten/version.h>
#endif
namespace Magnum { namespace Platform {
/* These cannot be in an anonymous namespace as enumSetDebugOutput() below
@ -76,7 +66,7 @@ static Debug& operator<<(Debug& debug, Application::Pointer value) {
_c(MouseRight)
_c(MouseButton4)
_c(MouseButton5)
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027
_c(Finger)
#endif
#undef _c
@ -111,7 +101,7 @@ static Debug& operator<<(Debug& debug, Application::PointerEventSource value) {
switch(value) {
#define _c(value) case Application::PointerEventSource::value: return debug << "::" #value;
_c(Mouse)
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027
_c(Touch)
#endif
#undef _c
@ -136,7 +126,7 @@ Debug& operator<<(Debug& debug, Application::Pointers value) {
Application::Pointer::MouseRight,
Application::Pointer::MouseButton4,
Application::Pointer::MouseButton5,
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027
Application::Pointer::Finger,
#endif
});
@ -328,7 +318,7 @@ struct EmscriptenApplicationTest: Platform::Application {
#if 1
void pointerPressEvent(PointerEvent& event) override {
Debug{} << "pointer press:" << event.source() << event.pointer() << (event.isPrimary() ? "primary" : "secondary") << event.id() << event.modifiers() << Debug::packed << event.position()
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027
/* Just to verify the access works for both cases */
<< (event.source() == PointerEventSource::Mouse ?
event.event<EmscriptenMouseEvent>().timestamp :
@ -338,7 +328,7 @@ struct EmscriptenApplicationTest: Platform::Application {
}
void pointerReleaseEvent(PointerEvent& event) override {
Debug{} << "pointer release:" << event.source() << event.pointer() << (event.isPrimary() ? "primary" : "secondary") << event.id() << event.modifiers() << Debug::packed << event.position()
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027
/* Just to verify the access works for both cases */
<< (event.source() == PointerEventSource::Mouse ?
event.event<EmscriptenMouseEvent>().timestamp :
@ -348,7 +338,7 @@ struct EmscriptenApplicationTest: Platform::Application {
}
void pointerMoveEvent(PointerMoveEvent& event) override {
Debug{} << "pointer move:" << event.source() << event.pointer() << event.pointers() << (event.isPrimary() ? "primary" : "secondary") << event.id() << event.modifiers() << Debug::packed << event.position() << Debug::packed << event.relativePosition()
#if __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 20027
#if __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 20027
/* Just to verify the access works for both cases */
<< (event.source() == PointerEventSource::Mouse ?
event.event<EmscriptenMouseEvent>().timestamp :
@ -434,9 +424,9 @@ EmscriptenApplicationTest::EmscriptenApplicationTest(const Arguments& arguments)
/* Useful for bisecting Emscripten regressions, because they happen WAY TOO
OFTEN!!! */
Debug{} << "Emscripten version:"
<< __EMSCRIPTEN_major__ << Debug::nospace << "." << Debug::nospace
<< __EMSCRIPTEN_minor__ << Debug::nospace << "." << Debug::nospace
<< __EMSCRIPTEN_tiny__ << Debug::nospace;
<< __EMSCRIPTEN_MAJOR__ << Debug::nospace << "." << Debug::nospace
<< __EMSCRIPTEN_MINOR__ << Debug::nospace << "." << Debug::nospace
<< __EMSCRIPTEN_TINY__ << Debug::nospace;
if(args.isSet("exit-immediately")) {
exit();

4
src/Magnum/Platform/Test/Sdl2ApplicationTest.cpp

@ -390,7 +390,7 @@ struct Sdl2ApplicationTest: Platform::Application {
<< event.scanCodeName()
#endif
<< event.modifiers()
#if !defined(CORRADE_TARGET_EMSCRIPTEN) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 30125
#if !defined(CORRADE_TARGET_EMSCRIPTEN) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 30125
<< "converted:"
#ifndef CORRADE_TARGET_EMSCRIPTEN
<< scanCodeToKey(event.scanCode())
@ -469,7 +469,7 @@ struct Sdl2ApplicationTest: Platform::Application {
<< event.scanCodeName()
#endif
<< event.modifiers()
#if !defined(CORRADE_TARGET_EMSCRIPTEN) || __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ >= 30125
#if !defined(CORRADE_TARGET_EMSCRIPTEN) || __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ >= 30125
<< "converted:"
#ifndef CORRADE_TARGET_EMSCRIPTEN
<< scanCodeToKey(event.scanCode())

12
src/Magnum/Platform/WindowlessEglApplication.cpp

@ -38,16 +38,6 @@
#include "Implementation/Egl.h"
/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version
3.1.4 moved them to a version header and version 3.1.23 dropped the
backwards compatibility. To work consistently on all versions, including the
header only if the version macros aren't present.
https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a
https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */
#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__)
#include <emscripten/version.h>
#endif
/* ANGLE's EGL on Windows needs an actual window */
/** @todo investigate if this is still needed */
#ifdef CORRADE_TARGET_WINDOWS
@ -369,7 +359,7 @@ WindowlessEglContext::WindowlessEglContext(const Configuration& configuration, G
EGLint attributes[7] = {
EGL_CONTEXT_CLIENT_VERSION,
#ifdef MAGNUM_TARGET_GLES
#if defined(MAGNUM_TARGET_GLES2) || (defined(CORRADE_TARGET_EMSCRIPTEN) && __EMSCRIPTEN_major__*10000 + __EMSCRIPTEN_minor__*100 + __EMSCRIPTEN_tiny__ < 13824)
#if defined(MAGNUM_TARGET_GLES2) || (defined(CORRADE_TARGET_EMSCRIPTEN) && __EMSCRIPTEN_MAJOR__*10000 + __EMSCRIPTEN_MINOR__*100 + __EMSCRIPTEN_TINY__ < 13824)
/* Emscripten before 1.38.24 doesn't know about version 3 for WebGL
2 and the whole thing is controlled by -s USE_WEBGL2=1 flag
anyway, so it doesn't matter that we ask for ES2 on WebGL 2 as

16
src/Magnum/Platform/gl-info.cpp

@ -74,16 +74,6 @@
#error no windowless application available on this platform
#endif
/* The __EMSCRIPTEN_major__ etc macros used to be passed implicitly, version
3.1.4 moved them to a version header and version 3.1.23 dropped the
backwards compatibility. To work consistently on all versions, including the
header only if the version macros aren't present.
https://github.com/emscripten-core/emscripten/commit/f99af02045357d3d8b12e63793cef36dfde4530a
https://github.com/emscripten-core/emscripten/commit/f76ddc702e4956aeedb658c49790cc352f892e4c */
#if defined(CORRADE_TARGET_EMSCRIPTEN) && !defined(__EMSCRIPTEN_major__)
#include <emscripten/version.h>
#endif
namespace Magnum { namespace {
/** @page magnum-gl-info Magnum GL Info
@ -279,9 +269,9 @@ GLInfo::GLInfo(const Arguments& arguments): Platform::WindowlessApplication{argu
#endif
#ifdef CORRADE_TARGET_EMSCRIPTEN
Debug{} << " CORRADE_TARGET_EMSCRIPTEN (" << Debug::nospace
<< __EMSCRIPTEN_major__ << Debug::nospace << "." << Debug::nospace
<< __EMSCRIPTEN_minor__ << Debug::nospace << "." << Debug::nospace
<< __EMSCRIPTEN_tiny__ << Debug::nospace << ")";
<< __EMSCRIPTEN_MAJOR__ << Debug::nospace << "." << Debug::nospace
<< __EMSCRIPTEN_MINOR__ << Debug::nospace << "." << Debug::nospace
<< __EMSCRIPTEN_TINY__ << Debug::nospace << ")";
#endif
#ifdef CORRADE_TARGET_ANDROID
Debug{} << " CORRADE_TARGET_ANDROID";

Loading…
Cancel
Save