Browse Source

Merge pull request #2 from mosra/master

create pull request
pull/187/head
MiUishadow 10 years ago committed by GitHub
parent
commit
4a0b7131d3
  1. 107
      CMakeLists.txt
  2. 5
      CREDITS.md
  3. 22
      README.md
  4. 132
      doc/building.dox
  5. 32
      doc/cmake.dox
  6. 5
      doc/generated/hello.cpp
  7. 1
      doc/generated/shaders.cpp
  8. 50
      doc/getting-started.dox
  9. 6
      doc/mainpage.dox
  10. 4
      doc/openal-support.dox
  11. 13
      doc/opengl-mapping.dox
  12. 12
      doc/opengl-support.dox
  13. 71
      doc/platform.dox
  14. 4
      doc/plugins.dox
  15. 4
      doc/types.dox
  16. 2
      doc/utilities.dox
  17. 71
      modules/FindCorrade.cmake
  18. 106
      modules/FindMagnum.cmake
  19. 137
      modules/FindOpenAL.cmake
  20. 12
      modules/FindSDL2.cmake
  21. 2
      package/archlinux/PKGBUILD
  22. 3
      package/archlinux/PKGBUILD-android-arm
  23. 3
      package/archlinux/PKGBUILD-android-x86
  24. 2
      package/archlinux/PKGBUILD-clang
  25. 2
      package/archlinux/PKGBUILD-clang-libc++
  26. 19
      package/archlinux/PKGBUILD-emscripten
  27. 18
      package/archlinux/PKGBUILD-emscripten-webgl2
  28. 5
      package/archlinux/PKGBUILD-es2
  29. 2
      package/archlinux/PKGBUILD-es2desktop
  30. 5
      package/archlinux/PKGBUILD-es3
  31. 2
      package/archlinux/PKGBUILD-es3desktop
  32. 2
      package/archlinux/PKGBUILD-gcc47
  33. 4
      package/archlinux/PKGBUILD-mingw-w64
  34. 4
      package/archlinux/PKGBUILD-release
  35. 4
      package/archlinux/magnum-git/PKGBUILD
  36. 48
      package/ci/appveyor-desktop-gles.bat
  37. 46
      package/ci/appveyor-desktop-mingw.bat
  38. 45
      package/ci/appveyor-desktop.bat
  39. 76
      package/ci/appveyor-rt.bat
  40. 77
      package/ci/appveyor.yml
  41. 9
      package/ci/jenkins.xml
  42. 60
      package/ci/travis-android-arm.sh
  43. 43
      package/ci/travis-desktop-gles.sh
  44. 40
      package/ci/travis-desktop.sh
  45. 62
      package/ci/travis-emscripten.sh
  46. 65
      package/ci/travis-ios-simulator.sh
  47. 124
      package/ci/travis.yml
  48. 2
      package/debian/copyright
  49. 4
      package/debian/rules
  50. 2
      package/gentoo/dev-libs/magnum/magnum-9999.ebuild
  51. 2
      package/homebrew/magnum.rb
  52. 2
      src/CMakeLists.txt
  53. 178
      src/Magnum/AbstractFramebuffer.cpp
  54. 326
      src/Magnum/AbstractFramebuffer.h
  55. 14
      src/Magnum/AbstractObject.cpp
  56. 10
      src/Magnum/AbstractQuery.cpp
  57. 10
      src/Magnum/AbstractQuery.h
  58. 39
      src/Magnum/AbstractShaderProgram.cpp
  59. 17
      src/Magnum/AbstractShaderProgram.h
  60. 20
      src/Magnum/AbstractTexture.cpp
  61. 1
      src/Magnum/AbstractTexture.h
  62. 62
      src/Magnum/Attribute.cpp
  63. 4
      src/Magnum/Attribute.h
  64. 5
      src/Magnum/Audio/AbstractImporter.h
  65. 11
      src/Magnum/Audio/Audio.cpp
  66. 31
      src/Magnum/Audio/Buffer.cpp
  67. 137
      src/Magnum/Audio/Buffer.h
  68. 22
      src/Magnum/Audio/CMakeLists.txt
  69. 39
      src/Magnum/Audio/Context.cpp
  70. 58
      src/Magnum/Audio/Context.h
  71. 3
      src/Magnum/Audio/Extensions.h
  72. 18
      src/Magnum/Audio/MacOSXBundleInfo.plist.in
  73. 8
      src/Magnum/Audio/Renderer.cpp
  74. 4
      src/Magnum/Audio/Source.cpp
  75. 29
      src/Magnum/Audio/Test/BufferALTest.cpp
  76. 4
      src/Magnum/Audio/Test/BufferTest.cpp
  77. 23
      src/Magnum/Audio/Test/CMakeLists.txt
  78. 60
      src/Magnum/Audio/Test/ContextALTest.cpp
  79. 28
      src/Magnum/Audio/Test/ContextTest.cpp
  80. 35
      src/Magnum/Audio/Test/ListenerALTest.cpp
  81. 27
      src/Magnum/Audio/Test/PlayableALTest.cpp
  82. 110
      src/Magnum/Audio/Test/RendererALTest.cpp
  83. 78
      src/Magnum/Audio/Test/RendererTest.cpp
  84. 173
      src/Magnum/Audio/Test/SourceALTest.cpp
  85. 129
      src/Magnum/Audio/Test/SourceTest.cpp
  86. 2
      src/Magnum/Audio/Test/configure.h.cmake
  87. 112
      src/Magnum/Audio/magnum-al-info.cpp
  88. 21
      src/Magnum/Buffer.cpp
  89. 20
      src/Magnum/Buffer.h
  90. 4
      src/Magnum/BufferImage.h
  91. 4
      src/Magnum/CMakeLists.txt
  92. 59
      src/Magnum/Context.cpp
  93. 11
      src/Magnum/Context.h
  94. 45
      src/Magnum/DebugOutput.cpp
  95. 12
      src/Magnum/DebugOutput.h
  96. 12
      src/Magnum/DebugTools/Test/ForceRendererTest.cpp
  97. 4
      src/Magnum/DefaultFramebuffer.cpp
  98. 4
      src/Magnum/DimensionTraits.h
  99. 3
      src/Magnum/Extensions.h
  100. 6
      src/Magnum/Framebuffer.cpp
  101. Some files were not shown because too many files have changed in this diff Show More

107
CMakeLists.txt

@ -59,12 +59,15 @@ if(CORRADE_TARGET_UNIX OR CORRADE_TARGET_NACL OR CORRADE_TARGET_WINDOWS)
option(WITH_MAGNUMINFO "Build magnum-info utility" OFF)
endif()
# Utilities (currently only using GLX, CGL or WGL)
# Desktop-only utilities
if(CORRADE_TARGET_UNIX OR CORRADE_TARGET_WINDOWS)
cmake_dependent_option(WITH_FONTCONVERTER "Build magnum-fontconverter utility" OFF "NOT TARGET_GLES" OFF)
cmake_dependent_option(WITH_DISTANCEFIELDCONVERTER "Build magnum-distancefieldconverter utility" OFF "NOT TARGET_GLES" OFF)
endif()
# API-independent utilities
option(WITH_IMAGECONVERTER "Build magnum-imageconverter utility" OFF)
# Plugins
option(WITH_WAVAUDIOIMPORTER "Build WavAudioImporter plugin" OFF)
option(WITH_MAGNUMFONT "Build MagnumFont plugin" OFF)
@ -84,6 +87,9 @@ cmake_dependent_option(WITH_SHADERS "Build Shaders library" ON "NOT WITH_DEBUGTO
cmake_dependent_option(WITH_TEXT "Build Text library" ON "NOT WITH_MAGNUMFONT;NOT WITH_MAGNUMFONTCONVERTER" ON)
cmake_dependent_option(WITH_TEXTURETOOLS "Build TextureTools library" ON "NOT WITH_TEXT;NOT WITH_DISTANCEFIELDCONVERTER" ON)
# Magnum AL Info
cmake_dependent_option(WITH_AL_INFO "Build magnum-al-info utility" OFF "WITH_AUDIO" OFF)
# EGL context and windowless EGL application, available everywhere except on
# platforms which don't support extension loading
if(NOT CORRADE_TARGET_EMSCRIPTEN AND NOT CORRADE_TARGET_NACL)
@ -118,7 +124,7 @@ elseif(CORRADE_TARGET_UNIX)
# Windows-specific application libraries
elseif(CORRADE_TARGET_WINDOWS)
if(NOT TARGET_GLES)
if(NOT TARGET_GLES OR TARGET_DESKTOP_GLES)
cmake_dependent_option(WITH_WINDOWLESSWGLAPPLICATION "Build WindowlessWglApplication library" OFF "NOT WITH_MAGNUMINFO;NOT WITH_FONTCONVERTER;NOT WITH_DISTANCEFIELDCONVERTER" ON)
option(WITH_WGLCONTEXT "Build WglContext library" OFF)
else()
@ -138,23 +144,23 @@ if(BUILD_DEPRECATED)
set(MAGNUM_BUILD_DEPRECATED 1)
endif()
option(BUILD_MULTITHREADED "Build in a way that makes it possible to use multiple thread-local Magnum contexts" ON)
if(BUILD_MULTITHREADED)
set(MAGNUM_BUILD_MULTITHREADED 1)
endif()
option(BUILD_STATIC "Build static libraries (default are shared)" OFF)
option(BUILD_STATIC_PIC "Build static libraries and plugins with position-independent code" ON)
option(BUILD_PLUGINS_STATIC "Build static plugins (default are dynamic)" OFF)
option(BUILD_TESTS "Build unit tests" OFF)
cmake_dependent_option(BUILD_GL_TESTS "Build unit tests for OpenGL code" OFF "BUILD_TESTS" OFF)
cmake_dependent_option(BUILD_AL_TESTS "Build unit tests for OpenAL code" ON "BUILD_TESTS;WITH_AUDIO" OFF)
if(BUILD_TESTS)
find_package(Corrade REQUIRED TestSuite)
enable_testing()
endif()
# Check compiler compatibility
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7.0")
message(FATAL_ERROR "Compatibility branch of Magnum is needed for use with GCC < 4.7. See the documentation for more information.")
elseif(MSVC)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.0")
message(FATAL_ERROR "Compatibility branch of Magnum is needed for use with MSVC < 2015. See the documentation for more information.")
if(CORRADE_TARGET_IOS)
set(CORRADE_TESTSUITE_BUNDLE_IDENTIFIER_PREFIX "cz.mosra.magnum")
endif()
enable_testing()
endif()
# If targeting NaCl, set explicit OpenGL ES 2.0 support. For Android and
@ -204,6 +210,10 @@ if(TARGET_HEADLESS)
set(MAGNUM_TARGET_HEADLESS 1)
endif()
if(CORRADE_TARGET_EMSCRIPTEN)
include(UseEmscripten)
endif()
if(BUILD_GL_TESTS)
if(MAGNUM_TARGET_HEADLESS)
set(WITH_WINDOWLESSEGLAPPLICATION ON)
@ -214,9 +224,14 @@ if(BUILD_GL_TESTS)
elseif(CORRADE_TARGET_APPLE)
set(WITH_WINDOWLESSCGLAPPLICATION ON)
set(GL_TEST_LIBRARIES Magnum MagnumWindowlessCglApplication)
elseif(CORRADE_TARGET_UNIX AND (NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES))
set(WITH_WINDOWLESSGLXAPPLICATION ON)
set(GL_TEST_LIBRARIES Magnum MagnumWindowlessGlxApplication)
elseif(CORRADE_TARGET_UNIX)
if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES)
set(WITH_WINDOWLESSEGLAPPLICATION ON)
set(GL_TEST_LIBRARIES Magnum MagnumWindowlessEglApplication)
else()
set(WITH_WINDOWLESSGLXAPPLICATION ON)
set(GL_TEST_LIBRARIES Magnum MagnumWindowlessGlxApplication)
endif()
elseif(CORRADE_TARGET_WINDOWS)
if(NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES)
set(WITH_WINDOWLESSWGLAPPLICATION ON)
@ -247,27 +262,57 @@ set(MAGNUM_EXTERNAL_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumEx
set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumPlugins)
# Separate install dirs for debug and release plugins
set(MAGNUM_PLUGINS_DEBUG_INSTALL_DIR ${MAGNUM_LIBRARY_INSTALL_DIR}/magnum-d)
set(MAGNUM_PLUGINS_RELEASE_INSTALL_DIR ${MAGNUM_LIBRARY_INSTALL_DIR}/magnum)
# Plugin installation dirs based on wheter we are in debug or release build,
# needed by some command-line tools
set(MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_BINARY_INSTALL_DIR}/magnum-d)
set(MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_LIBRARY_INSTALL_DIR}/magnum-d)
set(MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_BINARY_INSTALL_DIR}/magnum)
set(MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_LIBRARY_INSTALL_DIR}/magnum)
set(MAGNUM_PLUGINS_FONT_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/fonts)
set(MAGNUM_PLUGINS_FONT_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/fonts)
set(MAGNUM_PLUGINS_FONT_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/fonts)
set(MAGNUM_PLUGINS_FONT_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/fonts)
set(MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/fontconverters)
set(MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/fontconverters)
set(MAGNUM_PLUGINS_FONTCONVERTER_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/fontconverters)
set(MAGNUM_PLUGINS_FONTCONVERTER_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/fontconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMPORTER_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/importers)
set(MAGNUM_PLUGINS_IMPORTER_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/importers)
set(MAGNUM_PLUGINS_IMPORTER_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/importers)
set(MAGNUM_PLUGINS_IMPORTER_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/importers)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/audioimporters)
# Plugin dirs based on wheter we are in debug or release build, needed by some
# command-line tools
if(CORRADE_TARGET_WINDOWS)
set(MAGNUM_PLUGINS_DEBUG_DIR_INIT ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR})
set(MAGNUM_PLUGINS_RELEASE_DIR_INIT ${MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR})
else()
set(MAGNUM_PLUGINS_DEBUG_DIR_INIT ${MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR})
set(MAGNUM_PLUGINS_RELEASE_DIR_INIT ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR})
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(MAGNUM_PLUGINS_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR})
set(MAGNUM_PLUGINS_DIR_INIT ${MAGNUM_PLUGINS_DEBUG_DIR_INIT})
else()
set(MAGNUM_PLUGINS_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR})
set(MAGNUM_PLUGINS_DIR_INIT ${MAGNUM_PLUGINS_RELEASE_DIR_INIT})
endif()
set(MAGNUM_PLUGINS_FONT_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/fonts)
set(MAGNUM_PLUGINS_FONT_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/fonts)
set(MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/fontconverters)
set(MAGNUM_PLUGINS_FONTCONVERTER_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/fontconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMPORTER_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/importers)
set(MAGNUM_PLUGINS_IMPORTER_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/importers)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/audioimporters)
# Make these paths configurable from outside. This is *not* PATH, because CMake
# always converts the path to an absolute location internally, making it
# impossible to specify relative paths there. Sorry in advance for not having
# the dir selection button in CMake GUI.
set(MAGNUM_PLUGINS_DEBUG_DIR ${MAGNUM_PLUGINS_DEBUG_DIR_INIT}
CACHE STRING "Base directory where to look for Magnum plugins for debug builds")
set(MAGNUM_PLUGINS_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR_INIT}
CACHE STRING "Base directory where to look for Magnum plugins for release builds")
set(MAGNUM_PLUGINS_DIR ${MAGNUM_PLUGINS_DIR_INIT}
CACHE STRING "Base directory where to look for Magnum plugins")
add_subdirectory(modules)
add_subdirectory(src)

5
CREDITS.md

@ -35,5 +35,10 @@ Contributors to Magnum library
enhancements, GlfwApplication implementation, bug reports, documentation
improvements
* Gerhard de Clercq -- Windows RT (Store/Phone) port
* Ashwin Ravichandran ([@](ashrko619)[https://github.com/ashrko619]) --
Bézier curve implementation
* Alice Margatroid ([@Alicemargatroid](https://github.com/Alicemargatroid)) --
Multi-channel support in Audio library, standard conformance, float,
double, A-Law and μ-Law format support in `WavAudioImporter` plugin
Big thanks to everyone involved!

22
README.md

@ -53,15 +53,15 @@ Graphics APIs:
Platforms:
* **Linux** and embedded Linux (natively using GLX/EGL and Xlib or through
SDL2 or GLUT toolkit) [![Build Status](https://travis-ci.org/mosra/magnum.svg?branch=master)](https://travis-ci.org/mosra/magnum)
* **Windows** natively or using ANGLE (through SDL2 or GLUT toolkit) [![Build status](https://ci.appveyor.com/api/projects/status/5b477m034cfaskse/branch/master?svg=true)](https://ci.appveyor.com/project/mosra/magnum/branch/master)
* **OS X** (through SDL2 toolkit) [![Build Status](https://travis-ci.org/mosra/magnum.svg?branch=master)](https://travis-ci.org/mosra/magnum)
* **iOS** (through SDL2 toolkit)
* **Android** 2.3 (API Level 9) and higher
* **Windows RT** (Store/Phone) using ANGLE (through SDL2 toolkit)
SDL2, GLFW or GLUT toolkit) [![Build Status](https://travis-ci.org/mosra/magnum.svg?branch=master)](https://travis-ci.org/mosra/magnum) [![Coverage Status](https://coveralls.io/repos/github/mosra/magnum/badge.svg?branch=master)](https://coveralls.io/github/mosra/magnum?branch=master)
* **Windows** on both MSVC and MinGW, natively or using ANGLE (through SDL2, GLFW or GLUT toolkit) [![Build Status](https://ci.appveyor.com/api/projects/status/5b477m034cfaskse/branch/master?svg=true)](https://ci.appveyor.com/project/mosra/magnum/branch/master)
* **OS X** (through SDL2 or GLFW toolkit) [![Build Status](https://travis-ci.org/mosra/magnum.svg?branch=master)](https://travis-ci.org/mosra/magnum)
* **iOS** (through SDL2 toolkit) [![Build Status](https://travis-ci.org/mosra/magnum.svg?branch=master)](https://travis-ci.org/mosra/magnum)
* **Android** 2.3 (API Level 9) and higher [![Build Status](https://travis-ci.org/mosra/magnum.svg?branch=master)](https://travis-ci.org/mosra/magnum)
* **Windows RT** (Store/Phone) using ANGLE (through SDL2 toolkit) [![Build Status](https://ci.appveyor.com/api/projects/status/5b477m034cfaskse/branch/master?svg=true)](https://ci.appveyor.com/project/mosra/magnum/branch/master)
* **Google Chrome** (through [Native Client](https://developers.google.com/native-client/),
both `newlib` and `glibc` toolchains are supported)
* **HTML5/JavaScript** (through [Emscripten](https://github.com/kripken/emscripten/wiki))
* **HTML5/JavaScript** (through [Emscripten](https://github.com/kripken/emscripten/wiki)) [![Build Status](https://travis-ci.org/mosra/magnum.svg?branch=master)](https://travis-ci.org/mosra/magnum)
FEATURES
========
@ -89,11 +89,9 @@ comprehensive guide for building, packaging and crosscompiling.
Minimal dependencies
--------------------
- C++ compiler with good C++11 support. Compilers which are tested to have
everything needed are **GCC** >= 4.7, **Clang** >= 3.1 and **MSVC** 2015.
On Windows you can also use **MinGW-w64**. GCC 4.6, 4.5, 4.4 and MSVC 2013
support involves some ugly workarounds and thus is available only in
`compatibility` branch.
* C++ compiler with good C++11 support. Compilers which are tested to have
everything needed are **GCC** >= 4.7, **Clang** >= 3.1 and **MSVC** >= 2015.
On Windows you can also use **MinGW-w64**.
* **CMake** >= 2.8.12
* **Corrade** - Plugin management and utility library. You can get it at
https://github.com/mosra/corrade.

132
doc/building.dox

@ -33,10 +33,8 @@ namespace Magnum {
Minimal set of tools and libraries required for building is:
- C++ compiler with good C++11 support. Compilers which are tested to have
everything needed are **GCC** >= 4.7, **Clang** >= 3.1 and **MSVC** 2015.
On Windows you can also use **MinGW-w64**. GCC 4.6, 4.5, 4.4 and MSVC 2013
support involves some ugly workarounds and thus is available only in
`compatibility` branch.
everything needed are **GCC** >= 4.7, **Clang** >= 3.1 and **MSVC** >= 2015.
On Windows you can also use **MinGW-w64**.
- **CMake** >= 2.8.12
- **Corrade** - Plugin management and utility library. See
@ref building-corrade "Corrade download and installation guide" for more
@ -52,12 +50,6 @@ compressed archive or use the command line:
git clone git://github.com/mosra/magnum.git
If you need to use the `compatibility` branch, check it out as following from
the cloned repository or download the particular archive from
https://github.com/mosra/magnum/tree/compatibility.
git checkout compatibility
@section building-compilation Compilation, installation
Relevant information about CMake usage was described in
@ -103,8 +95,7 @@ value to that directory (e.g. `-DCMAKE_INSTALL_PREFIX=C:/Sys`).
@subsubsection building-windows-msvc Using Visual Studio
On Windows CMake by default creates Visual Studio project files. You need to
use `compatibility` branch to compile with MSVC 2013, as said above.
On Windows CMake by default creates Visual Studio project files.
The most straightforward way to build and install the library is again via the
command-line. The bonus point is that you don't even need to wait for Visual
@ -166,13 +157,19 @@ available for desktop OpenGL only, see @ref requires-gl.
- `TARGET_GLES2` -- Target OpenGL ES 2.0. Currently enabled by default when
`TARGET_GLES` is set.
- `TARGET_DESKTOP_GLES` -- Target OpenGL ES on desktop, i.e. use OpenGL ES
emulation in desktop OpenGL library. Might not be supported in all drivers.
emulation in desktop OpenGL library. Available on Linux and Windows, though
might not be supported by all drivers.
- `TARGET_HEADLESS` -- Build command-line utilities for use on a headless
machine. Basically it means that EGL with no display attachment is being
used everywhere instead of platform-specific toolkits like CGL, GLX or WGL.
Supported mainly on OpenGL ES drivers, for desktop OpenGL the only driver
that supports this configuration is NVidia >= 355.
By default the engine is built in a way that allows having multiple
thread-local Magnum contents. This might cause some performance penalties -- if
you are sure that you will never need such feature, you can disable it via the
`BUILD_MULTITHREADED` option.
The features used can be conveniently detected in depending projects both in
CMake and C++ sources, see @ref cmake and @ref Magnum/Magnum.h for more
information. See also @ref corrade-cmake and @ref Corrade/Corrade.h for
@ -229,17 +226,31 @@ information):
- `WITH_GLXCONTEXT` -- GLX context
- `WITH_WGLCONTEXT` -- WGL context
There are also a few command-line utilities. They are currently available only
on Linux, Mac OS X and Windows, also disabled by default:
There are also a few command-line utilities, also disabled by default:
- `WITH_MAGNUMINFO` - @ref magnum-info "magnum-info" executable, provides
information about the engine and OpenGL capabilities.
information about the engine and OpenGL capabilities. Depends on some
windowless application library.
- `WITH_AL_INFO` -- @ref magnum-al-info "magnum-al-info" executable, provides
information about OpenAL capabilities.
- `WITH_DISTANCEFIELDCONVERTER` - @ref magnum-distancefieldconverter "magnum-distancefieldconverter"
executable for converting black&white images to distance field textures.
Enables also building of TextureTools library.
Enables also building of @ref TextureTools library. Available only on
desktop GL, depends on some windowless application library.
- `WITH_FONTCONVERTER` - @ref magnum-fontconverter "magnum-fontconverter"
executable for converting fonts to raster ones. Enables also building of
Text library.
@ref Text library. Available only on desktop GL, depends on some windowless
application library.
- `WITH_IMAGECONVERTER` - @ref magnum-imageconverter "magnum-imageconverter"
executable for converting images of different formats.
Some of these utilities operate with plugins and they search for them in the
default plugin locations. You can override those locations using
`MAGNUM_PLUGINS_DIR` and `MAGNUM_PLUGINS_[DEBUG|RELEASE]_DIR` variables, much
like when using Magnum from dependent projects -- see @ref cmake for more
information. In particular, if you specify them as relative paths, the path
will be taken relative to executable location, which is useful for making
relocatable installations.
Magnum also contains a set of dependency-less plugins for importing essential
file formats. Additional plugins are provided in separate plugin repository,
@ -277,9 +288,25 @@ in build directory. On Windows the tests require the library to be installed
with DLLs accessible through `PATH`. See
@ref building-windows "above Windows documentation" for more information.
Platforms which have windowless context creation implemented (currently only
desktop Linux) can build also tests for OpenGL functionality. You can enable
them with `BUILD_GL_TESTS`.
The @ref Audio library has tests which require OpenAL to be able to create a
context. That is the case on most platforms, so they are enabled by default.
In case it's not possible to have OpenAL context (such as when running
@ref CORRADE_TARGET_EMSCRIPTEN "Emscripten" tests under Node.js), you can
disable building of them with `BUILD_AL_TESTS`. The tests are suffixed with
`ALTest` so they can be also selectively included/excluded when running CTest,
e.g.:
ctest -E ALTest # run everything except tests requiring OpenAL context
Platforms which have windowless GL context creation implemented (currently all
platforms except @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten",
@ref CORRADE_TARGET_NACL "NaCl", @ref CORRADE_TARGET_WINDOWS_RT "Windows RT"
and @ref CORRADE_TARGET_ANDROID "Android") can build also tests for OpenGL
functionality. You can enable them with `BUILD_GL_TESTS`. All GL tests are
suffixed with `GLTest` so they can be also selectively included/excluded when
running CTest, e.g.:
ctest -R GLTest # run only tests requiring OpenGL context
@subsection building-doc Building documentation
@ -378,8 +405,9 @@ contents in `toolchains/` subdirectory.
git submodule update
Note that CMake for some reason treats `CMAKE_PREFIX_PATH` and
`CMAKE_INSTALL_PREFIX` differently while crosscompiling and you may need to set
also `CMAKE_FIND_ROOT_PATH` to make it able to find the dependencies.
`CMAKE_INSTALL_PREFIX` differently while crosscompiling and you may need to add
dependency paths to both `CMAKE_PREFIX_PATH` and `CMAKE_FIND_ROOT_PATH` to make
it able to find the dependencies.
@subsection building-cross-winrt Crosscompiling for Windows RT
@ -390,15 +418,23 @@ installation path for WinRT dependencies is in `C:/Sys-winrt`.
You need at least Windows 8.1, Visual Studio 2013 and Windows 8.1 Store/Phone
SDK installed. Windows RT applications support OpenGL only through ANGLE, which
is currently limited to OpenGL ES. Download and build ANGLE @ref building-windows-angle "according to instructions above",
but use project files from the `winrt/` directory instead. Upcoming version
2.0.4 of SDL has support for WinRT applications, download the source from
https://www.libsdl.org/hg.php and use project files from the `VisualC-WinRT`
directory. Because WinRT applications run in a sandbox, it's recommended to
build the library as static so you don't have to bundle all the DLLs. Example:
but use project files from the `winrt/` directory instead. Version 2.0.4 of SDL
has support for WinRT applications, download the source from
https://www.libsdl.org/download-2.0.php and use project files from the
`VisualC-WinRT` directory. Because WinRT applications run in a sandbox, it's
recommended to build the library as static so you don't have to bundle all the
DLLs. Example:
mkdir build-winrt
cd build-winrt
cmake -DCORRADE_RC_EXECUTABLE="C:/Sys/bin/corrade-rc.exe" -DCMAKE_INSTALL_PREFIX="C:/Sys-winrt" -DBUILD_STATIC=ON -DWITH_SDL2APPLICATION=ON -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=8.1 -G "Visual Studio 14 2015" ..
cmake .. ^
-DCMAKE_SYSTEM_NAME=WindowsStore ^
-DCMAKE_SYSTEM_VERSION=10 ^
-DCORRADE_RC_EXECUTABLE="C:/Sys/bin/corrade-rc.exe" ^
-DCMAKE_INSTALL_PREFIX="C:/Sys-winrt" ^
-DBUILD_STATIC=ON ^
-DWITH_SDL2APPLICATION=ON ^
-G "Visual Studio 14 2015" ..
cmake --build .
Change `WindowsStore` to `WindowsPhone` if you want to build for Windows Phone
@ -455,9 +491,7 @@ to find the compiler. NaCl currently supports only OpenGL ES 2, thus
`TARGET_GLES` and `TARGET_GLES2` is always enabled.
Then create build directories for x86-32 and x86-64 and run cmake and build
command in them. The toolchains need access to the platform file, so be sure to
properly set **absolute** path to `modules/` directory containing
`Platform/NaCl.cmake`. Also adapt `CMAKE_INSTALL_PREFIX` to the same value as
command in them. Be sure to adapt `CMAKE_INSTALL_PREFIX` to the same value as
in `NACL_PREFIX` in toolchain file and specify path where Corrade is installed
in `CMAKE_PREFIX_PATH`.
@ -501,10 +535,8 @@ to path where Emscripten is installed. Default is `/usr/lib/emscripten`.
Emscripten supports dynamic libraries only to simplify porting and they are
generally slower, thus `BUILD_STATIC` is implicitly enabled.
Then create build directory and run cmake and build command in it. The
toolchain needs access to its platform file, so be sure to properly set **absolute**
path to `modules/` directory containing `Platform/Emscripten.cmake`. Also set
`CMAKE_INSTALL_PREFIX` to path contained in `EMSCRIPTEN_TOOLCHAIN_PATH`.
Then create build directory and run cmake and build command in it. Be sure to
set `CMAKE_INSTALL_PREFIX` to path contained in `EMSCRIPTEN_TOOLCHAIN_PATH`.
WebGL 1.0 (GLES 2.0 equivalent) is enabled by default, switch to 2.0 (GLES 3.0
equivalent) by disabling `TARGET_GLES2`.
@ -536,10 +568,8 @@ building your projects for Emscripten.
You will need OSX and Xcode installed.
Set `CMAKE_OSX_ROOT` to SDK you want to target and enable all desired
architectures in `CMAKE_OSX_ARCHITECTURES`. The toolchain needs access to its
platform file, so be sure to properly set **absolute** path to `modules/`
directory containing `Platform/iOS.cmake`. Set `CMAKE_INSTALL_PREFIX` to prefix
where you store other iOS dependencies such as Corrade or SDL2.
architectures in `CMAKE_OSX_ARCHITECTURES`. Be sure to set `CMAKE_INSTALL_PREFIX`
to prefix where you store other iOS dependencies such as Corrade or SDL2.
As every application is in its own sandbox, it doesn't make sense to build
shared libraries (although it is supported). Enable `BUILD_STATIC` to build
@ -547,6 +577,10 @@ static libraries. You might also have problems using dynamic plugins, enable
`BUILD_PLUGINS_STATIC` to build also plugins as static. OpenGL ES 2.0 is
enabled by default, switch to 3.0 by disabling `TARGET_GLES2`.
Please note that `BUILD_MULTITHREADED` is supported only since Xcode 7.3 and
doesn't work on `i386` iOS Simulator, you need to disable it in order to build
for older platforms.
mkdir build-ios && cd build-ios
cmake .. \
-DCMAKE_TOOLCHAIN_FILE=../toolchains/generic/iOS.cmake \
@ -575,11 +609,9 @@ where NDK is installed. Default is `/opt/android-ndk`. Adapt also
`ANDROID_SYSROOT` to your preferred API level. You might also need to update
`ANDROID_TOOLCHAIN_PREFIX` and `ANDROID_TOOLCHAIN_ROOT` to fit your system.
Then create build directory and run cmake and build command in it. The
toolchain needs access to its platform file, so be sure to properly set **absolute**
path to `modules/` directory containing `Platform/Android.cmake`. Also set
`CMAKE_INSTALL_PREFIX` to `/usr` subdirectory of `ANDROID_SYSROOT` and specify
path where Corrade is installed in `CMAKE_PREFIX_PATH`.
Then create build directory and run cmake and build command in it. Be sure to
set `CMAKE_INSTALL_PREFIX` to `/usr` subdirectory of `ANDROID_SYSROOT` and
specify path where Corrade is installed in `CMAKE_PREFIX_PATH`.
Note that `BUILD_STATIC` is implicitly enabled, because manually loading all
depending shared libraries using JNI would be too inconvenient. The engine is
@ -619,13 +651,15 @@ building your projects for Android.
@subsection building-ci-travis Travis
In `package/ci/` there is `travis.yml` file with Linux GCC 4.7 and OSX Clang
configuration. Online at https://travis-ci.org/mosra/magnum.
In `package/ci/` there is `travis.yml` file with Linux GCC 4.7, OSX Clang, iOS
GLES2/GLES3 and Emscripten WebGL1/WebGL2 configuration. Online at
https://travis-ci.org/mosra/magnum. The Linux build has code coverage reports
available online at https://coveralls.io/github/mosra/magnum.
@subsection building-ci-appveyor AppVeyor
In `package/ci/` there is `appveyor.yml` file with Windows MSVC configuration.
Online at https://ci.appveyor.com/project/mosra/magnum.
In `package/ci/` there is `appveyor.yml` file with Windows desktop MSVC, MinGW
and Windows RT GLES2/GLES3 configuration. Online at https://ci.appveyor.com/project/mosra/magnum.
@subsection building-ci-jenkins Jenkins

32
doc/cmake.dox

@ -27,6 +27,8 @@ namespace Magnum {
/** @page cmake Usage with CMake
@brief Guide how to find and use Magnum with CMake build system
@tableofcontents
Magnum uses CMake build system for both building and integration into your
projects. The logic is in module `FindMagnum.cmake` distributed with the engine
in `modules/` directory, you are encouraged to copy it along with
@ -140,7 +142,9 @@ Lastly, a few utility executables are available:
- `distancefieldconverter` -- @ref magnum-distancefieldconverter executable
- `fontconverter` -- @ref magnum-fontconverter executable
- `imageconverter` -- @ref magnum-imageconverter executable
- `info` -- @ref magnum-info executable
- `al-info` -- @ref magnum-al-info executable
Note that [each namespace](namespaces.html), all @ref Platform libraries and
each plugin class contain more detailed information about dependencies,
@ -180,6 +184,8 @@ are also available as preprocessor variables if including
included
- `MAGNUM_BUILD_STATIC` -- Defined if compiled as static libraries. Default
are shared libraries.
- `MAGNUM_BUILD_MULTITHREADED` -- Defined if compiled in a way that allows
having multiple thread-local Magnum contexts. The default.
- `MAGNUM_TARGET_GLES` -- Defined if compiled for OpenGL ES
- `MAGNUM_TARGET_GLES2` -- Defined if compiled for OpenGL ES 2.0
- `MAGNUM_TARGET_GLES3` -- Defined if compiled for OpenGL ES 3.0
@ -209,5 +215,31 @@ Corrade library provides also its own set of CMake macros and variables, see
@ref cmake-plugins "Plugins repository", @ref cmake-integration "Integration repository"
and @ref cmake-extras "Extras repository" have also their own CMake modules.
@section cmake-modules Other CMake modules
The `modules/` directory contains more useful CMake modules:
- `FindOpenAL.cmake` -- CMake module for finding OpenAL. This is a forked
version of the upstream module that works properly with
@ref CORRADE_TARGET_EMSCRIPTEN "Emscripten". Copy this to your module
directory if you want to use the @ref Audio library on Emscripten.
- `FindGLFW.cmake` -- CMake module for finding GLFW. Copy this to your module
directory if you want to use @ref Platform::GlfwApplication.
- `FindEGL.cmake` -- CMake module for finding EGL. Copy this to your
module directory if you want to target embedded platforms such as
@ref CORRADE_TARGET_IOS "iOS", @ref CORRADE_TARGET_ANDROID "Android",
@ref CORRADE_TARGET_WINDOWS_RT "Windows RT" or
@ref CORRADE_TARGET_EMSCRIPTEN "Emscripten" or if you want to use EGL
instead of GLX/WGL/CGL on a desktop platform.
- `FindOpenGLES2.cmake`, `FindOpenGLES3.cmake` -- CMake module for finding
OpenGL ES 2.0 / 3.0 library. Copy this to your module directory if you want
to target @ref MAGNUM_TARGET_GLES "OpenGL ES".
- `FindSDL2.cmake` -- CMake module for finding SDL 2. Copy this to your
module directory if you want to use @ref Platform::Sdl2Application.
See also relevant section for @ref corrade-cmake-modules "Corrade",
@ref cmake-plugins-modules "Plugins", @ref cmake-integration-modules "Integration"
and @ref cmake-extras-modules "Extras" projects.
*/
}

5
doc/generated/hello.cpp

@ -31,6 +31,7 @@
#include <Magnum/Platform/Sdl2Application.h>
using namespace Magnum;
using namespace Magnum::Math::Literals;
class Hello: public Platform::Application {
public:
@ -42,8 +43,8 @@ private:
Hello::Hello(const Arguments& arguments): Platform::Application(arguments) {
Renderer::setClearColor(Color3::fromHSV(216.0_degf, 0.85f, 1.0f));
Debug() << "Hello! This application is running on" << Context::current()->version()
<< "using" << Context::current()->rendererString();
Debug() << "Hello! This application is running on" << Context::current().version()
<< "using" << Context::current().rendererString();
}
void Hello::drawEvent() {

1
doc/generated/shaders.cpp

@ -67,6 +67,7 @@
#include "configure.h"
using namespace Magnum;
using namespace Magnum::Math::Literals;
struct ShaderVisualizer: Platform::WindowlessApplication {
using Platform::WindowlessApplication::WindowlessApplication;

50
doc/getting-started.dox

@ -59,20 +59,12 @@ dependencies means just cloning them into your project tree:
git clone git://github.com/mosra/corrade.git
git clone git://github.com/mosra/magnum.git
The `master` branch supports GCC 4.7+, Clang and MSVC 2015 compilers, for older
versions you need to use `compatibility` branches, please see
@ref building-corrade "Corrade" and @ref building "Magnum" installation guides
for detailed information. If you are using `compatibility` branch of Magnum and
Corrade, replace `modules/FindCorrade.cmake` from the bootstrap project with
[the one from compatibility branch](https://github.com/mosra/corrade/blob/compatibility/modules/FindCorrade.cmake)
so the compatibility mode gets properly detected and used.
Then open the `CMakeLists.txt` file in the root of bootstrap project and add
these two new subdirectories using `add_subdirectory()` so the file looks like
this:
@code
cmake_minimum_required(VERSION 2.8.9)
cmake_minimum_required(VERSION 2.8.12)
project(MyApplication)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/modules/")
@ -83,7 +75,7 @@ add_subdirectory(src)
@endcode
If you want to install Corrade and Magnum separately instead of cloning them
into your project tree, just follow the installation guides mentioned above.
into your project tree, just follow @ref building "the full installation guide".
Don't forget to enable `WITH_SDL2APPLICATION` (or `WITH_GLUTAPPLICATION`, if
you are using GLUT) when building Magnum so the bootstrap project can use it
later.
@ -110,6 +102,12 @@ standard CMake installation, these aren't part of it and thus must be
distributed with the project. These files are just verbatim copied from Magnum
repository.
@note These modules are just the bare minimum you need for starting. If you
plan to use additional functionality not part of the core library or target
specific platforms, you may need to copy additional modules. See @ref cmake,
@ref cmake-plugins, @ref cmake-integration and @ref cmake-extras for more
information.
Directory `src/` contains the actual project. To keep things simple, the
project consists of just one source file with the most minimal code possible:
@code
@ -163,21 +161,21 @@ In the following tutorials the code will be explained more thoroughly.
In Linux (and other Unix-based OSs) you can build the application along with
the subprojects using the following three commands: create out-of-source build
directory, run cmake, enable SDL2 application in the Magnum subproject and then
build the everything. The compiled application binary will then appear in src/
subdirectory of build dir:
build everything. The compiled application binary will then appear in `src/`
subdirectory of the build dir:
mkdir -p build && cd build
cmake .. -DWITH_SDL2APPLICATION=ON
cmake --build .
./src/MyApplication
On Windows you can use either MSVC or MinGW-w64 compiler. It's then up to you
whether you will use command-line, QtCreator or Visual Studio. With Visual
Studio the most straightforward way to create the project file is via the
command-line:
On Windows you can use either MSVC or MinGW-w64 compiler and prebuilt SDL2
binaries can be downloaded at https://libsdl.org/download-2.0.php. It's then up
to you whether you will use command-line, QtCreator or Visual Studio. With
Visual Studio the most straightforward way to create the project file is via
the command-line:
mkdir build
cd build
mkdir build && cd build
cmake .. -DWITH_SDL2APPLICATION=ON
You can also use CMake GUI. Then open the `MyApplication.sln` project file
@ -188,11 +186,19 @@ where to create build directory, allows you to specify initial CMake parameters
(e.g. the `-DWITH_SDL2APPLICATION=ON` parameter) and then you can just press *Configure*
and everything is ready to be built.
If you have SDL2 in a non-standard location and CMake can't find it, you need
to specify where SDL `include/` and `lib/` directories are through
`CMAKE_PREFIX_PATH`. So, for example, on Windows, the full CMake invocation
might look like this:
cmake .. -DCMAKE_PREFIX_PATH="C:/Users/you/Downloads/SDL2-2.0.4" -DWITH_SDL2APPLICATION=ON
On Windows you may get errors about missing DLLs when running the application.
The solution is either compiling everything as static (enable `BUILD_STATIC`
CMake option) or installing the dependencies somewhere. To install them, change
`CMAKE_INSTALL_PREFIX` to your liking and run the `install` target. Then run
the application with `bin/` subdirectory of installation prefix as working dir.
the application with `bin/` subdirectory of installation prefix as working dir
or add the `bin/` subdirectory to `PATH`.
@image html getting-started.png
@image latex getting-started.png
@ -211,10 +217,12 @@ First include the needed headers:
And in the constructor (which is currently empty) change the clear color and
print something to debug output:
@code
using namespace Magnum::Math::Literals;
Renderer::setClearColor(Color3::fromHSV(216.0_degf, 0.85f, 1.0f));
Debug() << "Hello! This application is running on" << Context::current()->version()
<< "using" << Context::current()->rendererString();
Debug() << "Hello! This application is running on" << Context::current().version()
<< "using" << Context::current().rendererString();
@endcode
After rebuilding and starting the application, the clear color changes to

6
doc/mainpage.dox

@ -77,9 +77,9 @@ Graphics APIs:
Platforms:
- **Linux** and embedded Linux (natively using GLX/EGL and Xlib or through
SDL2 or GLUT toolkit)
- **Windows** natively or using ANGLE (through SDL2 or GLUT toolkit)
- **OS X**, **iOS** (through SDL2 toolkit)
SDL2, GLFW or GLUT toolkit)
- **Windows** using both MSVC and MinGW, natively or using ANGLE (through SDL2, GLFW or GLUT toolkit)
- **OS X**, **iOS** (through SDL2 or GLFW toolkit)
- **Android** 2.3 (API Level 9) and higher
- **Windows RT** (Store/Phone) using ANGLE (through SDL2 toolkit)
- **Google Chrome** (through [Native Client](https://developers.google.com/native-client/),

4
doc/openal-support.dox

@ -38,8 +38,12 @@ functions and enum values are exposed through the API.
Extension | Status
------------------------------------------- | ------
@alc_extension{ENUMERATION,EXT} | done
@al_extension{EXT,double} | done
@al_extension{EXT,float32} | done
@al_extension{EXT,ALAW} | done
@al_extension{EXT,MULAW} | done
@al_extension{EXT,MCFORMATS} | done
@subsection openal-extension-support-soft OpenAL Soft Extensions

13
doc/opengl-mapping.dox

@ -52,7 +52,7 @@ OpenGL function | Matching API
--------------------------------------- | ------------
@fn_gl{BeginConditionalRender}, `glEndConditionalRender()` | @ref SampleQuery::beginConditionalRender(), \n @ref SampleQuery::endConditionalRender()
@fn_gl{BeginQuery}, `glEndQuery()` | @ref PrimitiveQuery::begin(), \n @ref SampleQuery::begin(), \n @ref TimeQuery::begin(), \n @ref AbstractQuery::end()
@fn_gl{BeginQueryIndexed}, `glEndQueryIndexed()` | |
@fn_gl{BeginQueryIndexed}, `glEndQueryIndexed()` | @ref PrimitiveQuery::begin(UnsignedInt), \n @ref PrimitiveQuery::end()
@fn_gl{BeginTransformFeedback}, `glEndTransformFeedback()` | @ref TransformFeedback::begin(), @ref TransformFeedback::end()
@fn_gl{BindAttribLocation} | @ref AbstractShaderProgram::bindAttributeLocation()
@fn_gl{BindBuffer} | not needed, handled internally in @ref Buffer and elsewhere
@ -101,8 +101,8 @@ OpenGL function | Matching API
@fn_gl{CompressedTexSubImage1D}, \n `glCompressedTextureSubImage1D()`, \n @fn_gl_extension{CompressedTextureSubImage1D,EXT,direct_state_access}, \n @fn_gl{CompressedTexSubImage2D}, \n `glCompressedTextureSubImage2D()`, \n @fn_gl_extension{CompressedTextureSubImage2D,EXT,direct_state_access}, \n @fn_gl{CompressedTexSubImage3D}, \n `glCompressedTextureSubImage3D()`, \n @fn_gl_extension{CompressedTextureSubImage3D,EXT,direct_state_access} | @ref Texture::setCompressedSubImage(), \n @ref TextureArray::setCompressedSubImage(), \n @ref CubeMapTexture::setCompressedSubImage(), \n @ref CubeMapTextureArray::setCompressedSubImage(), \n @ref RectangleTexture::setCompressedSubImage()
@fn_gl{CopyBufferSubData}, \n `glCopyNamedBufferSubData()`, \n @fn_gl_extension{NamedCopyBufferSubData,EXT,direct_state_access} | @ref Buffer::copy()
@fn_gl{CopyImageSubData} | |
@fn_gl{CopyTexImage1D}, \n @fn_gl_extension{CopyTextureImage1D,EXT,direct_state_access}, \n @fn_gl{CopyTexImage2D}, \n @fn_gl_extension{CopyTextureImage2D,EXT,direct_state_access} | |
@fn_gl{CopyTexSubImage1D}, \n `glCopyTextureSubImage1D()`, \n @fn_gl_extension{CopyTextureSubImage1D,EXT,direct_state_access}, \n @fn_gl{CopyTexSubImage2D}, \n `glCopyTextureSubImage2D()`, \n @fn_gl_extension{CopyTextureSubImage2D,EXT,direct_state_access}, \n @fn_gl{CopyTexSubImage3D}, \n `glCopyTextureSubImage3D()`, \n @fn_gl_extension{CopyTextureSubImage3D,EXT,direct_state_access} | |
@fn_gl{CopyTexImage1D}, \n @fn_gl{CopyTexImage2D} | @ref Framebuffer::copyImage()
@fn_gl{CopyTexSubImage1D}, \n `glCopyTextureSubImage1D()`, \n @fn_gl_extension{CopyTextureSubImage1D,EXT,direct_state_access}, \n @fn_gl{CopyTexSubImage2D}, \n `glCopyTextureSubImage2D()`, \n @fn_gl_extension{CopyTextureSubImage2D,EXT,direct_state_access}, \n @fn_gl{CopyTexSubImage3D}, \n `glCopyTextureSubImage3D()`, \n @fn_gl_extension{CopyTextureSubImage3D,EXT,direct_state_access} | @ref Framebuffer::copySubImage()
@fn_gl{CreateProgram}, @fn_gl{DeleteProgram} | @ref AbstractShaderProgram constructor and destructor
@fn_gl{CreateShader}, @fn_gl{DeleteShader} | @ref Shader constructor and destructor
@fn_gl{CreateShaderProgram} | |
@ -124,10 +124,10 @@ OpenGL function | Matching API
@fn_gl{DispatchCompute} | @ref AbstractShaderProgram::dispatchCompute()
@fn_gl_extension{DispatchComputeGroupSize,ARB,compute_variable_group_size} | |
@fn_gl{DispatchComputeIndirect} | |
@fn_gl{DrawArrays}, \n @fn_gl{DrawArraysInstanced}, \n @fn_gl{DrawArraysInstancedBaseInstance}, \n @fn_gl{DrawElements}, \n @fn_gl{DrawRangeElements}, \n @fn_gl{DrawElementsBaseVertex}, \n @fn_gl{DrawRangeElementsBaseVertex}, \n @fn_gl{DrawElementsInstanced}, \n @fn_gl{DrawElementsInstancedBaseInstance}, \n @fn_gl{DrawElementsInstancedBaseVertex}, \n @fn_gl{DrawElementsInstancedBaseVertexBaseInstance} | @ref Mesh::draw(), \n @ref MeshView::draw()
@fn_gl{DrawArrays}, \n @fn_gl{DrawArraysInstanced}, \n @fn_gl{DrawArraysInstancedBaseInstance}, \n @fn_gl{DrawElements}, \n @fn_gl{DrawRangeElements}, \n @fn_gl{DrawElementsBaseVertex}, \n @fn_gl{DrawRangeElementsBaseVertex}, \n @fn_gl{DrawElementsInstanced}, \n @fn_gl{DrawElementsInstancedBaseInstance}, \n @fn_gl{DrawElementsInstancedBaseVertex}, \n @fn_gl{DrawElementsInstancedBaseVertexBaseInstance} | @ref Mesh::draw(AbstractShaderProgram&), \n @ref MeshView::draw(AbstractShaderProgram&)
@fn_gl{DrawArraysIndirect}, \n @fn_gl{DrawElementsIndirect}, \n @fn_gl{MultiDrawArraysIndirect}, \n @fn_gl{MultiDrawElementsIndirect} | |
@fn_gl{DrawBuffer}, \n `glNamedFramebufferDrawBuffer()`, \n @fn_gl_extension{FramebufferDrawBuffer,EXT,direct_state_access}, \n @fn_gl{DrawBuffers}, \n `glNamedFramebufferDrawBuffers()`, \n @fn_gl_extension{FramebufferDrawBuffers,EXT,direct_state_access} | @ref DefaultFramebuffer::mapForDraw(), \n @ref Framebuffer::mapForDraw()
@fn_gl{DrawTransformFeedback}, \n @fn_gl{DrawTransformFeedbackInstanced}, \n @fn_gl{DrawTransformFeedbackStream}, \n @fn_gl{DrawTransformFeedbackStreamInstanced} | |
@fn_gl{DrawTransformFeedback}, \n @fn_gl{DrawTransformFeedbackInstanced}, \n @fn_gl{DrawTransformFeedbackStream}, \n @fn_gl{DrawTransformFeedbackStreamInstanced} | @ref Mesh::draw(AbstractShaderProgram&, TransformFeedback&, UnsignedInt), \n @ref MeshView::draw(AbstractShaderProgram&, TransformFeedback&, UnsignedInt)
@subsection opengl-mapping-functions-e E
@ -478,6 +478,7 @@ OpenGL function | Matching API
@def_gl{MAX_VERTEX_ATTRIB_STRIDE} | |
@def_gl{MAX_VERTEX_ATTRIB_BINDINGS} | |
@def_gl{MAX_VERTEX_ATTRIB_RELATIVE_OFFSET} | |
@def_gl{MAX_VERTEX_STREAMS} | @ref TransformFeedback::maxVertexStreams()
@def_gl{MAX_VIEWPORTS} | |
@def_gl{MAX_VIEWPORT_DIMS} | @ref AbstractFramebuffer::maxViewportSize()
@def_gl{MIN_FRAGMENT_INTERPOLATION_OFFSET}, \n @def_gl{MAX_FRAGMENT_INTERPOLATION_OFFSET} | |
@ -488,7 +489,7 @@ OpenGL function | Matching API
@def_gl{NUM_EXTENSIONS} | @ref Context::supportedExtensions()
@def_gl{NUM_PROGRAM_BINARY_FORMATS}, \n @def_gl{PROGRAM_BINARY_FORMATS} | |
@def_gl{NUM_SHADER_BINARY_FORMATS}, \n @def_gl{SHADER_BINARY_FORMATS} | |
@def_gl{PACK_ALIGNMENT}, \n @def_gl{PACK_IMAGE_HEIGHT}, \n @def_gl{PACK_LSB_FIRST}, \n @def_gl{PACK_ROW_LENGTH}, \n @def_gl{PACK_SKIP_IMAGES}, \n @def_gl{PACK_SKIP_PIXELS}, \n @def_gl{PACK_SKIP_ROWS}, \n @def_gl{PACK_SWAP_BYTES}, \n @def_gl{UNPACK_ALIGNMENT}, \n @def_gl{UNPACK_IMAGE_HEIGHT}, \n @def_gl{UNPACK_LSB_FIRST}, \n @def_gl{UNPACK_ROW_LENGTH}, \n @def_gl{UNPACK_SKIP_IMAGES}, \n @def_gl{UNPACK_SKIP_PIXELS}, \n @def_gl{UNPACK_SKIP_ROWS}, \n @def_gl{UNPACK_SWAP_BYTES} | not queryable
@def_gl{PACK_ALIGNMENT}, \n @def_gl{PACK_IMAGE_HEIGHT}, \n @def_gl{PACK_ROW_LENGTH}, \n @def_gl{PACK_SKIP_IMAGES}, \n @def_gl{PACK_SKIP_PIXELS}, \n @def_gl{PACK_SKIP_ROWS}, \n @def_gl{PACK_SWAP_BYTES}, \n @def_gl{UNPACK_ALIGNMENT}, \n @def_gl{UNPACK_IMAGE_HEIGHT}, \n @def_gl{UNPACK_ROW_LENGTH}, \n @def_gl{UNPACK_SKIP_IMAGES}, \n @def_gl{UNPACK_SKIP_PIXELS}, \n @def_gl{UNPACK_SKIP_ROWS}, \n @def_gl{UNPACK_SWAP_BYTES} | not queryable, @ref PixelStorage setters only
@def_gl{POINT_FADE_THRESHOLD_SIZE} | |
@def_gl{POINT_SIZE_GRANULARITY}, \n @def_gl{POINT_SIZE_RANGE} | |
@def_gl{POINT_SIZE} | not queryable, @ref Renderer::setPointSize() setter only

12
doc/opengl-support.dox

@ -40,7 +40,6 @@ The core subset of OpenGL 2.1 should be fully implemented, except for the
following:
- Proxy textures
- Copying framebuffer to texture (@fn_gl{CopyTexImage2D} etc.)
- Some forgotten limit queries
@subsection opengl-support-30 OpenGL 3.0
@ -132,8 +131,8 @@ GLSL 4.00 | done
@extension{ARB,shader_subroutine} | |
@extension{ARB,tessellation_shader} | missing some limit queries and patch parameter specification function
@extension{ARB,texture_buffer_object_rgb32} | done
@extension{ARB,transform_feedback2} | missing transform feedback draw
@extension{ARB,transform_feedback3} | only advanced interleaving
@extension{ARB,transform_feedback2} | done
@extension{ARB,transform_feedback3} | missing indexed properties query
@subsection opengl-support-41 OpenGL 4.1
@ -155,7 +154,7 @@ GLSL 4.20 | done
@extension{ARB,texture_compression_bptc} | done
@extension{ARB,base_instance} | done
@extension{ARB,shading_language_420pack} | done (shading language only)
@extension{ARB,transform_feedback_instanced} | |
@extension{ARB,transform_feedback_instanced} | done
@extension{ARB,compressed_texture_pixel_storage} | done
@extension{ARB,conservative_depth} | done (shading language only)
@extension{ARB,internalformat_query} | |
@ -245,7 +244,7 @@ Extension | Status
@extension{ARB,sparse_texture} | |
@extension{ARB,pipeline_statistics_query} | |
@extension{ARB,sparse_buffer} | |
@extension{ARB,transform_feedback_overflow_query} | |
@extension{ARB,transform_feedback_overflow_query} | done
@extension{KHR,blend_equation_advanced} | done
@extension3{KHR,blend_equation_advanced_coherent,blend_equation_advanced} | done
@extension{KHR,no_error} | done
@ -258,6 +257,7 @@ Extension | Status
Extension | Status
------------------------------------------- | ------
@extension{AMD,transform_feedback3_lines_triangles} | done (nothing to do)
@extension{AMD,vertex_shader_layer} | done (shading language only)
@extension{AMD,shader_trinary_minmax} | done (shading language only)
@extension{ATI,texture_mirror_once} | done (GL 4.4 subset)
@ -323,6 +323,7 @@ Extension | Status
@es_extension{NV,shadow_samplers_cube} | done (shading language only)
@es_extension{OES,depth24} | done
@es_extension{OES,element_index_uint} | done
@es_extension{OES,fbo_render_mipmap} | done
@es_extension{OES,rgb8_rgba8} | done (desktop-compatible subset)
@es_extension{OES,texture_3D} | done
@es_extension2{OES,texture_half_float_linear,OES_texture_float_linear} | done
@ -427,6 +428,7 @@ Extension | Status
@webgl_extension{OES,element_index_uint} | done
@webgl_extension{OES,texture_float_linear} | done
@webgl_extension{OES,texture_half_float_linear} | done
@webgl_extension{OES,fbo_render_mipmap} | done
@webgl_extension{WEBGL,depth_texture} | done
@webgl_extension{WEBGL,draw_buffers} | done

71
doc/platform.dox

@ -284,8 +284,6 @@ int main(int argc, char** argv) {
}
// Delete OpenGL context ...
return 0;
}
@endcode
@ -319,6 +317,75 @@ target_link_libraries(myapplication
Magnum::Context)
@endcode
@section platform-windowless-contexts Manually managing windowless contexts
In case you need to manage windowless OpenGL contexts manually (for example
to use Magnum for data processing in a thread or when having more than one
OpenGL context), there is a possibility to directly use the context wrappers
from windowless applications. Each @ref Platform::WindowlessEglApplication "Platform::Windowless*Application"
is accompanied by a @ref Platform::WindowlessEglContext "Platform::Windowless*Context"
class that manages just GL context creation, making it current and destruction.
Similarly to using custom platform toolkits above, the workflow is to first
create a GL context instance, then making it current and finally instantiating
the @ref Platform::Context instance to initialize Magnum.
Similarly as with the applications, to simplify the porting, the library
provides `Platform::WindowlessGLContext` typedef, but only if just one
windowless application header is included.
@attention With this approach it is possible to switch between different GL
contexts, but make sure that Magnum is used only with its OpenGL context.
@code
int main(int argc, char** argv) {
Platform::WindowlessGLContext glContext{{}};
glContext.makeCurrent();
Platform::Context context{argc, argv};
// Your GL code ...
// Make another context current
eglMakeCurrent();
// Someone else's code ...
// Make Magnum context current again
glContext.makeCurrent();
// Your GL code again ...
// Magnum context gets destroyed
// Windowless GL context gets destroyed
}
@endcode
The main purpose of windowless contexts is threaded OpenGL, used for example
for background data processing. The workflow is to create the windowless
context on the main thread, but make it current in the worker thread. This way
the main thread state isn't affected so it can have any other GL context
current (for example for the main application rendering). See also
@ref MAGNUM_BUILD_MULTITHREADED.
@note Context creation is not thread safe on all platforms, that's why it still
has to be done on the main thread.
@code
int main() {
Platform::WindowlessGLContext glContext{{}};
std::thread worker{[&glContext]{
glContext.makeCurrent();
Platform::Context context{0, nullptr};
// Use Magnum here ...
}};
// Independent main application code here ...
worker.join();
}
@endcode
- Next page: @ref types
*/
}

4
doc/plugins.dox

@ -179,10 +179,10 @@ usage is basically the same as above, but you need to explicitly find the
plugin and link it into the executable in your `CMakeLists.txt`. See @ref cmake
and @ref cmake-plugins for additional information.
@code
find_package(Magnum REQUIRED TgaImporter)
find_package(MagnumPlugins REQUIRED PngImporter)
add_executable(MyApp ...)
target_link_libraries(MyApp ... Magnum::TgaImporter)
target_link_libraries(MyApp ... MagnumPlugins::PngImporter)
@endcode
The only user-visible behavioral change will be that

4
doc/types.dox

@ -157,6 +157,10 @@ Complex b = Complex::rotation(60.0_degf);
Other types, which don't have their GLSL equivalent, are:
- @ref QuadraticBezier2D or @ref QuadraticBezier2Dd, @ref QuadraticBezier3D
or @ref QuadraticBezier3Dd
- @ref CubicBezier2D or @ref CubicBezier2Dd, @ref CubicBezier3D
or @ref CubicBezier3Dd
- @ref Complex or @ref Complexd, @ref DualComplex or @ref DualComplexd
- @ref Quaternion or @ref Quaterniond, @ref DualQuaternion or
@ref DualQuaterniond

2
doc/utilities.dox

@ -28,8 +28,10 @@ namespace Magnum {
@brief Command-line utilities for system information and data conversion
- @subpage magnum-info -- @copybrief magnum-info
- @subpage magnum-al-info -- @copybrief magnum-al-info
- @subpage magnum-distancefieldconverter -- @copybrief magnum-distancefieldconverter
- @subpage magnum-fontconverter -- @copybrief magnum-fontconverter
- @subpage magnum-imageconverter -- @copybrief magnum-imageconverter
*/
}

71
modules/FindCorrade.cmake

@ -73,7 +73,9 @@
# CORRADE_TARGET_UNIX - Defined if compiled for some Unix flavor
# (Linux, BSD, OS X)
# CORRADE_TARGET_APPLE - Defined if compiled for Apple platforms
# CORRADE_TARGET_IOS - Defined if compiled for iOS
# CORRADE_TARGET_IOS - Defined if compiled for iOS (device or
# simulator)
# CORRADE_TARGET_IOS_SIMULATOR - Defined if compiled for iOS Simulator
# CORRADE_TARGET_WINDOWS - Defined if compiled for Windows
# CORRADE_TARGET_WINDOWS_RT - Defined if compiled for Windows RT
# CORRADE_TARGET_NACL - Defined if compiled for Google Chrome Native
@ -97,6 +99,7 @@
# CORRADE_USE_MODULE - Path to UseCorrade.cmake module (included
# automatically)
# CORRADE_TESTSUITE_XCTEST_RUNNER - Path to XCTestRunner.mm.in file
# CORRADE_TESTSUITE_ADB_RUNNER - Path to AdbRunner.sh file
# CORRADE_PEDANTIC_COMPILER_OPTIONS - List of pedantic compiler options used
# for targets with :prop_tgt:`CORRADE_USE_PEDANTIC_FLAGS` enabled
# CORRADE_PEDANTIC_COMPILER_DEFINITIONS - List of pedantic compiler
@ -120,13 +123,21 @@
#
# corrade_add_test(<test name>
# <sources>...
# [LIBRARIES <libraries>...])
# [LIBRARIES <libraries>...]
# [FILES <files>...])
#
# Test name is also executable name. You can also specify libraries to link
# with instead of using :command:`target_link_libraries()`.
# ``Corrade::TestSuite`` target is linked automatically to each test. Note
# that the :command:`enable_testing()` function must be called explicitly.
#
# You can list files needed by the test in the `FILES` section. The filenames
# are treated relatively to `CMAKE_CURRENT_SOURCE_DIR`. On desktop platforms
# the files are added to the :prop_test:`REQUIRED_FILES` target property. On
# Emscripten they are bundled to the executable and available in the virtual
# filesystem root. On Android they are copied along the executable to the
# target.
#
# Unless :variable:`CORRADE_TESTSUITE_TARGET_XCTEST` is set, test cases on iOS
# targets are created as bundles with bundle identifier set to CMake project
# name by default. Use the cache variable :variable:`CORRADE_TESTSUITE_BUNDLE_IDENTIFIER_PREFIX`
@ -152,37 +163,60 @@
# Add dynamic plugin::
#
# corrade_add_plugin(<plugin name>
# <debug install dir> <release install dir>
# "<debug binary install dir>;<debug library install dir>"
# "<release binary install dir>;<release library install dir>"
# <metadata file>
# <sources>...)
#
# The macro adds preprocessor directive ``CORRADE_DYNAMIC_PLUGIN``. Additional
# libraries can be linked in via :command:`target_link_libraries(plugin_name ...) <target_link_libraries>`.
# If ``<debug install dir>`` is set to :variable:`CMAKE_CURRENT_BINARY_DIR`
# (e.g. for testing purposes), the files are copied directly, without the need
# to perform install step. Note that the files are actually put into
# configuration-based subdirectory, i.e. ``${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}``.
# See documentation of :variable:`CMAKE_CFG_INTDIR` variable for more
# information.
# On DLL platforms, the plugin DLLs and metadata files are put into
# ``<debug binary install dir>``/``<release binary install dir>`` and the
# ``*.lib`` files into ``<debug library install dir>``/``<release library install dir>``.
# On non-DLL platforms everything is put into ``<debug library install dir>``/
# ``<release library install dir>``.
#
# corrade_add_plugin(<plugin name>
# <debug install dir>
# <release install dir>
# <metadata file>
# <sources>...)
#
# Unline the above version this puts everything into ``<debug install dir>`` on
# both DLL and non-DLL platforms. If ``<debug install dir>`` is set to
# :variable:`CMAKE_CURRENT_BINARY_DIR` (e.g. for testing purposes), the files
# are copied directly, without the need to perform install step. Note that the
# files are actually put into configuration-based subdirectory, i.e.
# ``${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}``. See documentation of
# :variable:`CMAKE_CFG_INTDIR` variable for more information.
#
# .. command:: corrade_add_static_plugin
#
# Add static plugin::
#
# corrade_add_static_plugin(<plugin name>
# <install dir>
# "<binary install dir>;<library install dir>"
# <metadata file>
# <sources>...)
#
# The macro adds preprocessor directive ``CORRADE_STATIC_PLUGIN``. Additional
# libraries can be linked in via :command:`target_link_libraries(plugin_name ...) <target_link_libraries>`.
# The ``<binary install dir>`` is ignored and included just for compatibility
# with the :command:`corrade_add_plugin` command, everything is installed into
# ``<library install dir>``. Note that plugins built in debug configuration
# (e.g. with :variable:`CMAKE_BUILD_TYPE` set to ``Debug``) have ``"-d"``
# suffix to make it possible to have both debug and release plugins installed
# alongside each other.
#
# corrade_add_static_plugin(<plugin name>
# <install dir>
# <metadata file>
# <sources>...)
#
# Equivalent to the above with ``<library install dir>`` set to ``<install dir>``.
# If ``<install dir>`` is set to :variable:`CMAKE_CURRENT_BINARY_DIR` (e.g. for
# testing purposes), no installation rules are added.
#
# Note that plugins built in debug configuration (e.g. with :variable:`CMAKE_BUILD_TYPE`
# set to ``Debug``) have ``"-d"`` suffix to make it possible to have both debug
# and release plugins installed alongside each other.
#
# .. command:: corrade_find_dlls_for_libs
#
# Find corresponding DLLs for library files::
@ -248,6 +282,7 @@ set(_corradeFlags
TARGET_UNIX
TARGET_APPLE
TARGET_IOS
TARGET_IOS_SIMULATOR
TARGET_WINDOWS
TARGET_WINDOWS_RT
TARGET_NACL
@ -271,6 +306,13 @@ if(CORRADE_TESTSUITE_TARGET_XCTEST)
set(CORRADE_TESTSUITE_XCTEST_RUNNER_NEEDED CORRADE_TESTSUITE_XCTEST_RUNNER)
endif()
# ADB runner file
if(CORRADE_TARGET_ANDROID)
find_file(CORRADE_TESTSUITE_ADB_RUNNER AdbRunner.sh
PATH_SUFFIXES share/corrade/TestSuite)
set(CORRADE_TESTSUITE_ADB_RUNNER_NEEDED CORRADE_TESTSUITE_ADB_RUNNER)
endif()
# CMake module dir
find_path(_CORRADE_MODULE_DIR
NAMES UseCorrade.cmake CorradeLibSuffix.cmake
@ -459,6 +501,7 @@ find_package_handle_standard_args(Corrade REQUIRED_VARS
_CORRADE_MODULE_DIR
_CORRADE_CONFIGURE_FILE
${CORRADE_TESTSUITE_XCTEST_RUNNER_NEEDED}
${CORRADE_TESTSUITE_ADB_RUNNER_NEEDED}
HANDLE_COMPONENTS)
# Finalize the finding process

106
modules/FindMagnum.cmake

@ -72,7 +72,9 @@
# WavAudioImporter - WAV audio importer plugin
# distancefieldconverter - magnum-distancefieldconverter executable
# fontconverter - magnum-fontconverter executable
# imageconverter - magnum-imageconverter executable
# info - magnum-info executable
# al-info - magnum-al-info executable
#
# Example usage with specifying additional components is::
#
@ -105,6 +107,8 @@
# MAGNUM_BUILD_DEPRECATED - Defined if compiled with deprecated APIs
# included
# MAGNUM_BUILD_STATIC - Defined if compiled as static libraries
# MAGNUM_BUILD_MULTITHREADED - Defined if compiled in a way that allows
# having multiple thread-local Magnum contexts
# MAGNUM_TARGET_GLES - Defined if compiled for OpenGL ES
# MAGNUM_TARGET_GLES2 - Defined if compiled for OpenGL ES 2.0
# MAGNUM_TARGET_GLES3 - Defined if compiled for OpenGL ES 3.0
@ -125,17 +129,30 @@
# MAGNUM_BINARY_INSTALL_DIR - Binary installation directory
# MAGNUM_LIBRARY_INSTALL_DIR - Library installation directory
# MAGNUM_DATA_INSTALL_DIR - Data installation directory
# MAGNUM_PLUGINS_[DEBUG|RELEASE]_INSTALL_DIR - Plugin installation directory
# MAGNUM_PLUGINS_FONT_[DEBUG|RELEASE]_INSTALL_DIR - Font plugin installation
# directory
# MAGNUM_PLUGINS_FONTCONVERTER_[DEBUG|RELEASE]_INSTALL_DIR - Font converter
# plugin installation directory
# MAGNUM_PLUGINS_IMAGECONVERTER_[DEBUG|RELEASE]_INSTALL_DIR - Image converter
# plugin installation directory
# MAGNUM_PLUGINS_IMPORTER_[DEBUG|RELEASE]_INSTALL_DIR - Importer plugin
# MAGNUM_PLUGINS_[DEBUG|RELEASE]_BINARY_INSTALL_DIR - Plugin binary
# installation directory
# MAGNUM_PLUGINS_AUDIOIMPORTER_[DEBUG|RELEASE]_INSTALL_DIR - Audio importer
# plugin installation directory
# MAGNUM_PLUGINS_[DEBUG|RELEASE]_LIBRARY_INSTALL_DIR - Plugin library
# installation directory
# MAGNUM_PLUGINS_FONT_[DEBUG|RELEASE]_BINARY_INSTALL_DIR - Font plugin binary
# installation directory
# MAGNUM_PLUGINS_FONT_[DEBUG|RELEASE]_LIBRARY_INSTALL_DIR - Font plugin
# library installation directory
# MAGNUM_PLUGINS_FONTCONVERTER_[DEBUG|RELEASE]_BINARY_INSTALL_DIR - Font
# converter plugin binary installation directory
# MAGNUM_PLUGINS_FONTCONVERTER_[DEBUG|RELEASE]_LIBRARY_INSTALL_DIR - Font
# converter plugin library installation directory
# MAGNUM_PLUGINS_IMAGECONVERTER_[DEBUG|RELEASE]_BINARY_INSTALL_DIR - Image
# converter plugin binary installation directory
# MAGNUM_PLUGINS_IMAGECONVERTER_[DEBUG|RELEASE]_LIBRARY_INSTALL_DIR - Image
# converter plugin library installation directory
# MAGNUM_PLUGINS_IMPORTER_[DEBUG|RELEASE]_BINARY_INSTALL_DIR - Importer
# plugin binary installation directory
# MAGNUM_PLUGINS_IMPORTER_[DEBUG|RELEASE]_LIBRARY_INSTALL_DIR - Importer
# plugin library installation directory
# MAGNUM_PLUGINS_AUDIOIMPORTER_[DEBUG|RELEASE]_BINARY_INSTALL_DIR - Audio
# importer plugin binary installation directory
# MAGNUM_PLUGINS_AUDIOIMPORTER_[DEBUG|RELEASE]_LIBRARY_INSTALL_DIR - Audio
# importer plugin library installation directory
# MAGNUM_INCLUDE_INSTALL_DIR - Header installation directory
# MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR - Plugin header installation directory
#
@ -206,6 +223,7 @@ file(READ ${_MAGNUM_CONFIGURE_FILE} _magnumConfigure)
set(_magnumFlags
BUILD_DEPRECATED
BUILD_STATIC
BUILD_MULTITHREADED
TARGET_GLES
TARGET_GLES2
TARGET_GLES3
@ -233,17 +251,24 @@ if(NOT TARGET Magnum::Magnum)
# information to guess also build type of dynamic plugins
if(MAGNUM_LIBRARY_DEBUG AND MAGNUM_LIBRARY_RELEASE)
set(MAGNUM_LIBRARY ${MAGNUM_LIBRARY_RELEASE})
get_filename_component(_MAGNUM_LIBRARY_PATH ${MAGNUM_LIBRARY_DEBUG} PATH)
get_filename_component(_MAGNUM_PLUGINS_DIR_PREFIX ${MAGNUM_LIBRARY_DEBUG} PATH)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(_MAGNUM_PLUGINS_DIR_SUFFIX "-d")
endif()
elseif(MAGNUM_LIBRARY_DEBUG)
set(MAGNUM_LIBRARY ${MAGNUM_LIBRARY_DEBUG})
get_filename_component(_MAGNUM_LIBRARY_PATH ${MAGNUM_LIBRARY_DEBUG} PATH)
get_filename_component(_MAGNUM_PLUGINS_DIR_PREFIX ${MAGNUM_LIBRARY_DEBUG} PATH)
set(_MAGNUM_PLUGINS_DIR_SUFFIX "-d")
elseif(MAGNUM_LIBRARY_RELEASE)
set(MAGNUM_LIBRARY ${MAGNUM_LIBRARY_RELEASE})
get_filename_component(_MAGNUM_LIBRARY_PATH ${MAGNUM_LIBRARY_RELEASE} PATH)
get_filename_component(_MAGNUM_PLUGINS_DIR_PREFIX ${MAGNUM_LIBRARY_RELEASE} PATH)
endif()
# On DLL platforms the plugins are stored in bin/ instead of lib/, modify
# _MAGNUM_PLUGINS_DIR_PREFIX accordingly
if(CORRADE_TARGET_WINDOWS)
get_filename_component(_MAGNUM_PLUGINS_DIR_PREFIX ${_MAGNUM_PLUGINS_DIR_PREFIX} PATH)
set(_MAGNUM_PLUGINS_DIR_PREFIX ${_MAGNUM_PLUGINS_DIR_PREFIX}/bin)
endif()
if(MAGNUM_LIBRARY_RELEASE)
@ -341,7 +366,7 @@ endif()
# components from other repositories)
set(_MAGNUM_LIBRARY_COMPONENTS "^(Audio|DebugTools|MeshTools|Primitives|SceneGraph|Shaders|Shapes|Text|TextureTools|AndroidApplication|GlfwApplication|GlutApplication|GlxApplication|NaClApplication|Sdl2Application|XEglApplication|WindowlessCglApplication|WindowlessEglApplication|WindowlessGlxApplication|WindowlessIosApplication|WindowlessNaClApplication|WindowlessWglApplication|WindowlessWindowsEglApplication|CglContext|EglContext|GlxContext|WglContext)$")
set(_MAGNUM_PLUGIN_COMPONENTS "^(MagnumFont|MagnumFontConverter|ObjImporter|TgaImageConverter|TgaImporter|WavAudioImporter)$")
set(_MAGNUM_EXECUTABLE_COMPONENTS "^(distancefieldconverter|fontconverter|info)$")
set(_MAGNUM_EXECUTABLE_COMPONENTS "^(distancefieldconverter|fontconverter|imageconverter|info|al-info)$")
# Find all components
foreach(_component ${Magnum_FIND_COMPONENTS})
@ -422,7 +447,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS})
MAGNUM_${_COMPONENT}_LIBRARY_RELEASE)
# Reset back
set(CMAKE_FIND_LIBRARY_PREFIXES ${_tmp_prefixes})
set(CMAKE_FIND_LIBRARY_PREFIXES "${_tmp_prefixes}")
endif()
# Library location for libraries/plugins
@ -744,28 +769,41 @@ include(${CORRADE_LIB_SUFFIX_MODULE})
set(MAGNUM_BINARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin)
set(MAGNUM_LIBRARY_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX})
set(MAGNUM_DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/magnum)
set(MAGNUM_PLUGINS_DEBUG_INSTALL_DIR ${MAGNUM_LIBRARY_INSTALL_DIR}/magnum-d)
set(MAGNUM_PLUGINS_RELEASE_INSTALL_DIR ${MAGNUM_LIBRARY_INSTALL_DIR}/magnum)
set(MAGNUM_PLUGINS_FONT_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/fonts)
set(MAGNUM_PLUGINS_FONT_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/fonts)
set(MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/fontconverters)
set(MAGNUM_PLUGINS_FONTCONVERTER_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/fontconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMPORTER_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/importers)
set(MAGNUM_PLUGINS_IMPORTER_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/importers)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_INSTALL_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_INSTALL_DIR}/audioimporters)
set(MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_BINARY_INSTALL_DIR}/magnum-d)
set(MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_LIBRARY_INSTALL_DIR}/magnum-d)
set(MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_BINARY_INSTALL_DIR}/magnum)
set(MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_LIBRARY_INSTALL_DIR}/magnum)
set(MAGNUM_PLUGINS_FONT_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/fonts)
set(MAGNUM_PLUGINS_FONT_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/fonts)
set(MAGNUM_PLUGINS_FONT_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/fonts)
set(MAGNUM_PLUGINS_FONT_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/fonts)
set(MAGNUM_PLUGINS_FONTCONVERTER_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/fontconverters)
set(MAGNUM_PLUGINS_FONTCONVERTER_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/fontconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMAGECONVERTER_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/imageconverters)
set(MAGNUM_PLUGINS_IMPORTER_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/importers)
set(MAGNUM_PLUGINS_IMPORTER_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/importers)
set(MAGNUM_PLUGINS_IMPORTER_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/importers)
set(MAGNUM_PLUGINS_IMPORTER_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/importers)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_BINARY_INSTALL_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_DEBUG_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_DEBUG_LIBRARY_INSTALL_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_BINARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_BINARY_INSTALL_DIR}/audioimporters)
set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_LIBRARY_INSTALL_DIR ${MAGNUM_PLUGINS_RELEASE_LIBRARY_INSTALL_DIR}/audioimporters)
set(MAGNUM_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/Magnum)
set(MAGNUM_PLUGINS_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/MagnumPlugins)
# Get base plugin directory from main library location
set(MAGNUM_PLUGINS_DEBUG_DIR ${_MAGNUM_LIBRARY_PATH}/magnum-d
CACHE PATH "Base directory where to look for Magnum plugins for debug builds")
set(MAGNUM_PLUGINS_RELEASE_DIR ${_MAGNUM_LIBRARY_PATH}/magnum
CACHE PATH "Base directory where to look for Magnum plugins for release builds")
set(MAGNUM_PLUGINS_DIR ${_MAGNUM_LIBRARY_PATH}/magnum${_MAGNUM_PLUGINS_DIR_SUFFIX}
CACHE PATH "Base directory where to look for Magnum plugins")
# Get base plugin directory from main library location. This is *not* PATH,
# because CMake always converts the path to an absolute location internally,
# making it impossible to specify relative paths there. Sorry in advance for
# not having the dir selection button in CMake GUI.
set(MAGNUM_PLUGINS_DEBUG_DIR ${_MAGNUM_PLUGINS_DIR_PREFIX}/magnum-d
CACHE STRING "Base directory where to look for Magnum plugins for debug builds")
set(MAGNUM_PLUGINS_RELEASE_DIR ${_MAGNUM_PLUGINS_DIR_PREFIX}/magnum
CACHE STRING "Base directory where to look for Magnum plugins for release builds")
set(MAGNUM_PLUGINS_DIR ${_MAGNUM_PLUGINS_DIR_PREFIX}/magnum${_MAGNUM_PLUGINS_DIR_SUFFIX}
CACHE STRING "Base directory where to look for Magnum plugins")
# Plugin directories
set(MAGNUM_PLUGINS_FONT_DIR ${MAGNUM_PLUGINS_DIR}/fonts)

137
modules/FindOpenAL.cmake

@ -0,0 +1,137 @@
#.rst:
# FindOpenAL
# ----------
#
#
#
# Locate OpenAL This module defines OPENAL_LIBRARY OPENAL_FOUND, if
# false, do not try to link to OpenAL OPENAL_INCLUDE_DIR, where to find
# the headers
#
# $OPENALDIR is an environment variable that would correspond to the
# ./configure --prefix=$OPENALDIR used in building OpenAL.
#
# Created by Eric Wing. This was influenced by the FindSDL.cmake
# module.
#=============================================================================
# CMake - Cross Platform Makefile Generator
# Copyright 2000-2016 Kitware, Inc.
# Copyright 2000-2011 Insight Software Consortium
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#=============================================================================
# This makes the presumption that you are include al.h like
# #include "al.h"
# and not
# #include <AL/al.h>
# The reason for this is that the latter is not entirely portable.
# Windows/Creative Labs does not by default put their headers in AL/ and
# OS X uses the convention <OpenAL/al.h>.
#
# For Windows, Creative Labs seems to have added a registry key for their
# OpenAL 1.1 installer. I have added that key to the list of search paths,
# however, the key looks like it could be a little fragile depending on
# if they decide to change the 1.00.0000 number for bug fix releases.
# Also, they seem to have laid down groundwork for multiple library platforms
# which puts the library in an extra subdirectory. Currently there is only
# Win32 and I have hardcoded that here. This may need to be adjusted as
# platforms are introduced.
# The OpenAL 1.0 installer doesn't seem to have a useful key I can use.
# I do not know if the Nvidia OpenAL SDK has a registry key.
#
# For OS X, remember that OpenAL was added by Apple in 10.4 (Tiger).
# To support the framework, I originally wrote special framework detection
# code in this module which I have now removed with CMake's introduction
# of native support for frameworks.
# In addition, OpenAL is open source, and it is possible to compile on Panther.
# Furthermore, due to bugs in the initial OpenAL release, and the
# transition to OpenAL 1.1, it is common to need to override the built-in
# framework.
# Per my request, CMake should search for frameworks first in
# the following order:
# ~/Library/Frameworks/OpenAL.framework/Headers
# /Library/Frameworks/OpenAL.framework/Headers
# /System/Library/Frameworks/OpenAL.framework/Headers
#
# On OS X, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of
# OPENAL_LIBRARY to override this selection or set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths.
find_path(OPENAL_INCLUDE_DIR al.h
HINTS
ENV OPENALDIR
# The AL was added in order to make the module working for Emscripten on OSX.
# Not sure why include/AL wasn't enough.
PATH_SUFFIXES include/AL include/OpenAL include AL
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_OpenAL_ARCH_DIR libs/Win64)
else()
set(_OpenAL_ARCH_DIR libs/Win32)
endif()
if(NOT CORRADE_TARGET_EMSCRIPTEN)
find_library(OPENAL_LIBRARY
NAMES OpenAL al openal OpenAL32
HINTS
ENV OPENALDIR
PATH_SUFFIXES lib64 lib libs64 libs ${_OpenAL_ARCH_DIR}
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Creative\ Labs\\OpenAL\ 1.1\ Software\ Development\ Kit\\1.00.0000;InstallDir]
)
set(OPENAL_LIBRARY_NEEDED OPENAL_LIBRARY)
endif()
unset(_OpenAL_ARCH_DIR)
# handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG ${OPENAL_LIBRARY_NEEDED} OPENAL_INCLUDE_DIR)
mark_as_advanced(OPENAL_LIBRARY OPENAL_INCLUDE_DIR)

12
modules/FindSDL2.cmake

@ -43,14 +43,19 @@
if(CORRADE_TARGET_EMSCRIPTEN)
set(_SDL2_PATH_SUFFIXES SDL)
else()
# Precompiled libraries for Windows are in x86/x64 subdirectories
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_SDL_LIBRARY_PATH_SUFFIX lib/x64)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(_SDL_LIBRARY_PATH_SUFFIX lib/x86)
endif()
find_library(SDL2_LIBRARY
# Compiling SDL2 from scratch on OSX creates dead libSDL2.so symlink
# which CMake somehow prefers before the SDL2-2.0.dylib file. Making
# the dylib first so it is preferred.
NAMES SDL2-2.0 SDL2
# Precompiled libraries for Windows are in x86/x64 subdirectories
PATH_SUFFIXES lib/x86 lib/x64)
PATH_SUFFIXES ${_SDL_LIBRARY_PATH_SUFFIX})
set(SDL2_LIBRARY_NEEDED SDL2_LIBRARY)
set(_SDL2_PATH_SUFFIXES SDL2)
endif()
@ -80,6 +85,7 @@ if(CORRADE_TARGET_IOS)
set(_SDL2_FRAMEWORK_LIBRARIES )
foreach(framework ${_SDL2_FRAMEWORKS})
find_library(_SDL2_${framework}_LIBRARY ${framework})
mark_as_advanced(_SDL2_${framework}_LIBRARY)
list(APPEND _SDL2_FRAMEWORK_LIBRARIES ${_SDL2_${framework}_LIBRARY})
list(APPEND _SDL2_FRAMEWORK_LIBRARY_NAMES _SDL2_${framework}_LIBRARY)
endforeach()

2
package/archlinux/PKGBUILD

@ -41,7 +41,9 @@ build() {
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_DISTANCEFIELDCONVERTER=ON \
-DWITH_FONTCONVERTER=ON \
-DWITH_IMAGECONVERTER=ON \
-DWITH_MAGNUMINFO=ON \
-DWITH_AL_INFO=ON \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON \
-G Ninja

3
package/archlinux/PKGBUILD-android-arm

@ -34,7 +34,8 @@ build() {
-DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON \
-DWITH_ANDROIDAPPLICATION=ON \
-DWITH_EGLCONTEXT=ON
-DWITH_EGLCONTEXT=ON \
-DBUILD_TESTS=ON
ninja
}

3
package/archlinux/PKGBUILD-android-x86

@ -34,7 +34,8 @@ build() {
-DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON \
-DWITH_ANDROIDAPPLICATION=ON \
-DWITH_EGLCONTEXT=ON
-DWITH_EGLCONTEXT=ON \
-DBUILD_TESTS=ON
ninja
}

2
package/archlinux/PKGBUILD-clang

@ -44,7 +44,9 @@ build() {
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_DISTANCEFIELDCONVERTER=ON \
-DWITH_FONTCONVERTER=ON \
-DWITH_IMAGECONVERTER=ON \
-DWITH_MAGNUMINFO=ON \
-DWITH_AL_INFO=ON \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON
ninja

2
package/archlinux/PKGBUILD-clang-libc++

@ -47,7 +47,9 @@ build() {
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_DISTANCEFIELDCONVERTER=ON \
-DWITH_FONTCONVERTER=ON \
-DWITH_IMAGECONVERTER=ON \
-DWITH_MAGNUMINFO=ON \
-DWITH_AL_INFO=ON \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON
ninja

19
package/archlinux/PKGBUILD-emscripten

@ -7,7 +7,7 @@ arch=('any')
url="http://mosra.cz/blog/magnum.php"
license=('MIT')
depends=('emscripten-corrade')
makedepends=('cmake' 'emscripten' 'corrade')
makedepends=('cmake' 'emscripten' 'corrade' 'ninja')
options=('!strip' '!buildflags')
_rootdir=$startdir/../../
@ -19,7 +19,8 @@ build() {
cmake .. \
-DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/Emscripten.cmake" \
-DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system
-DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system \
-G Ninja
fi
cd "$_rootdir/build-emscripten"
@ -27,15 +28,23 @@ build() {
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/lib/emscripten/system \
-DWITH_AUDIO=ON \
-DWITH_SDL2APPLICATION=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_OBJIMPORTER=ON \
-DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON
make
-DWITH_TGAIMPORTER=ON \
-DWITH_WAVAUDIOIMPORTER=ON \
-DBUILD_TESTS=ON
ninja
}
check() {
cd "$_rootdir/build-emscripten"
CORRADE_TEST_COLOR=ON ctest --output-on-failure -E ALTest
}
package() {
cd "$_rootdir/build-emscripten"
DESTDIR="$pkgdir/" make install
DESTDIR="$pkgdir/" ninja install
}

18
package/archlinux/PKGBUILD-emscripten-webgl2

@ -7,7 +7,7 @@ arch=('any')
url="http://mosra.cz/blog/magnum.php"
license=('MIT')
depends=('emscripten-corrade')
makedepends=('cmake' 'emscripten' 'corrade')
makedepends=('cmake' 'emscripten' 'corrade' 'ninja')
options=('!strip' '!buildflags')
_rootdir=$startdir/../../
@ -19,7 +19,8 @@ build() {
cmake .. \
-DCMAKE_TOOLCHAIN_FILE="$_rootdir/toolchains/generic/Emscripten.cmake" \
-DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system
-DCMAKE_PREFIX_PATH=/usr/lib/emscripten/system \
-G Ninja
fi
cd "$_rootdir/build-emscripten-webgl2"
@ -28,16 +29,23 @@ build() {
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/lib/emscripten/system \
-DTARGET_GLES2=OFF \
-DWITH_AUDIO=ON \
-DWITH_SDL2APPLICATION=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_OBJIMPORTER=ON \
-DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON \
-DWITH_WAVAUDIOIMPORTER=ON
make
-DWITH_WAVAUDIOIMPORTER=ON \
-DBUILD_TESTS=ON
ninja
}
check() {
cd "$_rootdir/build-emscripten"
CORRADE_TEST_COLOR=ON ctest --output-on-failure -E ALTest
}
package() {
cd "$_rootdir/build-emscripten-webgl2"
DESTDIR="$pkgdir/" make install
DESTDIR="$pkgdir/" ninja install
}

5
package/archlinux/PKGBUILD-es2

@ -24,13 +24,18 @@ build() {
-DTARGET_GLES2=ON \
-DWITH_AUDIO=ON \
-DWITH_XEGLAPPLICATION=ON \
-DWITH_WINDOWLESSEGLAPPLICATION=ON \
-DWITH_EGLCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_OBJIMPORTER=ON \
-DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON \
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_IMAGECONVERTER=ON \
-DWITH_MAGNUMINFO=ON \
-DWITH_AL_INFO=ON \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON \
-G Ninja
ninja
}

2
package/archlinux/PKGBUILD-es2desktop

@ -36,7 +36,9 @@ build() {
-DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON \
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_IMAGECONVERTER=ON \
-DWITH_MAGNUMINFO=ON \
-DWITH_AL_INFO=ON \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON \
-G Ninja

5
package/archlinux/PKGBUILD-es3

@ -24,13 +24,18 @@ build() {
-DTARGET_GLES2=OFF \
-DWITH_AUDIO=ON \
-DWITH_XEGLAPPLICATION=ON \
-DWITH_WINDOWLESSEGLAPPLICATION=ON \
-DWITH_EGLCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_OBJIMPORTER=ON \
-DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON \
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_IMAGECONVERTER=ON \
-DWITH_MAGNUMINFO=ON \
-DWITH_AL_INFO=ON \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON \
-G Ninja
ninja
}

2
package/archlinux/PKGBUILD-es3desktop

@ -36,7 +36,9 @@ build() {
-DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON \
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_IMAGECONVERTER=ON \
-DWITH_MAGNUMINFO=ON \
-DWITH_AL_INFO=ON \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON \
-G Ninja

2
package/archlinux/PKGBUILD-gcc47

@ -49,7 +49,9 @@ build() {
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_DISTANCEFIELDCONVERTER=ON \
-DWITH_FONTCONVERTER=ON \
-DWITH_IMAGECONVERTER=ON \
-DWITH_MAGNUMINFO=ON \
-DWITH_AL_INFO=ON \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON
ninja

4
package/archlinux/PKGBUILD-mingw-w64

@ -33,7 +33,9 @@ build() {
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_DISTANCEFIELDCONVERTER=ON \
-DWITH_FONTCONVERTER=ON \
-DWITH_IMAGECONVERTER=ON \
-DWITH_MAGNUMINFO=ON \
-DWITH_AL_INFO=ON \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON \
-G Ninja
@ -59,7 +61,9 @@ build() {
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_DISTANCEFIELDCONVERTER=ON \
-DWITH_FONTCONVERTER=ON \
-DWITH_IMAGECONVERTER=ON \
-DWITH_MAGNUMINFO=ON \
-DWITH_AL_INFO=ON \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON \
-G Ninja

4
package/archlinux/PKGBUILD-release

@ -37,7 +37,9 @@ build() {
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_DISTANCEFIELDCONVERTER=ON \
-DWITH_FONTCONVERTER=ON \
-DWITH_IMAGECONVERTER=ON \
-DWITH_MAGNUMINFO=ON \
-DWITH_AL_INFO=ON \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON \
-G Ninja
@ -63,7 +65,9 @@ build() {
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_DISTANCEFIELDCONVERTER=ON \
-DWITH_FONTCONVERTER=ON \
-DWITH_IMAGECONVERTER=ON \
-DWITH_MAGNUMINFO=ON \
-DWITH_AL_INFO=ON \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON \
-G Ninja

4
package/archlinux/magnum-git/PKGBUILD

@ -38,7 +38,9 @@ build() {
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_DISTANCEFIELDCONVERTER=ON \
-DWITH_FONTCONVERTER=ON \
-DWITH_MAGNUMINFO=ON
-DWITH_IMAGECONVERTER=ON \
-DWITH_MAGNUMINFO=ON \
-DWITH_AL_INFO=ON
make
}

48
package/ci/appveyor-desktop-gles.bat

@ -0,0 +1,48 @@
call "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat" x64 || exit /b
set PATH=%APPVEYOR_BUILD_FOLDER%/openal/bin/Win64;%APPVEYOR_BUILD_FOLDER%\deps\bin;%PATH%
rem Build Corrade
git clone --depth 1 git://github.com/mosra/corrade.git || exit /b
cd corrade || exit /b
mkdir build && cd build || exit /b
cmake .. ^
-DCMAKE_BUILD_TYPE=Debug ^
-DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/deps ^
-DWITH_INTERCONNECT=OFF ^
-G Ninja || exit /b
cmake --build . || exit /b
cmake --build . --target install || exit /b
cd .. && cd ..
rem Build
mkdir build && cd build || exit /b
cmake .. ^
-DCMAKE_BUILD_TYPE=Debug ^
-DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/deps ^
-DCMAKE_PREFIX_PATH="%APPVEYOR_BUILD_FOLDER%/openal" ^
-DTARGET_GLES=ON ^
-DTARGET_GLES2=%TARGET_GLES2% ^
-DTARGET_DESKTOP_GLES=ON ^
-DWITH_AUDIO=ON ^
-DWITH_SDL2APPLICATION=OFF ^
-DWITH_WINDOWLESSWGLAPPLICATION=ON ^
-DWITH_WGLCONTEXT=ON ^
-DWITH_MAGNUMFONT=ON ^
-DWITH_MAGNUMFONTCONVERTER=ON ^
-DWITH_OBJIMPORTER=ON ^
-DWITH_TGAIMAGECONVERTER=ON ^
-DWITH_TGAIMPORTER=ON ^
-DWITH_WAVAUDIOIMPORTER=ON ^
-DWITH_DISTANCEFIELDCONVERTER=OFF ^
-DWITH_FONTCONVERTER=OFF ^
-DWITH_IMAGECONVERTER=ON ^
-DWITH_MAGNUMINFO=ON ^
-DWITH_AL_INFO=ON ^
-DBUILD_TESTS=ON ^
-DBUILD_GL_TESTS=ON ^
-G Ninja || exit /b
cmake --build . || exit /b
cmake --build . --target install || exit /b
rem Test
ctest -V -E GLTest || exit /b

46
package/ci/appveyor-desktop-mingw.bat

@ -0,0 +1,46 @@
rem Workaround for CMake not wanting sh.exe on PATH for MinGW. AARGH.
set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
set PATH=C:\tools\mingw64\bin;%APPVEYOR_BUILD_FOLDER%/openal/bin/Win64;%APPVEYOR_BUILD_FOLDER%\deps\bin;%PATH%
rem Build Corrade. Could not get Ninja to work, meh.
git clone --depth 1 git://github.com/mosra/corrade.git || exit /b
cd corrade || exit /b
mkdir build && cd build || exit /b
cmake .. ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/deps ^
-DWITH_INTERCONNECT=OFF ^
-G "MinGW Makefiles" || exit /b
cmake --build . -- -j || exit /b
cmake --build . --target install -- -j || exit /b
cd .. && cd ..
rem Build
mkdir build && cd build || exit /b
cmake .. ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/deps ^
-DCMAKE_PREFIX_PATH="%APPVEYOR_BUILD_FOLDER%/SDL;%APPVEYOR_BUILD_FOLDER%/openal" ^
-DWITH_AUDIO=ON ^
-DWITH_SDL2APPLICATION=ON ^
-DWITH_WINDOWLESSWGLAPPLICATION=ON ^
-DWITH_WGLCONTEXT=ON ^
-DWITH_MAGNUMFONT=ON ^
-DWITH_MAGNUMFONTCONVERTER=ON ^
-DWITH_OBJIMPORTER=ON ^
-DWITH_TGAIMAGECONVERTER=ON ^
-DWITH_TGAIMPORTER=ON ^
-DWITH_WAVAUDIOIMPORTER=ON ^
-DWITH_DISTANCEFIELDCONVERTER=ON ^
-DWITH_FONTCONVERTER=ON ^
-DWITH_IMAGECONVERTER=ON ^
-DWITH_MAGNUMINFO=ON ^
-DWITH_AL_INFO=ON ^
-DBUILD_TESTS=ON ^
-DBUILD_GL_TESTS=ON ^
-G "MinGW Makefiles" || exit /b
cmake --build . -- -j || exit /b
cmake --build . --target install -- -j || exit /b
rem Test
ctest -V -E GLTest || exit /b

45
package/ci/appveyor-desktop.bat

@ -0,0 +1,45 @@
call "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat" x64 || exit /b
set PATH=%APPVEYOR_BUILD_FOLDER%/openal/bin/Win64;%APPVEYOR_BUILD_FOLDER%\deps\bin;%PATH%
rem Build Corrade
git clone --depth 1 git://github.com/mosra/corrade.git || exit /b
cd corrade || exit /b
mkdir build && cd build || exit /b
cmake .. ^
-DCMAKE_BUILD_TYPE=Debug ^
-DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/deps ^
-DWITH_INTERCONNECT=OFF ^
-G Ninja || exit /b
cmake --build . || exit /b
cmake --build . --target install || exit /b
cd .. && cd ..
rem Build
mkdir build && cd build || exit /b
cmake .. ^
-DCMAKE_BUILD_TYPE=Debug ^
-DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/deps ^
-DCMAKE_PREFIX_PATH="%APPVEYOR_BUILD_FOLDER%/SDL;%APPVEYOR_BUILD_FOLDER%/openal" ^
-DWITH_AUDIO=ON ^
-DWITH_SDL2APPLICATION=ON ^
-DWITH_WINDOWLESSWGLAPPLICATION=ON ^
-DWITH_WGLCONTEXT=ON ^
-DWITH_MAGNUMFONT=ON ^
-DWITH_MAGNUMFONTCONVERTER=ON ^
-DWITH_OBJIMPORTER=ON ^
-DWITH_TGAIMAGECONVERTER=ON ^
-DWITH_TGAIMPORTER=ON ^
-DWITH_WAVAUDIOIMPORTER=ON ^
-DWITH_DISTANCEFIELDCONVERTER=ON ^
-DWITH_FONTCONVERTER=ON ^
-DWITH_IMAGECONVERTER=ON ^
-DWITH_MAGNUMINFO=ON ^
-DWITH_AL_INFO=ON ^
-DBUILD_TESTS=ON ^
-DBUILD_GL_TESTS=ON ^
-G Ninja || exit /b
cmake --build . || exit /b
cmake --build . --target install || exit /b
rem Test
ctest -V -E GLTest || exit /b

76
package/ci/appveyor-rt.bat

@ -0,0 +1,76 @@
call "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat" x64 || exit /b
set PATH=%APPVEYOR_BUILD_FOLDER%\deps-native\bin;%PATH%
rem Build ANGLE
git clone --depth 1 git://github.com/MSOpenTech/angle.git || exit /b
cd angle\winrt\10\src || exit /b
msbuild angle.sln /p:Configuration=Release || exit /b
cd ..\..\..\.. || exit /b
rem Build SDL
appveyor DownloadFile https://www.libsdl.org/release/SDL2-2.0.4.zip || exit /b
7z x SDL2-2.0.4.zip || exit /b
ren SDL2-2.0.4 SDL || exit /b
cd SDL/VisualC-WinRT/UWP_VS2015 || exit/b
msbuild /p:Configuration=Release || exit /b
cd ..\..\..
git clone --depth 1 git://github.com/mosra/corrade.git || exit /b
cd corrade || exit /b
rem Build native corrade-rc
mkdir build && cd build || exit /b
cmake .. ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/deps-native ^
-DWITH_INTERCONNECT=OFF ^
-DWITH_PLUGINMANAGER=OFF ^
-DWITH_TESTSUITE=OFF ^
-G Ninja || exit /b
cmake --build . --target install || exit /b
cd .. || exit /b
rem Crosscompile Corrade
mkdir build-rt && cd build-rt || exit /b
cmake .. ^
-DCMAKE_SYSTEM_NAME=WindowsStore ^
-DCMAKE_SYSTEM_VERSION=10.0 ^
-DCORRADE_RC_EXECUTABLE=%APPVEYOR_BUILD_FOLDER%/deps-native/bin/corrade-rc.exe ^
-DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/deps ^
-DWITH_INTERCONNECT=OFF ^
-DBUILD_STATIC=ON ^
-G "Visual Studio 14 2015" -A x64 || exit /b
cmake --build . --config Release --target install -- /m /v:m || exit /b
cd .. || exit /b
cd .. || exit /b
rem Crosscompile
mkdir build-rt && cd build-rt || exit /b
cmake .. ^
-DCMAKE_SYSTEM_NAME=WindowsStore ^
-DCMAKE_SYSTEM_VERSION=10.0 ^
-DCORRADE_RC_EXECUTABLE=%APPVEYOR_BUILD_FOLDER%/deps-native/bin/corrade-rc.exe ^
-DCMAKE_PREFIX_PATH=%APPVEYOR_BUILD_FOLDER%/deps ^
-DEGL_LIBRARY=%APPVEYOR_BUILD_FOLDER%/angle/winrt/10/src/Release_x64/lib/libEGL.lib ^
-DEGL_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%/angle/include ^
-DOPENGLES2_LIBRARY=%APPVEYOR_BUILD_FOLDER%/angle/winrt/10/src/Release_x64/lib/libGLESv2.lib ^
-DOPENGLES2_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%/angle/include ^
-DOPENGLES3_LIBRARY=%APPVEYOR_BUILD_FOLDER%/angle/winrt/10/src/Release_x64/lib/libGLESv2.lib ^
-DOPENGLES3_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%/angle/include ^
-DSDL2_LIBRARY=%APPVEYOR_BUILD_FOLDER%/SDL/VisualC-WinRT/UWP_VS2015/X64/Release/SDL-UWP/SDL2.lib ^
-DSDL2_INCLUDE_DIR=%APPVEYOR_BUILD_FOLDER%/SDL/include ^
-DWITH_AUDIO=OFF ^
-DWITH_SDL2APPLICATION=ON ^
-DWITH_MAGNUMFONT=ON ^
-DWITH_MAGNUMFONTCONVERTER=ON ^
-DWITH_OBJIMPORTER=ON ^
-DWITH_TGAIMAGECONVERTER=ON ^
-DWITH_TGAIMPORTER=ON ^
-DWITH_WAVAUDIOIMPORTER=OFF ^
-DTARGET_GLES2=%TARGET_GLES2% ^
-DBUILD_TESTS=ON ^
-DBUILD_STATIC=ON ^
-DBUILD_PLUGINS_STATIC=ON ^
-G "Visual Studio 14 2015" -A x64 || exit /b
cmake --build . --config Release -- /m /v:m || exit /b

77
package/ci/appveyor.yml

@ -1,16 +1,23 @@
# kate: indent-width 2;
version: '{branch}-{build}'
skip_tags: true
shallow_clone: true
clone_depth: 1
os: Visual Studio 2015
environment:
matrix:
- BUILD_STATIC: OFF
- TARGET: desktop
COMPILER: msvc
- TARGET: desktop
COMPILER: mingw
- TARGET: desktop-gles
TARGET_GLES2: ON
- TARGET: desktop-gles
TARGET_GLES2: OFF
- TARGET: rt
TARGET_GLES2: ON
- TARGET: rt
TARGET_GLES2: OFF
notifications:
- provider: Webhook
@ -20,51 +27,29 @@ notifications:
on_build_status_changed: true
install:
- call "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/vcvarsall.bat"
- set PATH=C:/Sys/bin;C:/tools/ninja;%APPVEYOR_BUILD_FOLDER%/openal/bin/Win32;%PATH%
# Ninja
- cinst ninja
- set PATH=C:/tools/ninja;%PATH%
- IF "%TARGET%" == "desktop" IF "%COMPILER%" == "mingw" cinst mingw /f >nul
# OpenAL
- appveyor DownloadFile http://kcat.strangesoft.net/openal-binaries/openal-soft-1.17.2-bin.zip
- 7z x openal-soft-1.17.2-bin.zip
- ren openal-soft-1.17.2-bin openal
- ren openal\bin\Win32\soft_oal.dll OpenAL32.dll
- echo [General] > %APPDATA%/alsoft.ini
- echo drivers=null >> %APPDATA%/alsoft.ini
- IF NOT "%TARGET%" == "rt" IF NOT EXIST %APPVEYOR_BUILD_FOLDER%\openal-soft-1.17.2-bin.zip appveyor DownloadFile http://kcat.strangesoft.net/openal-binaries/openal-soft-1.17.2-bin.zip
- IF NOT "%TARGET%" == "rt" 7z x openal-soft-1.17.2-bin.zip && ren openal-soft-1.17.2-bin openal && echo [General] > %APPDATA%/alsoft.ini & echo drivers=null >> %APPDATA%/alsoft.ini
- IF "%TARGET%" == "desktop" ren openal\bin\Win64\soft_oal.dll OpenAL32.dll
- IF "%TARGET%" == "desktop-gles" ren openal\bin\Win64\soft_oal.dll OpenAL32.dll
# SDL2
- appveyor DownloadFile http://www.libsdl.org/release/SDL2-devel-2.0.3-VC.zip
- 7z x SDL2-devel-2.0.3-VC.zip
- ren SDL2-2.0.3 SDL
# Corrade
- git clone --depth 1 git://github.com/mosra/corrade.git
- cd corrade
- mkdir build
- cd build
- cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=C:/Sys -DBUILD_STATIC=%BUILD_STATIC% -G Ninja
- cmake --build .
- cmake --build . --target install
- cd ..
- cd ..
- IF "%TARGET%" == "desktop" IF "%COMPILER%" == "msvc" IF NOT EXIST %APPVEYOR_BUILD_FOLDER%\SDL2-devel-2.0.4-VC.zip appveyor DownloadFile http://www.libsdl.org/release/SDL2-devel-2.0.4-VC.zip
- IF "%TARGET%" == "desktop" IF "%COMPILER%" == "msvc" 7z x SDL2-devel-2.0.4-VC.zip && ren SDL2-2.0.4 SDL
- IF "%TARGET%" == "desktop" IF "%COMPILER%" == "mingw" IF NOT EXIST %APPVEYOR_BUILD_FOLDER%\SDL2-devel-2.0.4-mingw.tar.gz appveyor DownloadFile http://libsdl.org/release/SDL2-devel-2.0.4-mingw.tar.gz
- IF "%TARGET%" == "desktop" IF "%COMPILER%" == "mingw" 7z x SDL2-devel-2.0.4-mingw.tar.gz & 7z x SDL2-devel-2.0.4-mingw.tar & ren SDL2-2.0.4 SDL
build_script:
- mkdir build
- cd build
- cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=C:/Sys -DCMAKE_PREFIX_PATH="%APPVEYOR_BUILD_FOLDER%/SDL;%APPVEYOR_BUILD_FOLDER%/openal" -DWITH_AUDIO=ON -DWITH_SDL2APPLICATION=ON -DWITH_WINDOWLESSWGLAPPLICATION=ON -DWITH_WGLCONTEXT=ON -DWITH_MAGNUMFONT=ON -DWITH_MAGNUMFONTCONVERTER=ON -DWITH_OBJIMPORTER=ON -DWITH_TGAIMAGECONVERTER=ON -DWITH_TGAIMPORTER=ON -DWITH_WAVAUDIOIMPORTER=ON -DWITH_DISTANCEFIELDCONVERTER=ON -DWITH_FONTCONVERTER=ON -DWITH_MAGNUMINFO=ON -DBUILD_STATIC=%BUILD_STATIC% -DBUILD_TESTS=ON -DBUILD_GL_TESTS=ON -G Ninja
- cmake --build .
- cmake --build . --target install
- cmake . -DCMAKE_INSTALL_PREFIX=%APPVEYOR_BUILD_FOLDER%/Deploy -DBUILD_TESTS=OFF
- cmake --build . --target install
- cd ../Deploy
- 7z a ../magnum.zip *
test_script:
- cd %APPVEYOR_BUILD_FOLDER%/build
- SET fail=0
- ctest --output-on-failure -E GLTest || SET fail=1 & ver > nul
- cd %APPVEYOR_BUILD_FOLDER%
- appveyor PushArtifact magnum.zip
- exit %fail%
- IF "%TARGET%" == "desktop" IF "%COMPILER%" == "msvc" call package\ci\appveyor-desktop.bat
- IF "%TARGET%" == "desktop" IF "%COMPILER%" == "mingw" call package\ci\appveyor-desktop-mingw.bat
- IF "%TARGET%" == "desktop-gles" call package\ci\appveyor-desktop-gles.bat
- IF "%TARGET%" == "rt" call package\ci\appveyor-rt.bat
cache:
- SDL2-devel-2.0.4-VC.zip
- SDL2-devel-2.0.4-mingw.zip
- openal-soft-1.17.2-bin.zip

9
package/ci/jenkins.xml

@ -102,27 +102,22 @@ fi
if [ ${gl} = "desktop" ] ; then
desktop_flag=ON
es_flag=OFF
windowless_flag=ON
elif [ ${gl} = "es2" ] ; then
gl_flags="-DTARGET_GLES=ON -DTARGET_GLES2=ON"
desktop_flag=OFF
es_flag=ON
windowless_flag=OFF
elif [ ${gl} = "es2desktop" ] ; then
gl_flags="-DTARGET_GLES=ON -DTARGET_GLES2=ON -DTARGET_DESKTOP_GLES=ON"
desktop_flag=OFF
es_flag=OFF
windowless_flag=ON
elif [ ${gl} = "es3" ] ; then
gl_flags="-DTARGET_GLES=ON -DTARGET_GLES2=OFF"
desktop_flag=OFF
es_flag=ON
windowless_flag=OFF
elif [ ${gl} = "es3desktop" ] ; then
gl_flags="-DTARGET_GLES=ON -DTARGET_GLES2=OFF -DTARGET_DESKTOP_GLES=ON"
desktop_flag=OFF
es_flag=OFF
windowless_flag=ON
fi
mkdir -p build-${compiler}-${libraries}-${compatibility}-${gl}
@ -136,7 +131,7 @@ cmake .. \
-DCMAKE_CXX_COMPILER=${compiler_binary} \
"${compiler_flags[@]}" \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=${windowless_flag} \
-DBUILD_GL_TESTS=ON \
-DBUILD_DEPRECATED=${deprecated_build_flag} \
${static_build_flag} \
${gl_flags} \
@ -156,7 +151,7 @@ cmake .. \
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_DISTANCEFIELDCONVERTER=${desktop_flag} \
-DWITH_FONTCONVERTER=${desktop_flag} \
-DWITH_MAGNUMINFO=${windowless_flag} \
-DWITH_MAGNUMINFO=ON \
-G Ninja
ninja

60
package/ci/travis-android-arm.sh

@ -0,0 +1,60 @@
#!/bin/bash
set -ev
git submodule update --init
# Corrade
git clone --depth 1 git://github.com/mosra/corrade.git
cd corrade
# Build native corrade-rc
mkdir build && cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$HOME/deps-native \
-DCMAKE_INSTALL_RPATH=$HOME/deps-native/lib \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_INTERCONNECT=OFF \
-DWITH_PLUGINMANAGER=OFF \
-DWITH_TESTSUITE=OFF
make -j install
cd ..
# Crosscompile Corrade
mkdir build-android-arm && cd build-android-arm
ANDROID_NDK=$TRAVIS_BUILD_DIR/android-ndk-r10e cmake .. \
-DCMAKE_TOOLCHAIN_FILE=../toolchains/generic/Android-ARM.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCORRADE_RC_EXECUTABLE=$HOME/deps-native/bin/corrade-rc \
-DCMAKE_INSTALL_PREFIX=$HOME/deps \
-DWITH_INTERCONNECT=OFF
make -j install
cd ..
cd ..
# Crosscompile
mkdir build-android-arm && cd build-android-arm
ANDROID_NDK=$TRAVIS_BUILD_DIR/android-ndk-r10e cmake .. \
-DCMAKE_TOOLCHAIN_FILE=../toolchains/generic/Android-ARM.cmake \
-DCORRADE_RC_EXECUTABLE=$HOME/deps-native/bin/corrade-rc \
-DCMAKE_PREFIX_PATH=$HOME/deps \
-DCMAKE_FIND_ROOT_PATH=$HOME/deps \
-DCMAKE_BUILD_TYPE=Release \
-DTARGET_GLES2=$TARGET_GLES2 \
-DWITH_AUDIO=OFF \
-DWITH_ANDROIDAPPLICATION=ON \
-DWITH_EGLCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_MAGNUMFONTCONVERTER=ON \
-DWITH_OBJIMPORTER=ON \
-DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON \
-DWITH_WAVAUDIOIMPORTER=OFF \
-DBUILD_TESTS=ON
make -j${JOBS_LIMIT}
# Start simulator and run tests
echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a
emulator -avd test -no-audio -no-window &
android-wait-for-emulator
CORRADE_TEST_COLOR=ON ctest -V

43
package/ci/travis-desktop-gles.sh

@ -0,0 +1,43 @@
#!/bin/bash
set -ev
# Corrade
git clone --depth 1 git://github.com/mosra/corrade.git
cd corrade
mkdir build && cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$HOME/deps \
-DCMAKE_INSTALL_RPATH=$HOME/deps/lib \
-DCMAKE_BUILD_TYPE=Release \
-DWITH_INTERCONNECT=OFF
make -j install
cd ../..
mkdir build && cd build
cmake .. \
-DCMAKE_CXX_FLAGS=$COVERAGE \
-DCMAKE_PREFIX_PATH="$HOME/deps" \
-DCMAKE_BUILD_TYPE=Release \
-DTARGET_GLES=ON \
-DTARGET_GLES2=$TARGET_GLES2 \
-DTARGET_DESKTOP_GLES=ON \
-DWITH_AUDIO=ON \
-DWITH_GLFWAPPLICATION=OFF \
-DWITH_SDL2APPLICATION=OFF \
-DWITH_WINDOWLESS${PLATFORM_GL_API}APPLICATION=ON \
-DWITH_${PLATFORM_GL_API}CONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_MAGNUMFONTCONVERTER=ON \
-DWITH_OBJIMPORTER=ON \
-DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON \
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_DISTANCEFIELDCONVERTER=OFF \
-DWITH_FONTCONVERTER=OFF \
-DWITH_IMAGECONVERTER=ON \
-DWITH_MAGNUMINFO=ON \
-DWITH_AL_INFO=ON \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON
make -j${JOBS_LIMIT}
CORRADE_TEST_COLOR=ON ctest -V -E GLTest

40
package/ci/travis-desktop.sh

@ -0,0 +1,40 @@
#!/bin/bash
set -ev
# Corrade
git clone --depth 1 git://github.com/mosra/corrade.git
cd corrade
mkdir build && cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$HOME/deps \
-DCMAKE_INSTALL_RPATH=$HOME/deps/lib \
-DCMAKE_BUILD_TYPE=Debug \
-DWITH_INTERCONNECT=OFF
make -j install
cd ../..
mkdir build && cd build
cmake .. \
-DCMAKE_CXX_FLAGS=$COVERAGE \
-DCMAKE_PREFIX_PATH="$HOME/deps;$HOME/sdl2;$HOME/glfw" \
-DCMAKE_BUILD_TYPE=Debug \
-DWITH_AUDIO=ON \
-DWITH_GLFWAPPLICATION=ON \
-DWITH_SDL2APPLICATION=ON \
-DWITH_WINDOWLESS${PLATFORM_GL_API}APPLICATION=ON \
-DWITH_${PLATFORM_GL_API}CONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_MAGNUMFONTCONVERTER=ON \
-DWITH_OBJIMPORTER=ON \
-DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON \
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_DISTANCEFIELDCONVERTER=ON \
-DWITH_FONTCONVERTER=ON \
-DWITH_IMAGECONVERTER=ON \
-DWITH_MAGNUMINFO=ON \
-DWITH_AL_INFO=ON \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON
make -j${JOBS_LIMIT}
CORRADE_TEST_COLOR=ON ctest -V -E GLTest

62
package/ci/travis-emscripten.sh

@ -0,0 +1,62 @@
#!/bin/bash
set -ev
git submodule update --init
# Corrade
git clone --depth 1 git://github.com/mosra/corrade.git
cd corrade
# Build native corrade-rc
mkdir build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$HOME/deps-native \
-DCMAKE_INSTALL_RPATH=$HOME/deps-native/lib \
-DWITH_INTERCONNECT=OFF \
-DWITH_PLUGINMANAGER=OFF \
-DWITH_TESTSUITE=OFF
make -j install
cd ..
# Crosscompile Corrade
mkdir build-emscripten && cd build-emscripten
cmake .. \
-DCORRADE_RC_EXECUTABLE=$HOME/deps-native/bin/corrade-rc \
-DCMAKE_TOOLCHAIN_FILE="../../toolchains/generic/Emscripten.cmake" \
-DEMSCRIPTEN_PREFIX=$(echo /usr/local/Cellar/emscripten/*/libexec) \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG -O1" \
-DCMAKE_EXE_LINKER_FLAGS_RELEASE="-O1" \
-DCMAKE_INSTALL_PREFIX=$HOME/deps \
-DWITH_INTERCONNECT=OFF
make -j install
cd ..
cd ..
# Crosscompile
mkdir build-emscripten && cd build-emscripten
cmake .. \
-DCORRADE_RC_EXECUTABLE=$HOME/deps-native/bin/corrade-rc \
-DCMAKE_TOOLCHAIN_FILE="../toolchains/generic/Emscripten.cmake" \
-DEMSCRIPTEN_PREFIX=$(echo /usr/local/Cellar/emscripten/*/libexec) \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS_RELEASE="-DNDEBUG -O1" \
-DCMAKE_EXE_LINKER_FLAGS_RELEASE="-O1" \
-DCMAKE_INSTALL_PREFIX=$HOME/deps \
-DCMAKE_FIND_ROOT_PATH=$HOME/deps \
-DWITH_AUDIO=ON \
-DWITH_SDL2APPLICATION=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_MAGNUMFONTCONVERTER=ON \
-DWITH_OBJIMPORTER=ON \
-DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON \
-DWITH_WAVAUDIOIMPORTER=ON \
-DBUILD_TESTS=ON \
-DTARGET_GLES2=$TARGET_GLES2
make -j4
# Test
CORRADE_TEST_COLOR=ON ctest -V -E ALTest

65
package/ci/travis-ios-simulator.sh

@ -0,0 +1,65 @@
#!/bin/bash
set -ev
git submodule update --init
# Corrade
git clone --depth 1 git://github.com/mosra/corrade.git
cd corrade
# Build native corrade-rc
mkdir build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$HOME/deps-native \
-DCMAKE_INSTALL_RPATH=$HOME/deps-native/lib \
-DWITH_INTERCONNECT=OFF \
-DWITH_PLUGINMANAGER=OFF \
-DWITH_TESTSUITE=OFF
make -j install
cd ..
# Crosscompile Corrade
mkdir build-ios && cd build-ios
cmake .. \
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/generic/iOS.cmake \
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk \
-DCMAKE_OSX_ARCHITECTURES="x86_64" \
-DCORRADE_RC_EXECUTABLE=$HOME/deps-native/bin/corrade-rc \
-DCMAKE_INSTALL_PREFIX=$HOME/deps \
-DBUILD_STATIC=ON \
-DTESTSUITE_TARGET_XCTEST=ON \
-DWITH_INTERCONNECT=OFF \
-G Xcode
cmake --build . --config Release --target install | xcpretty
cd ../..
# Crosscompile Magnum
mkdir build-ios && cd build-ios
cmake .. \
-DCMAKE_TOOLCHAIN_FILE=../toolchains/generic/iOS.cmake \
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk \
-DCMAKE_OSX_ARCHITECTURES="x86_64" \
-DCORRADE_RC_EXECUTABLE=$HOME/deps-native/bin/corrade-rc \
-DCMAKE_PREFIX_PATH="$HOME/deps;$TRAVIS_BUILD_DIR/sdl2" \
-DTARGET_GLES2=$TARGET_GLES2 \
-DWITH_AUDIO=ON \
-DWITH_SDL2APPLICATION=ON \
-DWITH_WINDOWLESSIOSAPPLICATION=ON \
-DWITH_EGLCONTEXT=ON \
-DWITH_MAGNUMFONT=ON \
-DWITH_MAGNUMFONTCONVERTER=ON \
-DWITH_OBJIMPORTER=ON \
-DWITH_TGAIMAGECONVERTER=ON \
-DWITH_TGAIMPORTER=ON \
-DWITH_WAVAUDIOIMPORTER=ON \
-DBUILD_STATIC=ON \
-DBUILD_PLUGINS_STATIC=ON \
-DBUILD_TESTS=ON \
-DBUILD_GL_TESTS=ON \
-G Xcode
cmake --build . --config Release | xcpretty
# TODO: find a better way to avoid
# Library not loaded: /System/Library/Frameworks/OpenGLES.framework/OpenGLES
# error
DYLD_FALLBACK_LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/OpenGLES.framework/ DYLD_FALLBACK_FRAMEWORK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks CORRADE_TEST_COLOR=ON ctest -V -C Release -E GLTest

124
package/ci/travis.yml

@ -1,8 +1,82 @@
# kate: indent-width 2;
os:
- linux
- osx
matrix:
include:
- language: cpp
os: linux
compiler: gcc
env:
- TARGET=desktop
# Otherwise the job gets killed (probably because using too much memory)
- JOBS_LIMIT=4
- language: cpp
os: linux
compiler: gcc
env:
- TARGET=desktop-gles
- TARGET_GLES2=ON
- JOBS_LIMIT=4
# Disabled because the Ubuntu 12.04 drivers are missing some ES3 entrypoints
# Should be enabled after moving to 14.04
#- language: cpp
#os: linux
#compiler: gcc
#env:
#- TARGET=desktop-gles
#- TARGET_GLES2=OFF
#- JOBS_LIMIT=4
- language: cpp
os: osx
compiler: clang
env: TARGET=desktop
- language: cpp
os: osx
osx_image: xcode7.3
env:
- TARGET=ios-simulator
- TARGET_GLES2=ON
- language: cpp
os: osx
osx_image: xcode7.3
env:
- TARGET=ios-simulator
- TARGET_GLES2=OFF
- language: cpp
os: osx
osx_image: xcode7.3
env:
- TARGET=emscripten
- TARGET_GLES2=ON
- language: cpp
os: osx
osx_image: xcode7.3
env:
- TARGET=emscripten
- TARGET_GLES2=OFF
- language: android
os: linux
env:
- TARGET=android
- TARGET_GLES2=ON
# Otherwise the job gets killed (probably because using too much memory)
- JOBS_LIMIT=4
android:
components:
- build-tools-19.0.0
- android-19
- sys-img-armeabi-v7a-android-19
- language: android
os: linux
env:
- TARGET=android
- TARGET_GLES2=OFF
# Otherwise the job gets killed (probably because using too much memory)
- JOBS_LIMIT=4
android:
components:
- build-tools-19.0.0
- android-19
- sys-img-armeabi-v7a-android-19
addons:
apt:
@ -27,34 +101,36 @@ cache:
- $HOME/sdl2
install:
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "desktop" ]; then pip install --user cpp-coveralls && export COVERAGE="--coverage"; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export CXX=g++-4.7; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export PLATFORM_GL_API=GLX; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then export PLATFORM_GL_API=CGL; fi
- printf "[General]\ndrivers=null" > ~/.alsoftrc
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "android" ]; then wget -nc http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin && chmod +x android-*.bin && ./android-*.bin -y | grep -v Extracting; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$TARGET" == "desktop" ]; then export PLATFORM_GL_API=CGL; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$TARGET" == "ios-simulator" ]; then gem install xcpretty; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$TARGET" == "emscripten" ]; then brew install emscripten && export LLVM=/usr/local/opt/emscripten/libexec/llvm/bin && emcc; fi
- if [ "$TARGET" == "desktop" ] || [ "$TARGET" == "desktop-gles" ]; then printf "[General]\ndrivers=null" > ~/.alsoftrc; fi
# SDL (cached)
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install sdl2; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ ! -e "$HOME/sdl2/include" ]; then curl -O http://www.libsdl.org/release/SDL2-2.0.4.tar.gz && tar -xzvf SDL2-2.0.4.tar.gz && cd SDL2-2.0.4 && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/sdl2 -DCMAKE_BUILD_TYPE=Release && cmake --build . --target install && cd ../..; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$TARGET" == "desktop" ]; then brew install sdl2; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$TARGET" == "ios-simulator" ]; then curl -O https://www.libsdl.org/release/SDL2-2.0.4.tar.gz && tar -xzvf SDL2-2.0.4.tar.gz && cd SDL2-2.0.4/Xcode-iOS/SDL && xcodebuild -sdk iphonesimulator9.3 | xcpretty && mkdir -p ../../../sdl2/lib && cp build/Release-iphonesimulator/libSDL2.a ../../../sdl2/lib && mkdir -p ../../../sdl2/include/SDL2 && cp -R ../../include/* ../../../sdl2/include/SDL2 && cd ../../..; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "desktop" ] && [ ! -e "$HOME/sdl2/include" ]; then curl -O http://www.libsdl.org/release/SDL2-2.0.4.tar.gz && tar -xzvf SDL2-2.0.4.tar.gz && cd SDL2-2.0.4 && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/sdl2 -DCMAKE_BUILD_TYPE=Release && cmake --build . --target install && cd ../..; fi
# GLFW (cached)
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install homebrew/versions/glfw3; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ ! -e "$HOME/glfw/include" ]; then wget https://github.com/glfw/glfw/releases/download/3.1.2/glfw-3.1.2.zip && unzip glfw-3.1.2.zip && cd glfw-3.1.2 && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/glfw -DCMAKE_BUILD_TYPE=Release -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF && cmake --build . --target install && cd ../..; fi
# Corrade
- git clone --depth 1 git://github.com/mosra/corrade.git
- cd corrade
- mkdir build
- cd build
- cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/deps -DCMAKE_INSTALL_RPATH=$HOME/deps/lib -DCMAKE_BUILD_TYPE=Release
- cmake --build .
- cmake --build . --target install
- cd ..
- cd ..
- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$TARGET" == "desktop" ]; then brew install homebrew/versions/glfw3; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "desktop" ] && [ ! -e "$HOME/glfw/include" ]; then wget https://github.com/glfw/glfw/releases/download/3.1.2/glfw-3.1.2.zip && unzip glfw-3.1.2.zip && cd glfw-3.1.2 && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/glfw -DCMAKE_BUILD_TYPE=Release -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF && cmake --build . --target install && cd ../..; fi
script:
- mkdir build && cd build
- cmake .. -DCMAKE_PREFIX_PATH="$HOME/deps;$HOME/sdl2;$HOME/glfw" -DCMAKE_BUILD_TYPE=Release -DWITH_AUDIO=ON -DWITH_GLFWAPPLICATION=ON -DWITH_SDL2APPLICATION=ON -DWITH_WINDOWLESS${PLATFORM_GL_API}APPLICATION=ON -DWITH_${PLATFORM_GL_API}CONTEXT=ON -DWITH_MAGNUMFONT=ON -DWITH_MAGNUMFONTCONVERTER=ON -DWITH_OBJIMPORTER=ON -DWITH_TGAIMAGECONVERTER=ON -DWITH_TGAIMPORTER=ON -DWITH_WAVAUDIOIMPORTER=ON -DWITH_DISTANCEFIELDCONVERTER=ON -DWITH_FONTCONVERTER=ON -DWITH_MAGNUMINFO=ON -DBUILD_TESTS=ON -DBUILD_GL_TESTS=ON
- cmake --build .
- ctest --output-on-failure -E GLTest
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "desktop" ]; then ./package/ci/travis-desktop.sh; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "desktop-gles" ]; then ./package/ci/travis-desktop-gles.sh; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "android" ]; then ./package/ci/travis-android-arm.sh; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$TARGET" == "desktop" ]; then ./package/ci/travis-desktop.sh; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$TARGET" == "ios-simulator" ]; then ./package/ci/travis-ios-simulator.sh; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ] && [ "$TARGET" == "emscripten" ]; then ./package/ci/travis-emscripten.sh; fi
# Travis somehow is not able to gather all output, try to force it using this
- sync
after_success:
# Ignoring all stuff that needs GL context and thus can't be run on Travis
- if [ "$TRAVIS_OS_NAME" == "linux" ] && [ "$TARGET" == "desktop" ]; then coveralls --gcov /usr/bin/gcov-4.7 -i src/ -E "(.*/(Test|MagnumExternal|Shaders|Platform)/.*|.*/src/Magnum/(AbstractFramebuffer|AbstractObject|AbstractQuery|AbstractShaderProgram|AbstractTexture|Buffer|BufferImage|BufferTexture|Context|CubeMapTexture|CubeMapTextureArray|DebugOutput|DefaultFramebuffer|Framebuffer|Mesh|MeshView|MultisampleTexture|OpenGL|PixelStorage|PrimitiveQuery|RectangleTexture|Renderbuffer|Renderer|SampleQuery|Sampler|Shader|Texture|TextureArray|TimeQuery|TransformFeedback|Implementation/BufferState|Implementation/DebugState|Implementation/driverSpecific|Implementation/FramebufferState|Implementation/maxTextureSize|Implementation/MeshState|Implementation/QueryState|Implementation/RendererState|Implementation/ShaderProgramState|Implementation/ShaderState|Implementation/State|Implementation/TextureState|Implementation/TransformFeedbackState)\\.(cpp|h))" --gcov-options '\-lp' > /dev/null; fi

2
package/debian/copyright vendored

@ -4,7 +4,7 @@ Upstream-Contact: Vladimír Vondruš <mosra@centrum.cz>
Source: https://github.com/mosra/magnum
Files: *
Copyright: 2010-2015 Vladimír Vondruš <mosra@centrum.cz>
Copyright: 2010-2016 Vladimír Vondruš <mosra@centrum.cz>
License: Expat
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),

4
package/debian/rules vendored

@ -17,8 +17,10 @@ override_dh_auto_configure:
-DWITH_TGAIMPORTER=ON \
-DWITH_WAVAUDIOIMPORTER=ON \
-DWITH_DISTANCEFIELDCONVERTER=ON \
-DWITH_IMAGECONVERTER=ON \
-DWITH_FONTCONVERTER=ON \
-DWITH_MAGNUMINFO=ON
-DWITH_MAGNUMINFO=ON \
-DWITH_AL_INFO=ON
# Extraordinarily coarse way to suppress error about libGL not being in
# dependencies when the user has installed NVidia binary drivers which are not

2
package/gentoo/dev-libs/magnum/magnum-9999.ebuild

@ -40,8 +40,10 @@ src_configure() {
-DWITH_TGAIMPORTER=ON
-DWITH_WAVAUDIOIMPORTER=ON
-DWITH_DISTANCEFIELDCONVERTER=ON
-DWITH_IMAGECONVERTER=ON
-DWITH_FONTCONVERTER=ON
-DWITH_MAGNUMINFO=ON
-DWITH_AL_INFO=ON
)
cmake-utils_src_configure
}

2
package/homebrew/magnum.rb

@ -12,7 +12,7 @@ class Magnum < Formula
def install
system "mkdir build"
cd "build" do
system "cmake", "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_INSTALL_PREFIX=#{prefix}", "-DWITH_AUDIO=ON", "-DWITH_SDL2APPLICATION=ON", "-DWITH_WINDOWLESSCGLAPPLICATION=ON", "-DWITH_CGLCONTEXT=ON", "-DWITH_MAGNUMFONT=ON", "-DWITH_MAGNUMFONTCONVERTER=ON", "-DWITH_OBJIMPORTER=ON", "-DWITH_TGAIMAGECONVERTER=ON", "-DWITH_TGAIMPORTER=ON", "-DWITH_WAVAUDIOIMPORTER=ON", "-DWITH_DISTANCEFIELDCONVERTER=ON", "-DWITH_FONTCONVERTER=ON", "-DWITH_MAGNUMINFO=ON", ".."
system "cmake", "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_INSTALL_PREFIX=#{prefix}", "-DWITH_AUDIO=ON", "-DWITH_SDL2APPLICATION=ON", "-DWITH_WINDOWLESSCGLAPPLICATION=ON", "-DWITH_CGLCONTEXT=ON", "-DWITH_MAGNUMFONT=ON", "-DWITH_MAGNUMFONTCONVERTER=ON", "-DWITH_OBJIMPORTER=ON", "-DWITH_TGAIMAGECONVERTER=ON", "-DWITH_TGAIMPORTER=ON", "-DWITH_WAVAUDIOIMPORTER=ON", "-DWITH_DISTANCEFIELDCONVERTER=ON", "-DWITH_FONTCONVERTER=ON", "-DWITH_IMAGECONVERTER=ON", "-DWITH_MAGNUMINFO=ON", "-DWITH_AL_INFO=ON", ".."
system "cmake", "--build", "."
system "cmake", "--build", ".", "--target", "install"
end

2
src/CMakeLists.txt

@ -32,7 +32,7 @@ endif()
# On MSVC remove /W3, as we are replacing it with /W4
if(MSVC)
string(REPLACE "/W3" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
string(REPLACE "/W3" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif()
# Emscripten needs special flag to use WebGL 2

178
src/Magnum/AbstractFramebuffer.cpp

@ -29,8 +29,19 @@
#include "Magnum/BufferImage.h"
#endif
#include "Magnum/Context.h"
#include "Magnum/CubeMapTexture.h"
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#include "Magnum/CubeMapTextureArray.h"
#endif
#include "Magnum/Extensions.h"
#include "Magnum/Image.h"
#ifndef MAGNUM_TARGET_GLES
#include "Magnum/RectangleTexture.h"
#endif
#include "Magnum/Texture.h"
#ifndef MAGNUM_TARGET_GLES2
#include "Magnum/TextureArray.h"
#endif
#include "Implementation/FramebufferState.h"
#include "Implementation/State.h"
@ -141,7 +152,7 @@ void AbstractFramebuffer::bindImplementationDefault(FramebufferTarget target) {
} else if(target == FramebufferTarget::Draw) {
if(state.drawBinding == _id) return;
state.drawBinding = _id;
} else CORRADE_ASSERT_UNREACHABLE();
} else CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
/* Binding the framebuffer finally creates it */
_flags |= ObjectFlag::Created;
@ -229,7 +240,7 @@ void AbstractFramebuffer::blitImplementationANGLE(AbstractFramebuffer& source, A
static_cast<void>(destinationRectangle);
static_cast<void>(mask);
static_cast<void>(filter);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -245,7 +256,7 @@ void AbstractFramebuffer::blitImplementationNV(AbstractFramebuffer& source, Abst
static_cast<void>(destinationRectangle);
static_cast<void>(mask);
static_cast<void>(filter);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
@ -331,6 +342,96 @@ BufferImage2D AbstractFramebuffer::read(const Range2Di& rectangle, BufferImage2D
}
#endif
#ifndef MAGNUM_TARGET_GLES
void AbstractFramebuffer::copyImage(const Range2Di& rectangle, Texture1D& texture, const Int level, const TextureFormat internalFormat) {
CORRADE_ASSERT(rectangle.sizeY() == 1, "AbstractFramebuffer::copyImage(): height must be 1 for 1D textures", );
bindInternal(FramebufferTarget::Read);
texture.bindInternal();
glCopyTexImage1D(GL_TEXTURE_1D, level, GLenum(internalFormat), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), 0);
}
#endif
void AbstractFramebuffer::copyImage(const Range2Di& rectangle, Texture2D& texture, const Int level, const TextureFormat internalFormat) {
bindInternal(FramebufferTarget::Read);
texture.bindInternal();
glCopyTexImage2D(GL_TEXTURE_2D, level, GLenum(internalFormat), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY(), 0);
}
#ifndef MAGNUM_TARGET_GLES
void AbstractFramebuffer::copyImage(const Range2Di& rectangle, RectangleTexture& texture, const TextureFormat internalFormat) {
bindInternal(FramebufferTarget::Read);
texture.bindInternal();
glCopyTexImage2D(GL_TEXTURE_RECTANGLE, 0, GLenum(internalFormat), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY(), 0);
}
#endif
void AbstractFramebuffer::copyImage(const Range2Di& rectangle, CubeMapTexture& texture, const CubeMapCoordinate coordinate, const Int level, const TextureFormat internalFormat) {
bindInternal(FramebufferTarget::Read);
texture.bindInternal();
glCopyTexImage2D(GLenum(coordinate), level, GLenum(internalFormat), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY(), 0);
}
#ifndef MAGNUM_TARGET_GLES
void AbstractFramebuffer::copyImage(const Range2Di& rectangle, Texture1DArray& texture, const Int level, const TextureFormat internalFormat) {
bindInternal(FramebufferTarget::Read);
texture.bindInternal();
glCopyTexImage2D(GL_TEXTURE_1D_ARRAY, level, GLenum(internalFormat), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY(), 0);
}
#endif
#ifndef MAGNUM_TARGET_GLES
void AbstractFramebuffer::copySubImage(const Range2Di& rectangle, Texture1D& texture, const Int level, const Int offset) {
CORRADE_ASSERT(rectangle.sizeY() == 1, "AbstractFramebuffer::copyImage(): height must be 1 for 1D textures", );
bindInternal(FramebufferTarget::Read);
Context::current().state().framebuffer->copySub1DImplementation(rectangle, texture, level, offset);
}
#endif
void AbstractFramebuffer::copySubImage(const Range2Di& rectangle, Texture2D& texture, const Int level, const Vector2i& offset) {
bindInternal(FramebufferTarget::Read);
Context::current().state().framebuffer->copySub2DImplementation(rectangle, texture, GL_TEXTURE_2D, level, offset);
}
#ifndef MAGNUM_TARGET_GLES
void AbstractFramebuffer::copySubImage(const Range2Di& rectangle, RectangleTexture& texture, const Vector2i& offset) {
bindInternal(FramebufferTarget::Read);
Context::current().state().framebuffer->copySub2DImplementation(rectangle, texture, GL_TEXTURE_RECTANGLE, 0, offset);
}
#endif
void AbstractFramebuffer::copySubImage(const Range2Di& rectangle, CubeMapTexture& texture, const Int level, const Vector3i& offset) {
bindInternal(FramebufferTarget::Read);
Context::current().state().framebuffer->copySubCubeMapImplementation(rectangle, texture, GL_TEXTURE_CUBE_MAP_POSITIVE_X + offset.z(), level, offset.xy());
}
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void AbstractFramebuffer::copySubImage(const Range2Di& rectangle, Texture3D& texture, const Int level, const Vector3i& offset) {
bindInternal(FramebufferTarget::Read);
Context::current().state().framebuffer->copySub3DImplementation(rectangle, texture, level, offset);
}
#endif
#ifndef MAGNUM_TARGET_GLES
void AbstractFramebuffer::copySubImage(const Range2Di& rectangle, Texture1DArray& texture, const Int level, const Vector2i& offset) {
bindInternal(FramebufferTarget::Read);
Context::current().state().framebuffer->copySub2DImplementation(rectangle, texture, GL_TEXTURE_1D_ARRAY, level, offset);
}
#endif
#ifndef MAGNUM_TARGET_GLES2
void AbstractFramebuffer::copySubImage(const Range2Di& rectangle, Texture2DArray& texture, const Int level, const Vector3i& offset) {
bindInternal(FramebufferTarget::Read);
Context::current().state().framebuffer->copySub3DImplementation(rectangle, texture, level, offset);
}
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void AbstractFramebuffer::copySubImage(const Range2Di& rectangle, CubeMapTextureArray& texture, const Int level, const Vector3i& offset) {
bindInternal(FramebufferTarget::Read);
Context::current().state().framebuffer->copySub3DImplementation(rectangle, texture, level, offset);
}
#endif
void AbstractFramebuffer::invalidateImplementationNoOp(GLsizei, const GLenum* const) {}
void AbstractFramebuffer::invalidateImplementationDefault(const GLsizei count, const GLenum* const attachments) {
@ -341,7 +442,7 @@ void AbstractFramebuffer::invalidateImplementationDefault(const GLsizei count, c
#else
static_cast<void>(count);
static_cast<void>(attachments);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -414,7 +515,7 @@ void AbstractFramebuffer::drawBuffersImplementationEXT(GLsizei count, const GLen
#else
static_cast<void>(count);
static_cast<void>(buffers);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -427,7 +528,7 @@ void AbstractFramebuffer::drawBuffersImplementationNV(GLsizei count, const GLenu
#else
static_cast<void>(count);
static_cast<void>(buffers);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
@ -460,14 +561,14 @@ void AbstractFramebuffer::readBufferImplementationDefault(GLenum buffer) {
glReadBufferNV(buffer);
#else
static_cast<void>(buffer);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
#ifndef MAGNUM_TARGET_GLES
void AbstractFramebuffer::readBufferImplementationDSA(const GLenum buffer) {
glFramebufferReadBufferEXT(_id, buffer);
glNamedFramebufferReadBuffer(_id, buffer);
}
void AbstractFramebuffer::readBufferImplementationDSAEXT(GLenum buffer) {
@ -492,8 +593,67 @@ void AbstractFramebuffer::readImplementationRobustness(const Range2Di& rectangle
static_cast<void>(type);
static_cast<void>(dataSize);
static_cast<void>(data);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
#ifndef MAGNUM_TARGET_GLES
void AbstractFramebuffer::copySub1DImplementationDefault(const Range2Di& rectangle, AbstractTexture& texture, const Int level, const Int offset) {
texture.bindInternal();
glCopyTexSubImage1D(texture._target, level, offset, rectangle.min().x(), rectangle.min().y(), rectangle.sizeX());
}
void AbstractFramebuffer::copySub1DImplementationDSA(const Range2Di& rectangle, AbstractTexture& texture, const Int level, const Int offset) {
glCopyTextureSubImage1D(texture._id, level, offset, rectangle.min().x(), rectangle.min().y(), rectangle.sizeX());
}
void AbstractFramebuffer::copySub1DImplementationDSAEXT(const Range2Di& rectangle, AbstractTexture& texture, const Int level, const Int offset) {
texture._flags |= ObjectFlag::Created;
glCopyTextureSubImage1DEXT(texture._id, texture._target, level, offset, rectangle.min().x(), rectangle.min().y(), rectangle.sizeX());
}
#endif
void AbstractFramebuffer::copySub2DImplementationDefault(const Range2Di& rectangle, AbstractTexture& texture, const GLenum target, const Int level, const Vector2i& offset) {
texture.bindInternal();
glCopyTexSubImage2D(target, level, offset.x(), offset.y(), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY());
}
#ifndef MAGNUM_TARGET_GLES
void AbstractFramebuffer::copySub2DImplementationDSA(const Range2Di& rectangle, AbstractTexture& texture, const GLenum, const Int level, const Vector2i& offset) {
glCopyTextureSubImage2D(texture._id, level, offset.x(), offset.y(), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY());
}
void AbstractFramebuffer::copySubCubeMapImplementationDSA(const Range2Di& rectangle, AbstractTexture& texture, const GLenum target, const Int level, const Vector2i& offset) {
glCopyTextureSubImage3D(texture._id, level, offset.x(), offset.y(), target - GL_TEXTURE_CUBE_MAP_POSITIVE_X, rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY());
}
void AbstractFramebuffer::copySub2DImplementationDSAEXT(const Range2Di& rectangle, AbstractTexture& texture, const GLenum target, const Int level, const Vector2i& offset) {
texture._flags |= ObjectFlag::Created;
glCopyTextureSubImage2DEXT(texture._id, target, level, offset.x(), offset.y(), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY());
}
#endif
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void AbstractFramebuffer::copySub3DImplementationDefault(const Range2Di& rectangle, AbstractTexture& texture, const Int level, const Vector3i& offset) {
texture.bindInternal();
#ifndef MAGNUM_TARGET_GLES2
glCopyTexSubImage3D
#else
glCopyTexSubImage3DOES
#endif
(texture._target, level, offset.x(), offset.y(), offset.z(), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY());
}
#endif
#ifndef MAGNUM_TARGET_GLES
void AbstractFramebuffer::copySub3DImplementationDSA(const Range2Di& rectangle, AbstractTexture& texture, const Int level, const Vector3i& offset) {
glCopyTextureSubImage3D(texture._id, level, offset.x(), offset.y(), offset.z(), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY());
}
void AbstractFramebuffer::copySub3DImplementationDSAEXT(const Range2Di& rectangle, AbstractTexture& texture, const Int level, const Vector3i& offset) {
texture._flags |= ObjectFlag::Created;
glCopyTextureSubImage3DEXT(texture._id, texture._target, level, offset.x(), offset.y(), offset.z(), rectangle.min().x(), rectangle.min().y(), rectangle.sizeX(), rectangle.sizeY());
}
#endif

326
src/Magnum/AbstractFramebuffer.h

@ -319,8 +319,8 @@ class MAGNUM_EXPORT AbstractFramebuffer {
*
* If @extension{ARB,robustness} is available, the operation is
* protected from buffer overflow.
* @see @fn_gl{BindFramebuffer}, @fn_gl{ReadPixels} or
* @fn_gl_extension{ReadnPixels,ARB,robustness}
* @see @fn_gl{BindFramebuffer}, then @fn_gl{PixelStore} and
* @fn_gl{ReadPixels} or @fn_gl_extension{ReadnPixels,ARB,robustness}
*/
void read(const Range2Di& rectangle, Image2D& image);
@ -383,6 +383,307 @@ class MAGNUM_EXPORT AbstractFramebuffer {
#endif
#endif
#ifndef MAGNUM_TARGET_GLES
/**
* @brief Copy block of pixels from framebuffer to 1D texture image
* @param rectangle Framebuffer rectangle to copy. Height must
* be `1`.
* @param texture Texture where to put the data
* @param level Texture mip level
* @param internalFormat Texture internal format
*
* On platforms that support it prefer to use @ref Texture1D::setStorage()
* and @ref copySubImage() instead, as it avoids unnecessary
* reallocations and has better performance characteristics. This call
* also has no equivalent in @extension{ARB,direct_state_access}, thus
* the texture needs to be bound to some texture unit before the
* operation.
* @see @ref Texture1D::maxSize(), @fn_gl{BindFramebuffer}, then
* @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{CopyTexImage1D}
* @requires_gl 1D textures are not available in OpenGL ES or WebGL.
* @deprecated_gl Prefer to use @ref Texture1D::setStorage() and
* @ref copySubImage() instead.
*/
void copyImage(const Range2Di& rectangle, Texture1D& texture, Int level, TextureFormat internalFormat);
#endif
/**
* @brief Copy block of pixels from framebuffer to 2D texture image
* @param rectangle Framebuffer rectangle to copy
* @param texture Texture where to put the data
* @param level Texture mip level
* @param internalFormat Texture internal format
*
* On platforms that support it prefer to use @ref Texture2D::setStorage()
* and @ref copySubImage() instead, as it avoids unnecessary
* reallocations and has better performance characteristics. This call
* also has no equivalent in @extension{ARB,direct_state_access}, thus
* the texture needs to be bound to some texture unit before the
* operation.
* @see @ref Texture2D::maxSize(), @fn_gl{BindFramebuffer}, then
* @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{CopyTexImage2D}
* @deprecated_gl Prefer to use @ref Texture2D::setStorage() and
* @ref copySubImage() instead.
*/
void copyImage(const Range2Di& rectangle, Texture2D& texture, Int level, TextureFormat internalFormat);
#ifndef MAGNUM_TARGET_GLES
/**
* @brief Copy block of pixels from framebuffer to rectangle texture
* @param rectangle Framebuffer rectangle to copy
* @param texture Texture where to put the data
* @param internalFormat Texture internal format
*
* On platforms that support it prefer to use @ref RectangleTexture::setStorage()
* and @ref copySubImage() instead, as it avoids unnecessary
* reallocations and has better performance characteristics. This call
* also has no equivalent in @extension{ARB,direct_state_access}, thus
* the texture needs to be bound to some texture unit before the
* operation.
* @see @ref Texture2D::maxSize(), @fn_gl{BindFramebuffer}, then
* @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{CopyTexImage2D}
* @requires_gl31 Extension @extension{ARB,texture_rectangle}
* @requires_gl Rectangle textures are not available in OpenGL ES and
* WebGL.
* @deprecated_gl Prefer to use @ref RectangleTexture::setStorage() and
* @ref copySubImage() instead.
*/
void copyImage(const Range2Di& rectangle, RectangleTexture& texture, TextureFormat internalFormat);
#endif
/**
* @brief Copy block of pixels from framebuffer to cube map texture image
* @param rectangle Framebuffer rectangle to copy
* @param texture Texture where to put the data
* @param level Texture mip level
* @param coordinate Cube map coordinate
* @param internalFormat Texture internal format
*
* On platforms that support it prefer to use @ref CubeMapTexture::setStorage()
* and @ref copySubImage() instead, as it avoids unnecessary
* reallocations and has better performance characteristics. This call
* also has no equivalent in @extension{ARB,direct_state_access}, thus
* the texture needs to be bound to some texture unit before the
* operation.
* @see @ref Texture2D::maxSize(), @fn_gl{BindFramebuffer}, then
* @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{CopyTexImage2D}
* @deprecated_gl Prefer to use @ref CubeMapTexture::setStorage() and
* @ref copySubImage() instead.
*/
void copyImage(const Range2Di& rectangle, CubeMapTexture& texture, CubeMapCoordinate coordinate, Int level, TextureFormat internalFormat);
#ifndef MAGNUM_TARGET_GLES
/**
* @brief Copy block of pixels from framebuffer to 1D texture array image
* @param rectangle Framebuffer rectangle to copy
* @param texture Texture where to put the data
* @param level Texture mip level
* @param internalFormat Texture internal format
*
* On platforms that support it prefer to use @ref Texture2D::setStorage()
* and @ref copySubImage() instead, as it avoids unnecessary
* reallocations and has better performance characteristics. This call
* also has no equivalent in @extension{ARB,direct_state_access}, thus
* the texture needs to be bound to some texture unit before the
* operation.
* @see @ref Texture2D::maxSize(), @fn_gl{BindFramebuffer}, then
* @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{CopyTexImage2D}
* @requires_gl 1D array textures are not available in OpenGL ES or
* WebGL, only 2D ones.
* @deprecated_gl Prefer to use @ref Texture1DArray::setStorage() and
* @ref copySubImage() instead.
*/
void copyImage(const Range2Di& rectangle, Texture1DArray& texture, Int level, TextureFormat internalFormat);
#endif
#ifndef MAGNUM_TARGET_GLES
/**
* @brief Copy block of pixels from framebuffer to 1D texture subimage
* @param rectangle Framebuffer rectangle to copy. Height must
* be `1`.
* @param texture Texture where to put the data
* @param level Texture mip level
* @param offset Offset inside the texture
*
* If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
* nor @extension{EXT,direct_state_access} desktop extension is
* available, the texture is bound before the operation (if not
* already).
* @see @ref Texture1D::setStorage(), @fn_gl{BindFramebuffer}, then
* @fn_gl2{CopyTextureSubImage1D,CopyTexSubImage1D},
* @fn_gl_extension{CopyTextureSubImage1D,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{CopyTexSubImage1D}
* @requires_gl 1D textures are not available in OpenGL ES or WebGL.
*/
void copySubImage(const Range2Di& rectangle, Texture1D& texture, Int level, Int offset);
#endif
/**
* @brief Copy block of pixels from framebuffer to 2D texture subimage
* @param rectangle Framebuffer rectangle to copy
* @param texture Texture where to put the data
* @param level Texture mip level
* @param offset Offset inside the texture
*
* If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
* nor @extension{EXT,direct_state_access} desktop extension is
* available, the texture is bound before the operation (if not
* already).
* @see @ref Texture2D::setStorage(), @fn_gl{BindFramebuffer}, then
* @fn_gl2{CopyTextureSubImage2D,CopyTexSubImage2D},
* @fn_gl_extension{CopyTextureSubImage2D,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{CopyTexSubImage2D}
*/
void copySubImage(const Range2Di& rectangle, Texture2D& texture, Int level, const Vector2i& offset);
#ifndef MAGNUM_TARGET_GLES
/**
* @brief Copy block of pixels from framebuffer to rectangle texture subimage
* @param rectangle Framebuffer rectangle to copy
* @param texture Texture where to put the data
* @param offset Offset inside the texture
*
* If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
* nor @extension{EXT,direct_state_access} desktop extension is
* available, the texture is bound before the operation (if not
* already).
* @see @ref RectangleTexture::setStorage(), @fn_gl{BindFramebuffer},
* then @fn_gl2{CopyTextureSubImage2D,CopyTexSubImage2D},
* @fn_gl_extension{CopyTextureSubImage2D,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{CopyTexSubImage2D}
* @requires_gl Rectangle textures are not available in OpenGL ES and
* WebGL.
*/
void copySubImage(const Range2Di& rectangle, RectangleTexture& texture, const Vector2i& offset);
#endif
/**
* @brief Copy block of pixels from framebuffer to cube map texture subimage
* @param rectangle Framebuffer rectangle to copy
* @param texture Texture where to put the data
* @param level Texture mip level
* @param offset Offset inside the texture
*
* Z coordinate of the offset is equivalent to number of texture face,
* i.e. +X is `0` and so on, in order of (+X, -X, +Y, -Y, +Z, -Z). If
* neither @extension{ARB,direct_state_access} (part of OpenGL 4.5) nor
* @extension{EXT,direct_state_access} desktop extension is available,
* the texture is bound before the operation (if not already).
* @see @ref CubeMapTexture::setStorage(), @fn_gl{BindFramebuffer},
* then @fn_gl2{CopyTextureSubImage3D,CopyTexSubImage3D},
* @fn_gl_extension{CopyTextureSubImage2D,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{CopyTexSubImage2D}
*/
void copySubImage(const Range2Di& rectangle, CubeMapTexture& texture, Int level, const Vector3i& offset);
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/**
* @brief Copy block of pixels from framebuffer to 3D texture subimage
* @param rectangle Framebuffer rectangle to copy
* @param texture Texture where to put the data
* @param level Texture mip level
* @param offset Offset inside the texture
*
* If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
* nor @extension{EXT,direct_state_access} desktop extension is
* available, the texture is bound before the operation (if not
* already).
* @see @ref Texture3D::setStorage(), @fn_gl{BindFramebuffer}, then
* @fn_gl2{CopyTextureSubImage3D,CopyTexSubImage3D},
* @fn_gl_extension{CopyTextureSubImage3D,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{CopyTexSubImage3D}
* @requires_gles30 Extension @es_extension{OES,texture_3D} in OpenGL
* ES 2.0.
* @requires_webgl20 Only 2D textures are available in WebGL 1.0.
*/
void copySubImage(const Range2Di& rectangle, Texture3D& texture, Int level, const Vector3i& offset);
#endif
#ifndef MAGNUM_TARGET_GLES
/**
* @brief Copy block of pixels from framebuffer to 1D texture array subimage
* @param rectangle Framebuffer rectangle to copy
* @param texture Texture where to put the data
* @param level Texture mip level
* @param offset Offset inside the texture
*
* If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
* nor @extension{EXT,direct_state_access} desktop extension is
* available, the texture is bound before the operation (if not
* already).
* @see @ref Texture1DArray::setStorage(), @fn_gl{BindFramebuffer},
* then @fn_gl2{CopyTextureSubImage2D,CopyTexSubImage2D},
* @fn_gl_extension{CopyTextureSubImage2D,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{CopyTexSubImage2D}
* @requires_gl 1D array textures are not available in OpenGL ES or
* WebGL, only 2D ones.
*/
void copySubImage(const Range2Di& rectangle, Texture1DArray& texture, Int level, const Vector2i& offset);
#endif
#ifndef MAGNUM_TARGET_GLES2
/**
* @brief Copy block of pixels from framebuffer to 2D texture array subimage
* @param rectangle Framebuffer rectangle to copy
* @param texture Texture where to put the data
* @param level Texture mip level
* @param offset Offset inside the texture
*
* If neither @extension{ARB,direct_state_access} (part of OpenGL 4.5)
* nor @extension{EXT,direct_state_access} desktop extension is
* available, the texture is bound before the operation (if not
* already).
* @see @ref Texture2DArray::setStorage(), @fn_gl{BindFramebuffer},
* then @fn_gl2{CopyTextureSubImage3D,CopyTexSubImage3D},
* @fn_gl_extension{CopyTextureSubImage3D,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{CopyTexSubImage3D}
* @requires_gl30 Extension @extension{EXT,texture_array}
* @requires_gles30 Array textures are not available in OpenGL ES 2.0.
* @requires_webgl20 Array textures are not available in WebGL 1.0.
*/
void copySubImage(const Range2Di& rectangle, Texture2DArray& texture, Int level, const Vector3i& offset);
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
/**
* @brief Copy block of pixels from framebuffer to cube map texture array subimage
* @param rectangle Framebuffer rectangle to copy
* @param texture Texture where to put the data
* @param level Texture mip level
* @param offset Offset inside the texture
*
* Z coordinate of the offset is equivalent to layer * 6 + number of
* texture face, i.e. +X is `0` and so on, in order of (+X, -X, +Y, -Y,
* +Z, -Z). If neither @extension{ARB,direct_state_access} (part of
* OpenGL 4.5) nor @extension{EXT,direct_state_access} desktop
* available, the texture is bound before the operation (if not
* already).
* @see @ref CubeMapTextureArray::setStorage(), @fn_gl{BindFramebuffer},
* then @fn_gl2{CopyTextureSubImage3D,CopyTexSubImage3D},
* @fn_gl_extension{CopyTextureSubImage3D,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{CopyTexSubImage3D}
* @requires_gl40 Extension @extension{ARB,texture_cube_map_array}
* @requires_gles30 Not defined in OpenGL ES 2.0.
* @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,texture_cube_map_array}
* @requires_gles Cube map texture arrays are not available in WebGL.
*/
void copySubImage(const Range2Di& rectangle, CubeMapTextureArray& texture, Int level, const Vector3i& offset);
#endif
#ifdef DOXYGEN_GENERATING_OUTPUT
private:
#else
@ -462,6 +763,27 @@ class MAGNUM_EXPORT AbstractFramebuffer {
static void MAGNUM_LOCAL readImplementationRobustness(const Range2Di& rectangle, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data);
#endif
#ifndef MAGNUM_TARGET_GLES
static void MAGNUM_LOCAL copySub1DImplementationDefault(const Range2Di& rectangle, AbstractTexture& texture, Int level, Int offset);
static void MAGNUM_LOCAL copySub1DImplementationDSA(const Range2Di& rectangle, AbstractTexture& texture, Int level, Int offset);
static void MAGNUM_LOCAL copySub1DImplementationDSAEXT(const Range2Di& rectangle, AbstractTexture& texture, Int level, Int offset);
#endif
static void MAGNUM_LOCAL copySub2DImplementationDefault(const Range2Di& rectangle, AbstractTexture& texture, GLenum textureTarget, Int level, const Vector2i& offset);
#ifndef MAGNUM_TARGET_GLES
static void MAGNUM_LOCAL copySub2DImplementationDSA(const Range2Di& rectangle, AbstractTexture& texture, GLenum textureTarget, Int level, const Vector2i& offset);
static void MAGNUM_LOCAL copySubCubeMapImplementationDSA(const Range2Di& rectangle, AbstractTexture& texture, GLenum textureTarget, Int level, const Vector2i& offset);
static void MAGNUM_LOCAL copySub2DImplementationDSAEXT(const Range2Di& rectangle, AbstractTexture& texture, GLenum textureTarget, Int level, const Vector2i& offset);
#endif
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
static void MAGNUM_LOCAL copySub3DImplementationDefault(const Range2Di& rectangle, AbstractTexture& texture, Int level, const Vector3i& offset);
#endif
#ifndef MAGNUM_TARGET_GLES
static void MAGNUM_LOCAL copySub3DImplementationDSA(const Range2Di& rectangle, AbstractTexture& texture, Int level, const Vector3i& offset);
static void MAGNUM_LOCAL copySub3DImplementationDSAEXT(const Range2Di& rectangle, AbstractTexture& texture, Int level, const Vector3i& offset);
#endif
void MAGNUM_LOCAL invalidateImplementationNoOp(GLsizei, const GLenum*);
void MAGNUM_LOCAL invalidateImplementationDefault(GLsizei count, const GLenum* attachments);
#ifndef MAGNUM_TARGET_GLES

14
src/Magnum/AbstractObject.cpp

@ -107,7 +107,7 @@ namespace {
return khrIdentifier;
}
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
}
}
#endif
@ -140,7 +140,7 @@ void AbstractObject::labelImplementationKhr(const GLenum identifier, const GLuin
static_cast<void>(identifier);
static_cast<void>(name);
static_cast<void>(label);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -152,7 +152,7 @@ void AbstractObject::labelImplementationExt(const GLenum identifier, const GLuin
static_cast<void>(identifier);
static_cast<void>(name);
static_cast<void>(label);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -169,7 +169,7 @@ std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, c
#else
static_cast<void>(identifier);
static_cast<void>(name);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
/* Make place also for the null terminator */
@ -180,7 +180,7 @@ std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, c
#elif !defined(CORRADE_TARGET_NACL)
glGetObjectLabelKHR(identifier, name, size+1, nullptr, &label[0]);
#else
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
/* Pop null terminator and return the string */
@ -198,7 +198,7 @@ std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, c
#else
static_cast<void>(identifier);
static_cast<void>(name);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
/* Make place also for the null terminator */
@ -207,7 +207,7 @@ std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, c
#ifndef CORRADE_TARGET_NACL
glGetObjectLabelEXT(type, name, size+1, nullptr, &label[0]);
#else
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
/* Pop null terminator and return the string */

10
src/Magnum/AbstractQuery.cpp

@ -55,7 +55,7 @@ AbstractQuery::~AbstractQuery() {
#elif !defined(CORRADE_TARGET_EMSCRIPTEN)
glDeleteQueriesEXT(1, &_id);
#else
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
_flags |= ObjectFlag::Created;
}
@ -66,7 +66,7 @@ void AbstractQuery::createImplementationDefault() {
#elif !defined(CORRADE_TARGET_EMSCRIPTEN)
glGenQueriesEXT(1, &_id);
#else
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -126,7 +126,7 @@ template<> Int AbstractQuery::result<Int>() {
#elif !defined(CORRADE_TARGET_NACL)
glGetQueryObjectivEXT(_id, GL_QUERY_RESULT_EXT, &result);
#else
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
return result;
}
@ -138,7 +138,7 @@ template<> UnsignedLong AbstractQuery::result<UnsignedLong>() {
#elif !defined(CORRADE_TARGET_NACL)
glGetQueryObjectui64vEXT(_id, GL_QUERY_RESULT_EXT, &result);
#else
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
return result;
}
@ -150,7 +150,7 @@ template<> Long AbstractQuery::result<Long>() {
#elif !defined(CORRADE_TARGET_NACL)
glGetQueryObjecti64vEXT(_id, GL_QUERY_RESULT_EXT, &result);
#else
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
return result;
}

10
src/Magnum/AbstractQuery.h

@ -136,11 +136,10 @@ class MAGNUM_EXPORT AbstractQuery: public AbstractObject {
* See @ref resultAvailable().
* @see @fn_gl{GetQueryObject} with @def_gl{QUERY_RESULT}
* @requires_gl33 Extension @extension{ARB,timer_query} for result
* type @ref Magnum::UnsignedInt "UnsignedInt" and @ref Magnum::Long
* "Long"
* type @ref Magnum::UnsignedLong "UnsignedLong" and @ref Magnum::Long "Long"
* @requires_es_extension Extension @es_extension{EXT,disjoint_timer_query}
* for result types @ref Magnum::Int "Int", @ref Magnum::UnsignedLong "UnsignedLong"
* @ref Magnum::Long "Long".
* and @ref Magnum::Long "Long".
* @requires_gles Only @ref Magnum::UnsignedInt "UnsignedInt" result
* type is available in WebGL.
*/
@ -184,6 +183,9 @@ class MAGNUM_EXPORT AbstractQuery: public AbstractObject {
void begin(GLenum target);
#endif
GLuint _id;
GLenum _target;
private:
#ifndef MAGNUM_TARGET_WEBGL
AbstractQuery& setLabelInternal(Containers::ArrayView<const char> label);
@ -194,8 +196,6 @@ class MAGNUM_EXPORT AbstractQuery: public AbstractObject {
void MAGNUM_LOCAL createImplementationDSA();
#endif
GLuint _id;
GLenum _target;
ObjectFlags _flags;
};

39
src/Magnum/AbstractShaderProgram.cpp

@ -368,6 +368,10 @@ void AbstractShaderProgram::bindFragmentDataLocationIndexedInternal(const Unsign
#ifndef MAGNUM_TARGET_GLES2
void AbstractShaderProgram::setTransformFeedbackOutputs(const std::initializer_list<std::string> outputs, const TransformFeedbackBufferMode bufferMode) {
(this->*Context::current().state().shaderProgram->transformFeedbackVaryingsImplementation)({outputs.begin(), outputs.size()}, bufferMode);
}
void AbstractShaderProgram::transformFeedbackVaryingsImplementationDefault(const Containers::ArrayView<const std::string> outputs, const TransformFeedbackBufferMode bufferMode) {
/** @todo VLAs */
Containers::Array<const char*> names{outputs.size()};
@ -376,6 +380,19 @@ void AbstractShaderProgram::setTransformFeedbackOutputs(const std::initializer_l
glTransformFeedbackVaryings(_id, outputs.size(), names, GLenum(bufferMode));
}
#ifdef CORRADE_TARGET_WINDOWS
void AbstractShaderProgram::transformFeedbackVaryingsImplementationDanglingWorkaround(const Containers::ArrayView<const std::string> outputs, const TransformFeedbackBufferMode bufferMode) {
/* NVidia on Windows doesn't copy the names when calling
glTransformFeedbackVaryings() so it then fails at link time because the
char* are dangling. We have to do the copy on the engine side and keep
the values until link time (which can happen any time and multiple
times, so basically for the remaining lifetime of the shader program) */
_transformFeedbackVaryingNames.assign(outputs.begin(), outputs.end());
transformFeedbackVaryingsImplementationDefault({_transformFeedbackVaryingNames.data(), _transformFeedbackVaryingNames.size()}, bufferMode);
}
#endif
#endif
bool AbstractShaderProgram::link(std::initializer_list<std::reference_wrapper<AbstractShaderProgram>> shaders) {
@ -478,7 +495,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
static_cast<void>(location);
static_cast<void>(count);
static_cast<void>(values);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
@ -506,7 +523,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
static_cast<void>(location);
static_cast<void>(count);
static_cast<void>(values);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
@ -534,7 +551,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
static_cast<void>(location);
static_cast<void>(count);
static_cast<void>(values);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
@ -562,7 +579,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
static_cast<void>(location);
static_cast<void>(count);
static_cast<void>(values);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
@ -590,7 +607,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
static_cast<void>(location);
static_cast<void>(count);
static_cast<void>(values);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
@ -618,7 +635,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
static_cast<void>(location);
static_cast<void>(count);
static_cast<void>(values);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
@ -646,7 +663,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
static_cast<void>(location);
static_cast<void>(count);
static_cast<void>(values);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
@ -674,7 +691,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
static_cast<void>(location);
static_cast<void>(count);
static_cast<void>(values);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
@ -850,7 +867,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
static_cast<void>(location);
static_cast<void>(count);
static_cast<void>(values);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
@ -878,7 +895,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
static_cast<void>(location);
static_cast<void>(count);
static_cast<void>(values);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
@ -906,7 +923,7 @@ void AbstractShaderProgram::uniformImplementationDSAEXT_SSOEXT(const GLint locat
static_cast<void>(location);
static_cast<void>(count);
static_cast<void>(values);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif

17
src/Magnum/AbstractShaderProgram.h

@ -36,6 +36,10 @@
#include "Magnum/AbstractObject.h"
#include "Magnum/Attribute.h"
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_TARGET_GLES2)
#include <vector>
#endif
namespace Magnum {
namespace Implementation { struct ShaderProgramState; }
@ -1189,6 +1193,13 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
Int uniformLocationInternal(Containers::ArrayView<const char> name);
UnsignedInt uniformBlockIndexInternal(Containers::ArrayView<const char> name);
#ifndef MAGNUM_TARGET_GLES2
void MAGNUM_LOCAL transformFeedbackVaryingsImplementationDefault(Containers::ArrayView<const std::string> outputs, TransformFeedbackBufferMode bufferMode);
#ifdef CORRADE_TARGET_WINDOWS
void MAGNUM_LOCAL transformFeedbackVaryingsImplementationDanglingWorkaround(Containers::ArrayView<const std::string> outputs, TransformFeedbackBufferMode bufferMode);
#endif
#endif
#ifndef MAGNUM_BUILD_DEPRECATED
void use();
#endif
@ -1347,6 +1358,12 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject {
#endif
GLuint _id;
#if defined(CORRADE_TARGET_WINDOWS) && !defined(MAGNUM_TARGET_GLES2)
/* Needed for the nv-windows-dangling-transform-feedback-varying-names
workaround */
std::vector<std::string> _transformFeedbackVaryingNames;
#endif
};
}

20
src/Magnum/AbstractTexture.cpp

@ -808,7 +808,7 @@ PixelFormat AbstractTexture::imageFormatForInternalFormat(const TextureFormat in
return PixelFormat::DepthStencil;
}
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
}
PixelType AbstractTexture::imageTypeForInternalFormat(const TextureFormat internalFormat) {
@ -1053,7 +1053,7 @@ PixelType AbstractTexture::imageTypeForInternalFormat(const TextureFormat intern
#endif
}
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
}
#endif
@ -1254,7 +1254,7 @@ void AbstractTexture::storageImplementationFallback(const GLsizei levels, const
#endif
/* No other targets are available */
} else CORRADE_ASSERT_UNREACHABLE();
} else CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
}
#endif
@ -1269,7 +1269,7 @@ void AbstractTexture::storageImplementationDefault(GLsizei levels, TextureFormat
static_cast<void>(levels);
static_cast<void>(internalFormat);
static_cast<void>(size);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
@ -1313,7 +1313,7 @@ void AbstractTexture::storageImplementationFallback(GLsizei levels, TextureForma
#endif
/* No other targets are available */
else CORRADE_ASSERT_UNREACHABLE();
else CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
}
#endif
@ -1328,7 +1328,7 @@ void AbstractTexture::storageImplementationDefault(GLsizei levels, TextureFormat
static_cast<void>(levels);
static_cast<void>(internalFormat);
static_cast<void>(size);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
@ -1511,7 +1511,7 @@ void AbstractTexture::subImageImplementationDefault(GLint level, const Vector3i&
static_cast<void>(format);
static_cast<void>(type);
static_cast<void>(data);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -1527,7 +1527,7 @@ void AbstractTexture::compressedSubImageImplementationDefault(const GLint level,
static_cast<void>(size);
static_cast<void>(format);
static_cast<void>(data);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
@ -1995,7 +1995,7 @@ void AbstractTexture::DataHelper<3>::setImage(AbstractTexture& texture, const GL
static_cast<void>(level);
static_cast<void>(internalFormat);
static_cast<void>(image);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -2016,7 +2016,7 @@ void AbstractTexture::DataHelper<3>::setCompressedImage(AbstractTexture& texture
#else
static_cast<void>(level);
static_cast<void>(image);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif

1
src/Magnum/AbstractTexture.h

@ -133,6 +133,7 @@ functions do nothing.
*/
class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
friend Implementation::TextureState;
friend AbstractFramebuffer;
friend CubeMapTexture;
public:

62
src/Magnum/Attribute.cpp

@ -49,7 +49,7 @@ UnsignedInt FloatAttribute::size(GLint components, DataType dataType) {
#endif
}
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
}
#ifndef MAGNUM_TARGET_GLES2
@ -66,7 +66,7 @@ UnsignedInt IntAttribute::size(GLint components, DataType dataType) {
return 4*components;
}
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
}
#endif
@ -77,7 +77,7 @@ UnsignedInt DoubleAttribute::size(GLint components, DataType dataType) {
return 8*components;
}
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
}
#endif
@ -103,7 +103,7 @@ UnsignedInt Attribute<Math::Vector<3, Float>>::size(GLint components, DataType d
#endif
}
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
}
UnsignedInt Attribute<Math::Vector<4, Float>>::size(GLint components, DataType dataType) {
@ -136,44 +136,51 @@ UnsignedInt Attribute<Math::Vector<4, Float>>::size(GLint components, DataType d
#endif
}
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
}
Debug& operator<<(Debug& debug, SizedAttribute<1, 1>::Components value) {
switch(value) {
/* LCOV_EXCL_START */
case SizedAttribute<1, 1>::Components::One:
return debug << "Attribute::Components::One";
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::Components::(invalid)";
return debug << "Attribute::Components(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, SizedAttribute<1, 2>::Components value) {
switch(value) {
/* LCOV_EXCL_START */
case SizedAttribute<1, 2>::Components::One:
return debug << "Attribute::Components::One";
case SizedAttribute<1, 2>::Components::Two:
return debug << "Attribute::Components::Two";
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::Components::(invalid)";
return debug << "Attribute::Components(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, SizedAttribute<1, 3>::Components value) {
switch(value) {
/* LCOV_EXCL_START */
case SizedAttribute<1, 3>::Components::One:
return debug << "Attribute::Components::One";
case SizedAttribute<1, 3>::Components::Two:
return debug << "Attribute::Components::Two";
case SizedAttribute<1, 3>::Components::Three:
return debug << "Attribute::Components::Three";
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::Components::(invalid)";
return debug << "Attribute::Components(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, SizedAttribute<1, 4>::Components value) {
switch(value) {
/* LCOV_EXCL_START */
case SizedAttribute<1, 4>::Components::One:
return debug << "Attribute::Components::One";
case SizedAttribute<1, 4>::Components::Two:
@ -182,40 +189,48 @@ Debug& operator<<(Debug& debug, SizedAttribute<1, 4>::Components value) {
return debug << "Attribute::Components::Three";
case SizedAttribute<1, 4>::Components::Four:
return debug << "Attribute::Components::Four";
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::Components::(invalid)";
return debug << "Attribute::Components(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, SizedMatrixAttribute<2>::Components value) {
switch(value) {
/* LCOV_EXCL_START */
case SizedMatrixAttribute<2>::Components::Two:
return debug << "Attribute::Components::Two";
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::Components::(invalid)";
return debug << "Attribute::Components(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, SizedMatrixAttribute<3>::Components value) {
switch(value) {
/* LCOV_EXCL_START */
case SizedMatrixAttribute<3>::Components::Three:
return debug << "Attribute::Components::Three";
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::Components::(invalid)";
return debug << "Attribute::Components(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, SizedMatrixAttribute<4>::Components value) {
switch(value) {
/* LCOV_EXCL_START */
case SizedMatrixAttribute<4>::Components::Four:
return debug << "Attribute::Components::Four";
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::Components::(invalid)";
return debug << "Attribute::Components(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, Attribute<Math::Vector<4, Float>>::Components value) {
switch(value) {
/* LCOV_EXCL_START */
case Attribute<Math::Vector<4, Float>>::Components::One:
return debug << "Attribute::Components::One";
case Attribute<Math::Vector<4, Float>>::Components::Two:
@ -228,13 +243,15 @@ Debug& operator<<(Debug& debug, Attribute<Math::Vector<4, Float>>::Components va
case Attribute<Math::Vector<4, Float>>::Components::BGRA:
return debug << "Attribute::Components::BGRA";
#endif
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::Components::(invalid)";
return debug << "Attribute::Components(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, FloatAttribute::DataType value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case FloatAttribute::DataType::value: return debug << "Attribute::DataType::" #value;
_c(UnsignedByte)
_c(Byte)
@ -248,14 +265,16 @@ Debug& operator<<(Debug& debug, FloatAttribute::DataType value) {
_c(Double)
#endif
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::DataType::(invalid)";
return debug << "Attribute::DataType(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#ifndef MAGNUM_TARGET_GLES2
Debug& operator<<(Debug& debug, IntAttribute::DataType value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case IntAttribute::DataType::value: return debug << "Attribute::DataType::" #value;
_c(UnsignedByte)
_c(Byte)
@ -264,26 +283,30 @@ Debug& operator<<(Debug& debug, IntAttribute::DataType value) {
_c(UnsignedInt)
_c(Int)
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::DataType::(invalid)";
return debug << "Attribute::DataType(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif
#ifndef MAGNUM_TARGET_GLES
Debug& operator<<(Debug& debug, DoubleAttribute::DataType value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case DoubleAttribute::DataType::value: return debug << "Attribute::DataType::" #value;
_c(Double)
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::DataType::(invalid)";
return debug << "Attribute::DataType(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif
Debug& operator<<(Debug& debug, Attribute<Math::Vector<3, Float>>::DataType value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case Attribute<Math::Vector<3, Float>>::DataType::value: return debug << "Attribute::DataType::" #value;
_c(UnsignedByte)
_c(Byte)
@ -298,13 +321,15 @@ Debug& operator<<(Debug& debug, Attribute<Math::Vector<3, Float>>::DataType valu
_c(UnsignedInt10f11f11fRev)
#endif
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::DataType::(invalid)";
return debug << "Attribute::DataType(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, Attribute<Math::Vector<4, Float>>::DataType value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case Attribute<Math::Vector<4, Float>>::DataType::value: return debug << "Attribute::DataType::" #value;
_c(UnsignedByte)
_c(Byte)
@ -322,9 +347,10 @@ Debug& operator<<(Debug& debug, Attribute<Math::Vector<4, Float>>::DataType valu
_c(Int2101010Rev)
#endif
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "Attribute::DataType::(invalid)";
return debug << "Attribute::DataType(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
}}

4
src/Magnum/Attribute.h

@ -171,7 +171,11 @@ template<UnsignedInt location, class T> class Attribute {
* @requires_webgl20 Half float vertex attributes are not available
* in WebGL 1.0.
*/
#ifndef MAGNUM_TARGET_GLES2
HalfFloat = GL_HALF_FLOAT,
#else
HalfFloat = GL_HALF_FLOAT_OES,
#endif
#endif
/** Float. Only for float attribute types. */

5
src/Magnum/Audio/AbstractImporter.h

@ -61,6 +61,11 @@ checked by the implementation:
there is any file opened.
Plugin interface string is `"cz.mosra.magnum.Audio.AbstractImporter/0.1"`.
@attention @ref Corrade::Containers::Array instances returned from the plugin
should *not* use anything else than the default deleter, otherwise this can
cause dangling function pointer call on array destruction if the plugin
gets unloaded before the array is destroyed.
*/
class MAGNUM_AUDIO_EXPORT AbstractImporter: public PluginManager::AbstractManagingPlugin<AbstractImporter> {
CORRADE_PLUGIN_INTERFACE("cz.mosra.magnum.Audio.AbstractImporter/0.1")

11
src/Magnum/Audio/Audio.cpp

@ -33,21 +33,16 @@ namespace Magnum { namespace Audio {
/* Verify types */
static_assert(std::is_same<ALubyte, UnsignedByte>::value, "ALubyte is not the same as UnsignedByte");
/** @todo Why `ALbyte` is defined as `char` and not `signed char` on OSX? */
#ifndef CORRADE_TARGET_APPLE
static_assert(std::is_same<ALbyte, Byte>::value, "ALbyte is not the same as Byte");
#else
static_assert(std::is_signed<ALbyte>::value && sizeof(ALbyte) == 1, "ALbyte does not have the same characteristics as Byte");
#endif
/* ALbyte is defined as `signed char` in OpenAL Soft and `char` in the official
SDK from Creative and on Apple. Both are okay. */
static_assert(std::is_same<ALbyte, Byte>::value || (std::is_signed<ALbyte>::value && sizeof(ALbyte) == 1), "ALbyte does not have the characteristics as Byte");
static_assert(std::is_same<ALushort, UnsignedShort>::value, "ALushort is not the same as UnsignedShort");
static_assert(std::is_same<ALshort, Short>::value, "ALshort is not the same as Short");
static_assert(std::is_same<ALuint, UnsignedInt>::value, "ALuint is not the same as UnsignedInt");
static_assert(std::is_same<ALint, Int>::value, "ALint is not the same as Int");
static_assert(std::is_same<ALsizei, Int>::value, "ALsizei is not the same as Int");
static_assert(std::is_same<ALfloat, Float>::value, "ALfloat is not the same as Float");
#ifndef MAGNUM_TARGET_GLES
static_assert(std::is_same<ALdouble, Double>::value, "ALdouble is not the same as Double");
#endif
/* Verify boolean values */
static_assert(AL_FALSE == false, "AL_FALSE is not the same as false");

31
src/Magnum/Audio/Buffer.cpp

@ -31,20 +31,49 @@ namespace Magnum { namespace Audio {
Debug& operator<<(Debug& debug, const Buffer::Format value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case Buffer::Format::value: return debug << "Audio::Buffer::Format::" #value;
_c(Mono8)
_c(Mono16)
_c(Stereo8)
_c(Stereo16)
_c(MonoALaw)
_c(StereoALaw)
_c(MonoMuLaw)
_c(StereoMuLaw)
_c(MonoFloat)
_c(StereoFloat)
_c(MonoDouble)
_c(StereoDouble)
_c(Quad8)
_c(Quad16)
_c(Quad32)
_c(Rear8)
_c(Rear16)
_c(Rear32)
_c(Surround51Channel8)
_c(Surround51Channel16)
_c(Surround51Channel32)
_c(Surround61Channel8)
_c(Surround61Channel16)
_c(Surround61Channel32)
_c(Surround71Channel8)
_c(Surround71Channel16)
_c(Surround71Channel32)
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "Audio::Buffer::Format::(invalid)";
return debug << "Audio::Buffer::Format(" << Debug::nospace << reinterpret_cast<void*>(ALenum(value)) << Debug::nospace << ")";
}
}}

137
src/Magnum/Audio/Buffer.h

@ -55,7 +55,35 @@ class Buffer {
Mono8 = AL_FORMAT_MONO8, /**< 8-bit unsigned mono */
Mono16 = AL_FORMAT_MONO16, /**< 16-bit signed mono */
Stereo8 = AL_FORMAT_STEREO8, /**< 8-bit interleaved unsigned stereo */
Stereo16 = AL_FORMAT_STEREO16, /**< 16-bit interleaved signed stereo */
Stereo16 = AL_FORMAT_STEREO16, /**< 16-bit interleaved signed stereo */
/**
* @brief 8-bit mono [A-Law Compressed Sound Format](https://en.wikipedia.org/wiki/A-law_algorithm)
*
* @requires_al_extension Extension @al_extension{EXT,ALAW}
*/
MonoALaw = AL_FORMAT_MONO_ALAW_EXT,
/**
* @brief 8-bit interleaved stereo [A-Law Compressed Sound Format](https://en.wikipedia.org/wiki/A-law_algorithm)
*
* @requires_al_extension Extension @al_extension{EXT,ALAW}
*/
StereoALaw = AL_FORMAT_STEREO_ALAW_EXT,
/**
* @brief 8-bit mono [μ-Law Compressed Sound Format](https://en.wikipedia.org/wiki/Μ-law_algorithm)
*
* @requires_al_extension Extension @al_extension{EXT,MULAW}
*/
MonoMuLaw = AL_FORMAT_MONO_MULAW_EXT,
/**
* @brief 8-bit interleaved [μ-Law Compressed Sound Format](https://en.wikipedia.org/wiki/Μ-law_algorithm)
*
* @requires_al_extension Extension @al_extension{EXT,MULAW}
*/
StereoMuLaw = AL_FORMAT_STEREO_MULAW_EXT,
/**
* @brief 32-bit floating-point mono
@ -83,7 +111,112 @@ class Buffer {
*
* @requires_al_extension Extension @al_extension{EXT,double}
*/
StereoDouble = AL_FORMAT_STEREO_DOUBLE_EXT
StereoDouble = AL_FORMAT_STEREO_DOUBLE_EXT,
/**
* @brief 8-bit unsigned quadrophonic
*
* @requires_al_extension Extension @al_extension{EXT,MCFORMATS}
*/
Quad8 = AL_FORMAT_QUAD8,
/**
* @brief 16-bit signed quadrophonic
*
* @requires_al_extension Extension @al_extension{EXT,MCFORMATS}
*/
Quad16 = AL_FORMAT_QUAD16,
/**
* @brief 32-bit interleaved floating-point quadrophonic
*
* @requires_al_extension Extension @al_extension{EXT,MCFORMATS}
*/
Quad32 = AL_FORMAT_QUAD32,
/**
* @brief 8-bit unsigned rear
*
* @requires_al_extension Extension @al_extension{EXT,MCFORMATS}
*/
Rear8 = AL_FORMAT_REAR8,
/**
* @brief 16-bit signed rear
*
* @requires_al_extension Extension @al_extension{EXT,MCFORMATS}
*/
Rear16 = AL_FORMAT_REAR16,
/**
* @brief 32-bit interleaved floating-point rear
*
* @requires_al_extension Extension @al_extension{EXT,MCFORMATS}
*/
Rear32 = AL_FORMAT_REAR32,
/**
* @brief 8-bit unsigned 5.1 surround
*
* @requires_al_extension Extension @al_extension{EXT,MCFORMATS}
*/
Surround51Channel8 = AL_FORMAT_51CHN8,
/**
* @brief 16-bit signed 5.1 surround
*
* @requires_al_extension Extension @al_extension{EXT,MCFORMATS}
*/
Surround51Channel16 = AL_FORMAT_51CHN16,
/**
* @brief 32-bit interleaved floating-point 5.1 surround
*
* @requires_al_extension Extension @al_extension{EXT,MCFORMATS}
*/
Surround51Channel32 = AL_FORMAT_51CHN32,
/**
* @brief 8-bit unsigned 6.1 surround
*
* @requires_al_extension Extension @al_extension{EXT,MCFORMATS}
*/
Surround61Channel8 = AL_FORMAT_61CHN8,
/**
* @brief 16-bit signed 6.1 surround
*
* @requires_al_extension Extension @al_extension{EXT,MCFORMATS}
*/
Surround61Channel16 = AL_FORMAT_61CHN16,
/**
* @brief 32-bit interleaved floating-point 6.1 surround
*
* @requires_al_extension Extension @al_extension{EXT,MCFORMATS}
*/
Surround61Channel32 = AL_FORMAT_61CHN32,
/**
* @brief 8-bit unsigned 7.1 surround
*
* @requires_al_extension Extension @al_extension{EXT,MCFORMATS}
*/
Surround71Channel8 = AL_FORMAT_71CHN8,
/**
* @brief 16-bit signed 7.1 surround
*
* @requires_al_extension Extension @al_extension{EXT,MCFORMATS}
*/
Surround71Channel16 = AL_FORMAT_71CHN16,
/**
* @brief 32-bit interleaved floating-point 7.1 surround
*
* @requires_al_extension Extension @al_extension{EXT,MCFORMATS}
*/
Surround71Channel32 = AL_FORMAT_71CHN32
};
/**

22
src/Magnum/Audio/CMakeLists.txt

@ -74,9 +74,25 @@ install(TARGETS MagnumAudio
ARCHIVE DESTINATION ${MAGNUM_LIBRARY_INSTALL_DIR})
install(FILES ${MagnumAudio_HEADERS} DESTINATION ${MAGNUM_INCLUDE_INSTALL_DIR}/Audio)
# Magnum Audio target alias for superprojects
add_library(Magnum::Audio ALIAS MagnumAudio)
if(WITH_AL_INFO)
add_executable(magnum-al-info magnum-al-info.cpp)
target_link_libraries(magnum-al-info MagnumAudio)
install(TARGETS magnum-al-info DESTINATION ${MAGNUM_BINARY_INSTALL_DIR})
if(CORRADE_TARGET_IOS)
set_target_properties(magnum-al-info PROPERTIES
MACOSX_BUNDLE ON
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/MacOSXBundleInfo.plist.in
XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "YES")
endif()
# Magnum AL info target alias for superprojects
add_executable(Magnum::al-info ALIAS magnum-al-info)
endif()
if(BUILD_TESTS)
add_subdirectory(Test)
endif()
# Magnum Audio target alias for superprojects
add_library(Magnum::Audio ALIAS MagnumAudio)

39
src/Magnum/Audio/Context.cpp

@ -30,6 +30,7 @@
#include <al.h>
#include <alc.h>
#include <cstring>
#include <Corrade/Utility/Assert.h>
#include <Corrade/Utility/Debug.h>
@ -44,6 +45,9 @@ const std::vector<Extension>& Extension::extensions() {
static const std::vector<Extension> extensions{
_extension(AL,EXT,FLOAT32),
_extension(AL,EXT,DOUBLE),
_extension(AL,EXT,ALAW),
_extension(AL,EXT,MULAW),
_extension(AL,EXT,MCFORMATS),
_extension(ALC,EXT,ENUMERATION),
_extension(ALC,SOFTX,HRTF),
_extension(ALC,SOFT,HRTF)
@ -55,6 +59,7 @@ const std::vector<Extension>& Extension::extensions() {
Debug& operator<<(Debug& debug, const Context::HrtfStatus value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case Context::HrtfStatus::value: return debug << "Audio::Context::HrtfStatus::" #value;
_c(Disabled)
_c(Enabled)
@ -63,13 +68,23 @@ Debug& operator<<(Debug& debug, const Context::HrtfStatus value) {
_c(Detected)
_c(UnsupportedFormat)
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "Audio::Context::HrtfStatus::(invalid)";
return debug << "Audio::Context::HrtfStatus(" << Debug::nospace << reinterpret_cast<void*>(ALenum(value)) << Debug::nospace << ")";
}
Context* Context::_current = nullptr;
std::vector<std::string> Context::deviceSpecifierStrings() {
std::vector<std::string> list;
const char* const devices = alcGetString(nullptr, ALC_DEVICE_SPECIFIER);
for(const char* device = devices; *device; device += std::strlen(device) + 1)
list.push_back(device);
return list;
}
bool Context::hasCurrent() { return _current; }
Context& Context::current() {
@ -82,11 +97,10 @@ Context::Context(): Context{Configuration{}} {}
Context::Context(const Configuration& config) {
CORRADE_ASSERT(!_current, "Audio::Context: context already created", );
/* Open default device */
const ALCchar* const defaultDevice = alcGetString(nullptr, ALC_DEFAULT_DEVICE_SPECIFIER);
_device = alcOpenDevice(defaultDevice);
if(!_device) {
Error() << "Audio::Context: cannot open sound device" << defaultDevice;
/* Open the device */
const ALCchar* const deviceSpecifier = config.deviceSpecifier().empty() ? alcGetString(nullptr, ALC_DEFAULT_DEVICE_SPECIFIER) : config.deviceSpecifier().data();
if(!(_device = alcOpenDevice(deviceSpecifier))) {
Error() << "Audio::Context: cannot open sound device" << deviceSpecifier;
std::exit(1);
}
@ -184,4 +198,17 @@ bool Context::tryCreateContext(const Configuration& config) {
return !!_context;
}
Context::Configuration::Configuration() = default;
Context::Configuration::~Configuration() = default;
Context::Configuration& Context::Configuration::setDeviceSpecifier(const std::string& specifier) {
_deviceSpecifier = specifier;
return *this;
}
Context::Configuration& Context::Configuration::setDeviceSpecifier(std::string&& specifier) {
_deviceSpecifier = std::move(specifier);
return *this;
}
}}

58
src/Magnum/Audio/Context.h

@ -83,7 +83,6 @@ class MAGNUM_AUDIO_EXPORT Extension {
*/
class MAGNUM_AUDIO_EXPORT Context {
public:
/**
* @brief HRTF status
*
@ -127,6 +126,14 @@ class MAGNUM_AUDIO_EXPORT Context {
UnsupportedFormat = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT
};
/**
* @brief All device specifier strings
*
* @see @ref deviceSpecifierString(), @ref Configuration::setDeviceSpecifier()
* @fn_al{GetString} with @def_alc{DEVICE_SPECIFIER}
*/
static std::vector<std::string> deviceSpecifierStrings();
/**
* @brief Whether there is any current context
*
@ -202,17 +209,27 @@ class MAGNUM_AUDIO_EXPORT Context {
return alcGetString(_device, ALC_HRTF_SPECIFIER_SOFT);
}
/**
* @brief Device specifier string
*
* @see @ref deviceSpecifierStrings(), @ref vendorString(), @ref rendererString(),
* @fn_al{GetString} with @def_alc{DEVICE_SPECIFIER}
*/
std::string deviceSpecifierString() const { return alcGetString(_device, ALC_DEVICE_SPECIFIER); }
/**
* @brief Vendor string
*
* @see @ref rendererString(), @fn_al{GetString} with @def_al{VENDOR}
* @see @ref deviceSpecifierString(), @ref rendererString(),
* @fn_al{GetString} with @def_al{VENDOR}
*/
std::string vendorString() const { return alGetString(AL_VENDOR); }
/**
* @brief Renderer string
*
* @see @ref vendorString(), @fn_al{GetString} with @def_al{RENDERER}
* @see @ref deviceSpecifierString(), @ref vendorString(),
* @fn_al{GetString} with @def_al{RENDERER}
*/
std::string rendererString() const { return alGetString(AL_RENDERER); }
@ -314,13 +331,22 @@ class MAGNUM_AUDIO_EXPORT Context::Configuration {
Disabled = 2 /**< Disabled */
};
/** @brief Constructor */
explicit Configuration():
_frequency(-1),
_monoSources(-1),
_stereoSources(-1),
_refreshRate(-1)
{}
explicit Configuration();
~Configuration();
/** @brief Device specifier */
const std::string& deviceSpecifier() const { return _deviceSpecifier; }
/**
* @brief Set device specifier
* @return Reference to self (for method chaining)
*
* If set to empty string (the default), default device specifier is
* used.
* @see @ref Context::deviceSpecifierStrings()
*/
Configuration& setDeviceSpecifier(const std::string& specifier);
Configuration& setDeviceSpecifier(std::string&& specifier); /**< @overload */
/** @brief Sampling rate in Hz */
Int frequency() const { return _frequency; }
@ -397,13 +423,15 @@ class MAGNUM_AUDIO_EXPORT Context::Configuration {
}
private:
Int _frequency;
Hrtf _hrtf;
std::string _deviceSpecifier;
Int _frequency{-1};
Hrtf _hrtf{};
Int _monoSources;
Int _stereoSources;
Int _monoSources{-1};
Int _stereoSources{-1};
Int _refreshRate;
Int _refreshRate{-1};
};

3
src/Magnum/Audio/Extensions.h

@ -79,6 +79,9 @@ namespace AL {
namespace EXT {
_extension(AL,EXT,FLOAT32) // #???
_extension(AL,EXT,DOUBLE) // #???
_extension(AL,EXT,ALAW) // #???
_extension(AL,EXT,MULAW) // #???
_extension(AL,EXT,MCFORMATS) // #???
}
} namespace ALC {
namespace EXT {

18
src/Magnum/Audio/MacOSXBundleInfo.plist.in

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en-US</string>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>cz.mosra.magnum.magnum-al-info</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>magnum-al-info</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
</dict>
</plist>

8
src/Magnum/Audio/Renderer.cpp

@ -31,6 +31,7 @@ namespace Magnum { namespace Audio {
Debug& operator<<(Debug& debug, const Renderer::Error value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case Renderer::Error::value: return debug << "Audio::Renderer::Error::" #value;
_c(NoError)
_c(InvalidName)
@ -39,13 +40,15 @@ Debug& operator<<(Debug& debug, const Renderer::Error value) {
_c(InvalidOperation)
_c(OutOfMemory)
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "Audio::Renderer::Error::(invalid)";
return debug << "Audio::Renderer::Error(" << Debug::nospace << reinterpret_cast<void*>(ALenum(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, const Renderer::DistanceModel value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case Renderer::DistanceModel::value: return debug << "Audio::Renderer::DistanceModel::" #value;
_c(None)
_c(Inverse)
@ -55,9 +58,10 @@ Debug& operator<<(Debug& debug, const Renderer::DistanceModel value) {
_c(Exponent)
_c(ExponentClamped)
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "Audio::Renderer::DistanceModel::(invalid)";
return debug << "Audio::Renderer::DistanceModel(" << Debug::nospace << reinterpret_cast<void*>(ALenum(value)) << Debug::nospace << ")";
}
}}

4
src/Magnum/Audio/Source.cpp

@ -98,15 +98,17 @@ void Source::rewind(const std::vector<std::reference_wrapper<Source>>& sources)
Debug& operator<<(Debug& debug, const Source::State value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case Source::State::value: return debug << "Audio::Source::State::" #value;
_c(Initial)
_c(Playing)
_c(Paused)
_c(Stopped)
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "Audio::Source::State::(invalid)";
return debug << "Audio::Source::State(" << Debug::nospace << reinterpret_cast<void*>(ALint(value)) << Debug::nospace << ")";
}
}}

29
src/Magnum/Trade/Test/AbstractMaterialDataTest.cpp → src/Magnum/Audio/Test/BufferALTest.cpp

@ -23,31 +23,30 @@
DEALINGS IN THE SOFTWARE.
*/
#include <sstream>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Trade/AbstractMaterialData.h"
#include "Magnum/Audio/Buffer.h"
#include "Magnum/Audio/Context.h"
namespace Magnum { namespace Trade { namespace Test {
namespace Magnum { namespace Audio { namespace Test {
class AbstractMaterialDataTest: public TestSuite::Tester {
public:
explicit AbstractMaterialDataTest();
struct BufferALTest: TestSuite::Tester {
explicit BufferALTest();
void debug();
void construct();
Context _context;
};
AbstractMaterialDataTest::AbstractMaterialDataTest() {
addTests({&AbstractMaterialDataTest::debug});
BufferALTest::BufferALTest() {
addTests({&BufferALTest::construct});
}
void AbstractMaterialDataTest::debug() {
std::ostringstream out;
Debug(&out) << MaterialType::Phong;
CORRADE_COMPARE(out.str(), "Trade::MaterialType::Phong\n");
void BufferALTest::construct() {
Buffer buf;
CORRADE_VERIFY(buf.id() != 0);
}
}}}
CORRADE_TEST_MAIN(Magnum::Trade::Test::AbstractMaterialDataTest)
CORRADE_TEST_MAIN(Magnum::Audio::Test::BufferALTest)

4
src/Magnum/Audio/Test/BufferTest.cpp

@ -42,8 +42,8 @@ BufferTest::BufferTest() {
void BufferTest::debugFormat() {
std::ostringstream out;
Debug(&out) << Buffer::Format::Stereo16;
CORRADE_COMPARE(out.str(), "Audio::Buffer::Format::Stereo16\n");
Debug(&out) << Buffer::Format::Stereo16 << Buffer::Format(0xdead);
CORRADE_COMPARE(out.str(), "Audio::Buffer::Format::Stereo16 Audio::Buffer::Format(0xdead)\n");
}
}}}

23
src/Magnum/Audio/Test/CMakeLists.txt

@ -24,6 +24,12 @@
# DEALINGS IN THE SOFTWARE.
#
if(CORRADE_TARGET_EMSCRIPTEN)
set(AUDIO_TEST_DIR "")
else()
set(AUDIO_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR})
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
@ -34,7 +40,18 @@ corrade_add_test(AudioContextTest ContextTest.cpp LIBRARIES MagnumAudio)
corrade_add_test(AudioRendererTest RendererTest.cpp LIBRARIES MagnumAudio)
corrade_add_test(AudioSourceTest SourceTest.cpp LIBRARIES MagnumAudio)
if(WITH_SCENEGRAPH)
corrade_add_test(AudioListenerTest ListenerTest.cpp LIBRARIES MagnumSceneGraph MagnumAudio)
corrade_add_test(AudioPlayableTest PlayableTest.cpp LIBRARIES MagnumSceneGraph MagnumAudio)
if(BUILD_AL_TESTS)
corrade_add_test(AudioBufferALTest BufferALTest.cpp LIBRARIES MagnumAudio)
corrade_add_test(AudioContextALTest ContextALTest.cpp LIBRARIES MagnumAudio)
corrade_add_test(AudioRendererALTest RendererALTest.cpp LIBRARIES MagnumAudio)
corrade_add_test(AudioSourceALTest SourceALTest.cpp LIBRARIES MagnumAudio)
if(WITH_SCENEGRAPH)
corrade_add_test(AudioListenerALTest ListenerALTest.cpp LIBRARIES MagnumSceneGraph MagnumAudio)
corrade_add_test(AudioPlayableALTest PlayableALTest.cpp LIBRARIES MagnumSceneGraph MagnumAudio)
endif()
endif()
if(CORRADE_TARGET_EMSCRIPTEN)
emscripten_embed_file(AudioAbstractImporterTest file.bin "/file.bin")
endif()

60
src/Magnum/Audio/Test/ContextALTest.cpp

@ -0,0 +1,60 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Copyright © 2015 Jonathan Hale <squareys@googlemail.com>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Audio/Extensions.h"
#include "Magnum/Audio/Context.h"
namespace Magnum { namespace Audio { namespace Test {
struct ContextALTest: TestSuite::Tester {
explicit ContextALTest();
void extensionsString();
void isExtensionEnabled();
Context _context;
};
ContextALTest::ContextALTest() {
addTests({&ContextALTest::extensionsString,
&ContextALTest::isExtensionEnabled});
}
void ContextALTest::extensionsString() {
std::vector<std::string> extensions = _context.extensionStrings();
CORRADE_VERIFY(!extensions.empty());
}
void ContextALTest::isExtensionEnabled() {
CORRADE_VERIFY(Context::current().isExtensionSupported<Extensions::ALC::EXT::ENUMERATION>());
}
}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::ContextALTest)

28
src/Magnum/Audio/Test/ContextTest.cpp

@ -27,7 +27,6 @@
#include <sstream>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Audio/Extensions.h"
#include "Magnum/Audio/Context.h"
namespace Magnum { namespace Audio { namespace Test {
@ -35,34 +34,17 @@ namespace Magnum { namespace Audio { namespace Test {
struct ContextTest: TestSuite::Tester {
explicit ContextTest();
void extensionsString();
void isExtensionEnabled();
void hrtfStatus();
void hrtfs();
Context _context;
void debugHrtfStatus();
};
ContextTest::ContextTest() {
addTests({&ContextTest::extensionsString,
&ContextTest::isExtensionEnabled,
&ContextTest::hrtfStatus});
}
void ContextTest::extensionsString() {
std::vector<std::string> extensions = _context.extensionStrings();
CORRADE_VERIFY(extensions.size() > 0);
}
void ContextTest::isExtensionEnabled() {
CORRADE_VERIFY(Context::current().isExtensionSupported<Extensions::ALC::EXT::ENUMERATION>());
addTests({&ContextTest::debugHrtfStatus});
}
void ContextTest::hrtfStatus() {
void ContextTest::debugHrtfStatus() {
std::ostringstream out;
Debug(&out) << Context::HrtfStatus::Denied;
CORRADE_COMPARE(out.str(), "Audio::Context::HrtfStatus::Denied\n");
Debug(&out) << Context::HrtfStatus::Denied << Context::HrtfStatus(0xdead);
CORRADE_COMPARE(out.str(), "Audio::Context::HrtfStatus::Denied Audio::Context::HrtfStatus(0xdead)\n");
}
}}}

35
src/Magnum/Audio/Test/ListenerTest.cpp → src/Magnum/Audio/Test/ListenerALTest.cpp

@ -26,15 +26,14 @@
#include <Corrade/TestSuite/Tester.h>
#include <Magnum/SceneGraph/Scene.h>
#include <Magnum/SceneGraph/Object.h>
#include <Magnum/SceneGraph/MatrixTransformation2D.h>
#include <Magnum/SceneGraph/MatrixTransformation3D.h>
#include "Magnum/Audio/Playable.h"
#include "Magnum/Audio/Context.h"
#include "Magnum/Audio/Listener.h"
#include "Magnum/Audio/PlayableGroup.h"
#include "Magnum/SceneGraph/Scene.h"
#include "Magnum/SceneGraph/Object.h"
#include "Magnum/SceneGraph/MatrixTransformation2D.h"
#include "Magnum/SceneGraph/MatrixTransformation3D.h"
namespace Magnum { namespace Audio { namespace Test {
@ -44,23 +43,23 @@ typedef SceneGraph::Object<SceneGraph::MatrixTransformation2D> Object2D;
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D> Scene3D;
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> Object3D;
struct ListenerTest: TestSuite::Tester {
explicit ListenerTest();
struct ListenerALTest: TestSuite::Tester {
explicit ListenerALTest();
void testFeature2D();
void testFeature3D();
void testUpdateGroups();
void feature2D();
void feature3D();
void updateGroups();
Context _context;
};
ListenerTest::ListenerTest(): _context() {
addTests({&ListenerTest::testFeature2D,
&ListenerTest::testFeature3D,
&ListenerTest::testUpdateGroups});
ListenerALTest::ListenerALTest() {
addTests({&ListenerALTest::feature2D,
&ListenerALTest::feature3D,
&ListenerALTest::updateGroups});
}
void ListenerTest::testFeature2D() {
void ListenerALTest::feature2D() {
Scene2D scene;
Object2D object{&scene};
Listener2D listener{object};
@ -72,7 +71,7 @@ void ListenerTest::testFeature2D() {
CORRADE_COMPARE(Renderer::listenerPosition(), offset);
}
void ListenerTest::testFeature3D() {
void ListenerALTest::feature3D() {
Scene3D scene;
Object3D object{&scene};
Listener3D listener{object};
@ -84,7 +83,7 @@ void ListenerTest::testFeature3D() {
CORRADE_COMPARE(Renderer::listenerPosition(), offset);
}
void ListenerTest::testUpdateGroups() {
void ListenerALTest::updateGroups() {
Scene3D scene;
Object3D sourceObject{&scene};
Object3D object{&scene};
@ -108,4 +107,4 @@ void ListenerTest::testUpdateGroups() {
}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::ListenerTest)
CORRADE_TEST_MAIN(Magnum::Audio::Test::ListenerALTest)

27
src/Magnum/Audio/Test/PlayableTest.cpp → src/Magnum/Audio/Test/PlayableALTest.cpp

@ -26,33 +26,32 @@
#include <Corrade/TestSuite/Tester.h>
#include <Magnum/SceneGraph/Scene.h>
#include <Magnum/SceneGraph/Object.h>
#include <Magnum/SceneGraph/MatrixTransformation3D.h>
#include "Magnum/Audio/Context.h"
#include "Magnum/Audio/Playable.h"
#include "Magnum/SceneGraph/Scene.h"
#include "Magnum/SceneGraph/Object.h"
#include "Magnum/SceneGraph/MatrixTransformation3D.h"
namespace Magnum { namespace Audio { namespace Test {
typedef SceneGraph::Scene<SceneGraph::MatrixTransformation3D> Scene3D;
typedef SceneGraph::Object<SceneGraph::MatrixTransformation3D> Object3D;
struct PlayableTest: TestSuite::Tester {
explicit PlayableTest();
struct PlayableALTest: TestSuite::Tester {
explicit PlayableALTest();
void testFeature();
void testGroup();
void feature();
void group();
Context _context;
};
PlayableTest::PlayableTest() {
addTests({&PlayableTest::testFeature,
&PlayableTest::testGroup});
PlayableALTest::PlayableALTest() {
addTests({&PlayableALTest::feature,
&PlayableALTest::group});
}
void PlayableTest::testFeature() {
void PlayableALTest::feature() {
Scene3D scene;
Object3D object{&scene};
Source source;
@ -65,7 +64,7 @@ void PlayableTest::testFeature() {
CORRADE_COMPARE(playable.source().position(), offset);
}
void PlayableTest::testGroup() {
void PlayableALTest::group() {
Scene3D scene;
Object3D object{&scene};
Source source;
@ -94,4 +93,4 @@ void PlayableTest::testGroup() {
}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::PlayableTest)
CORRADE_TEST_MAIN(Magnum::Audio::Test::PlayableALTest)

110
src/Magnum/Audio/Test/RendererALTest.cpp

@ -0,0 +1,110 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Audio/Context.h"
#include "Magnum/Audio/Renderer.h"
namespace Magnum { namespace Audio { namespace Test {
struct RendererALTest: TestSuite::Tester {
explicit RendererALTest();
void listenerOrientation();
void listenerPosition();
void listenerVelocity();
void listenerGain();
void speedOfSound();
void dopplerFactor();
void distanceModel();
Context _context;
};
RendererALTest::RendererALTest() {
addTests({&RendererALTest::listenerOrientation,
&RendererALTest::listenerPosition,
&RendererALTest::listenerVelocity,
&RendererALTest::listenerGain,
&RendererALTest::speedOfSound,
&RendererALTest::dopplerFactor,
&RendererALTest::distanceModel});
}
void RendererALTest::listenerOrientation() {
constexpr Vector3 up{1.0f, 2.0f, 3.0f}, fwd{3.0f, 2.0f, 1.0f};
Renderer::setListenerOrientation(fwd, up);
std::array<Vector3, 2> orientation = Renderer::listenerOrientation();
CORRADE_COMPARE(orientation[0], fwd);
CORRADE_COMPARE(orientation[1], up);
}
void RendererALTest::listenerPosition() {
constexpr Vector3 pos{1.0f, 3.0f, 2.0f};
Renderer::setListenerPosition(pos);
CORRADE_COMPARE(Renderer::listenerPosition(), pos);
}
void RendererALTest::listenerVelocity() {
constexpr Vector3 vel{1.0f, 3.0f, 2.0f};
Renderer::setListenerVelocity(vel);
CORRADE_COMPARE(Renderer::listenerVelocity(), vel);
}
void RendererALTest::listenerGain() {
constexpr Float gain = 0.512f;
Renderer::setListenerGain(gain);
CORRADE_COMPARE(Renderer::listenerGain(), gain);
}
void RendererALTest::speedOfSound() {
constexpr Float speed = 1.25f;
Renderer::setSpeedOfSound(speed);
CORRADE_COMPARE(Renderer::speedOfSound(), speed);
}
void RendererALTest::dopplerFactor() {
constexpr Float factor = 0.3335f;
Renderer::setDopplerFactor(factor);
CORRADE_COMPARE(Renderer::dopplerFactor(), factor);
}
void RendererALTest::distanceModel() {
constexpr Renderer::DistanceModel model = Renderer::DistanceModel::InverseClamped;
Renderer::setDistanceModel(model);
CORRADE_COMPARE(Renderer::distanceModel(), model);
}
}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::RendererALTest)

78
src/Magnum/Audio/Test/RendererTest.cpp

@ -27,7 +27,6 @@
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Magnum.h"
#include "Magnum/Audio/Context.h"
#include "Magnum/Audio/Renderer.h"
namespace Magnum { namespace Audio { namespace Test {
@ -37,90 +36,23 @@ struct RendererTest: TestSuite::Tester {
void debugError();
void debugDistanceModel();
void listenerOrientation();
void listenerPosition();
void listenerVelocity();
void listenerGain();
void speedOfSound();
void dopplerFactor();
void distanceModel();
Context _context;
};
RendererTest::RendererTest() {
addTests({&RendererTest::debugError,
&RendererTest::debugDistanceModel,
&RendererTest::listenerOrientation,
&RendererTest::listenerPosition,
&RendererTest::listenerVelocity,
&RendererTest::listenerGain,
&RendererTest::speedOfSound,
&RendererTest::dopplerFactor,
&RendererTest::distanceModel});
&RendererTest::debugDistanceModel});
}
void RendererTest::debugError() {
std::ostringstream out;
Debug(&out) << Renderer::Error::InvalidOperation;
CORRADE_COMPARE(out.str(), "Audio::Renderer::Error::InvalidOperation\n");
Debug(&out) << Renderer::Error::InvalidOperation << Renderer::Error(0xdead);
CORRADE_COMPARE(out.str(), "Audio::Renderer::Error::InvalidOperation Audio::Renderer::Error(0xdead)\n");
}
void RendererTest::debugDistanceModel() {
std::ostringstream out;
Debug(&out) << Renderer::DistanceModel::Inverse;
CORRADE_COMPARE(out.str(), "Audio::Renderer::DistanceModel::Inverse\n");
}
void RendererTest::listenerOrientation() {
constexpr Vector3 up{1.0f, 2.0f, 3.0f}, fwd{3.0f, 2.0f, 1.0f};
Renderer::setListenerOrientation(fwd, up);
std::array<Vector3, 2> orientation = Renderer::listenerOrientation();
CORRADE_COMPARE(orientation[0], fwd);
CORRADE_COMPARE(orientation[1], up);
}
void RendererTest::listenerPosition() {
constexpr Vector3 pos{1.0f, 3.0f, 2.0f};
Renderer::setListenerPosition(pos);
CORRADE_COMPARE(Renderer::listenerPosition(), pos);
}
void RendererTest::listenerVelocity() {
constexpr Vector3 vel{1.0f, 3.0f, 2.0f};
Renderer::setListenerVelocity(vel);
CORRADE_COMPARE(Renderer::listenerVelocity(), vel);
}
void RendererTest::listenerGain() {
constexpr Float gain = 0.512f;
Renderer::setListenerGain(gain);
CORRADE_COMPARE(Renderer::listenerGain(), gain);
}
void RendererTest::speedOfSound() {
constexpr Float speed = 1.25f;
Renderer::setSpeedOfSound(speed);
CORRADE_COMPARE(Renderer::speedOfSound(), speed);
}
void RendererTest::dopplerFactor() {
constexpr Float factor = 0.3335f;
Renderer::setDopplerFactor(factor);
CORRADE_COMPARE(Renderer::dopplerFactor(), factor);
}
void RendererTest::distanceModel() {
constexpr Renderer::DistanceModel model = Renderer::DistanceModel::InverseClamped;
Renderer::setDistanceModel(model);
CORRADE_COMPARE(Renderer::distanceModel(), model);
Debug(&out) << Renderer::DistanceModel::Inverse << Renderer::DistanceModel(0xdead);
CORRADE_COMPARE(out.str(), "Audio::Renderer::DistanceModel::Inverse Audio::Renderer::DistanceModel(0xdead)\n");
}
}}}

173
src/Magnum/Audio/Test/SourceALTest.cpp

@ -0,0 +1,173 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Audio/Context.h"
#include "Magnum/Audio/Source.h"
namespace Magnum { namespace Audio { namespace Test {
struct SourceALTest: TestSuite::Tester {
explicit SourceALTest();
void construct();
void position();
void direction();
void velocity();
void gain();
void looping();
void relative();
void maxDistance();
void maxGain();
void minGain();
void coneAnglesAndGain();
void rolloffFactor();
Context _context;
};
SourceALTest::SourceALTest() {
addTests({&SourceALTest::construct,
&SourceALTest::position,
&SourceALTest::direction,
&SourceALTest::velocity,
&SourceALTest::gain,
&SourceALTest::looping,
&SourceALTest::relative,
&SourceALTest::maxDistance,
&SourceALTest::maxGain,
&SourceALTest::minGain,
&SourceALTest::coneAnglesAndGain,
&SourceALTest::rolloffFactor});
}
void SourceALTest::construct() {
Source source;
CORRADE_VERIFY(source.id() != 0);
}
void SourceALTest::position() {
Source source;
constexpr Vector3 pos{3.0f, 5.0f, 6.0f};
source.setPosition(pos);
CORRADE_COMPARE(source.position(), pos);
}
void SourceALTest::direction() {
Source source;
constexpr Vector3 dir{3.0f, 1.0f, 2.0f};
source.setDirection(dir);
CORRADE_COMPARE(source.direction(), dir);
}
void SourceALTest::velocity() {
Source source;
constexpr Vector3 vel{-3.0f, 5.0f, -6.0f};
source.setVelocity(vel);
CORRADE_COMPARE(source.velocity(), vel);
}
void SourceALTest::gain() {
Source source;
constexpr Float gain = 0.1234f;
source.setGain(gain);
CORRADE_COMPARE(source.gain(), gain);
}
void SourceALTest::looping() {
Source source;
source.setLooping(true);
CORRADE_VERIFY(source.isLooping());
source.setLooping(false);
CORRADE_VERIFY(!source.isLooping());
}
void SourceALTest::relative() {
Source source;
source.setRelative(true);
CORRADE_VERIFY(source.isRelative());
source.setRelative(false);
CORRADE_VERIFY(!source.isRelative());
}
void SourceALTest::maxDistance() {
Source source;
constexpr Float dist = 0.222f;
source.setMaxDistance(dist);
CORRADE_COMPARE(source.maxDistance(), dist);
}
void SourceALTest::maxGain() {
Source source;
constexpr Float gain = 0.3131f;
source.setMaxGain(gain);
CORRADE_COMPARE(source.maxGain(), gain);
}
void SourceALTest::minGain() {
Source source;
constexpr Float gain = 0.4144f;
source.setMinGain(gain);
CORRADE_COMPARE(source.minGain(), gain);
}
void SourceALTest::coneAnglesAndGain() {
using namespace Math::Literals;
Source source;
constexpr auto outerAngle = 12.0_degf;
constexpr auto innerAngle = 21.0_degf;
constexpr Float outerGain = 0.05f;
source.setInnerConeAngle(innerAngle);
source.setOuterConeAngle(outerAngle);
source.setOuterConeGain(outerGain);
CORRADE_COMPARE(source.outerConeAngle(), outerAngle);
CORRADE_COMPARE(source.innerConeAngle(), innerAngle);
CORRADE_COMPARE(source.outerConeGain(), outerGain);
}
void SourceALTest::rolloffFactor() {
Source source;
constexpr Float fact = 42.0f;
source.setRolloffFactor(fact);
CORRADE_COMPARE(source.rolloffFactor(), fact);
}
}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::SourceALTest)

129
src/Magnum/Audio/Test/SourceTest.cpp

@ -26,7 +26,6 @@
#include <sstream>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Audio/Context.h"
#include "Magnum/Audio/Source.h"
namespace Magnum { namespace Audio { namespace Test {
@ -35,140 +34,18 @@ struct SourceTest: TestSuite::Tester {
explicit SourceTest();
void debugState();
void position();
void direction();
void velocity();
void gain();
void looping();
void relative();
void maxDistance();
void maxGain();
void minGain();
void coneAnglesAndGain();
void rolloffFactor();
Context _context;
};
SourceTest::SourceTest() {
addTests({&SourceTest::debugState,
&SourceTest::position,
&SourceTest::direction,
&SourceTest::velocity,
&SourceTest::gain,
&SourceTest::looping,
&SourceTest::relative,
&SourceTest::maxDistance,
&SourceTest::maxGain,
&SourceTest::minGain,
&SourceTest::coneAnglesAndGain,
&SourceTest::rolloffFactor});
addTests({&SourceTest::debugState});
}
void SourceTest::debugState() {
std::ostringstream out;
Debug(&out) << Source::State::Playing;
CORRADE_COMPARE(out.str(), "Audio::Source::State::Playing\n");
}
void SourceTest::position() {
Source source;
constexpr Vector3 pos{3.0f, 5.0f, 6.0f};
source.setPosition(pos);
CORRADE_COMPARE(source.position(), pos);
}
void SourceTest::direction() {
Source source;
constexpr Vector3 dir{3.0f, 1.0f, 2.0f};
source.setDirection(dir);
CORRADE_COMPARE(source.direction(), dir);
}
void SourceTest::velocity() {
Source source;
constexpr Vector3 vel{-3.0f, 5.0f, -6.0f};
source.setVelocity(vel);
CORRADE_COMPARE(source.velocity(), vel);
Debug(&out) << Source::State::Playing << Source::State(0xdead);
CORRADE_COMPARE(out.str(), "Audio::Source::State::Playing Audio::Source::State(0xdead)\n");
}
void SourceTest::gain() {
Source source;
constexpr Float gain = 0.1234f;
source.setGain(gain);
CORRADE_COMPARE(source.gain(), gain);
}
void SourceTest::looping() {
Source source;
source.setLooping(true);
CORRADE_VERIFY(source.isLooping());
source.setLooping(false);
CORRADE_VERIFY(!source.isLooping());
}
void SourceTest::relative() {
Source source;
source.setRelative(true);
CORRADE_VERIFY(source.isRelative());
source.setRelative(false);
CORRADE_VERIFY(!source.isRelative());
}
void SourceTest::maxDistance() {
Source source;
constexpr Float dist = 0.222f;
source.setMaxDistance(dist);
CORRADE_COMPARE(source.maxDistance(), dist);
}
void SourceTest::maxGain() {
Source source;
constexpr Float gain = 0.3131f;
source.setMaxGain(gain);
CORRADE_COMPARE(source.maxGain(), gain);
}
void SourceTest::minGain() {
Source source;
constexpr Float gain = 0.4144f;
source.setMinGain(gain);
CORRADE_COMPARE(source.minGain(), gain);
}
void SourceTest::coneAnglesAndGain() {
using namespace Math::Literals;
Source source;
constexpr auto outerAngle = 12.0_degf;
constexpr auto innerAngle = 21.0_degf;
constexpr Float outerGain = 0.05f;
source.setInnerConeAngle(innerAngle);
source.setOuterConeAngle(outerAngle);
source.setOuterConeGain(outerGain);
CORRADE_COMPARE(source.outerConeAngle(), outerAngle);
CORRADE_COMPARE(source.innerConeAngle(), innerAngle);
CORRADE_COMPARE(source.outerConeGain(), outerGain);
}
void SourceTest::rolloffFactor() {
Source source;
constexpr Float fact = 42.0f;
source.setRolloffFactor(fact);
CORRADE_COMPARE(source.rolloffFactor(), fact);
}
}}}
CORRADE_TEST_MAIN(Magnum::Audio::Test::SourceTest)

2
src/Magnum/Audio/Test/configure.h.cmake

@ -23,4 +23,4 @@
DEALINGS IN THE SOFTWARE.
*/
#define AUDIO_TEST_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
#define AUDIO_TEST_DIR "${AUDIO_TEST_DIR}"

112
src/Magnum/Audio/magnum-al-info.cpp

@ -0,0 +1,112 @@
/*
This file is part of Magnum.
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016
Vladimír Vondruš <mosra@centrum.cz>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Corrade/Utility/Arguments.h>
#include "Magnum/Magnum.h"
#include "Magnum/Audio/Context.h"
namespace Magnum {
/** @page magnum-al-info Magnum OpenAL Info
@brief Displays information about Magnum OpenAL capabilities
@section magnum-al-info-usage Usage
magnum-al-info [-h|--help] [-s|--short] [--extension-strings]
Arguments:
- `-h`,` --help` -- display this help message and exit
- `-s`, `--short` -- display just essential info and exit
- `--extension-strings` -- list all extension strings provided by the driver
(implies `--short`)
@section magnum-al-info-example Example output
```
+---------------------------------------------------------+
| Information about Magnum engine and OpenAL capabilities |
+---------------------------------------------------------+
Audio Renderer: OpenAL Soft by OpenAL Community
OpenAL version: 1.1 ALSOFT 1.17.2
Available devices:
OpenAL Soft
Current device: OpenAL Soft
Vendor extension support:
AL_EXT_FLOAT32 SUPPORTED
AL_EXT_DOUBLE SUPPORTED
AL_EXT_ALAW SUPPORTED
AL_EXT_MULAW SUPPORTED
AL_EXT_MCFORMATS SUPPORTED
ALC_ENUMERATION_EXT SUPPORTED
ALC_SOFTX_HRTF -
ALC_SOFT_HRTF SUPPORTED
```
*/
}
using namespace Magnum;
int main(const int argc, const char** const argv) {
Utility::Arguments args;
args.addBooleanOption('s', "short").setHelp("short", "display just essential info and exit")
.addBooleanOption("extension-strings").setHelp("extension-strings", "list all extension strings provided by the driver (implies --short)")
.parse(argc, argv);
Debug() << "";
Debug() << " +---------------------------------------------------------+";
Debug() << " | Information about Magnum engine and OpenAL capabilities |";
Debug() << " +---------------------------------------------------------+";
Debug() << "";
Audio::Context c;
Debug() << "Available devices:";
for(const auto& device: Audio::Context::deviceSpecifierStrings())
Debug() << " " << device;
Debug() << "Current device:" << c.deviceSpecifierString();
if(args.isSet("extension-strings")) {
Debug() << "Extension strings:" << Debug::newline
<< c.extensionStrings();
return 0;
}
if(args.isSet("short")) return 0;
Debug() << "Vendor extension support:";
for(const auto& extension: Audio::Extension::extensions()) {
std::string extensionName = extension.string();
Debug d;
d << " " << extensionName << std::string(60-extensionName.size(), ' ');
if(c.isExtensionSupported(extension))
d << "SUPPORTED";
else
d << " -";
}
}

21
src/Magnum/Buffer.cpp

@ -537,7 +537,7 @@ void* Buffer::mapImplementationDefault(MapAccess access) {
return glMapBufferOES(GLenum(bindSomewhereInternal(_targetHint)), GLenum(access));
#else
static_cast<void>(access);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -561,7 +561,7 @@ void* Buffer::mapRangeImplementationDefault(GLintptr offset, GLsizeiptr length,
static_cast<void>(offset);
static_cast<void>(length);
static_cast<void>(access);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -584,7 +584,7 @@ void Buffer::flushMappedRangeImplementationDefault(GLintptr offset, GLsizeiptr l
#else
static_cast<void>(offset);
static_cast<void>(length);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -605,7 +605,7 @@ bool Buffer::unmapImplementationDefault() {
#elif !defined(CORRADE_TARGET_NACL)
return glUnmapBufferOES(GLenum(bindSomewhereInternal(_targetHint)));
#else
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -624,6 +624,7 @@ bool Buffer::unmapImplementationDSAEXT() {
#ifndef DOXYGEN_GENERATING_OUTPUT
Debug& operator<<(Debug& debug, Buffer::TargetHint value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case Buffer::TargetHint::value: return debug << "Buffer::TargetHint::" #value;
_c(Array)
#ifndef MAGNUM_TARGET_GLES2
@ -653,9 +654,10 @@ Debug& operator<<(Debug& debug, Buffer::TargetHint value) {
_c(Uniform)
#endif
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "Buffer::TargetHint::(invalid)";
return debug << "Buffer::TargetHint(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif
@ -674,6 +676,10 @@ Debug& operator<<(Debug& debug, Buffer::Target value) {
#endif
#ifdef MAGNUM_BUILD_DEPRECATED
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
case Buffer::Target::Array:
#ifndef MAGNUM_TARGET_GLES2
case Buffer::Target::CopyRead:
@ -693,12 +699,15 @@ Debug& operator<<(Debug& debug, Buffer::Target value) {
#endif
#ifndef MAGNUM_TARGET_GLES2
case Buffer::Target::TransformFeedback:
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#endif
return debug << static_cast<Buffer::TargetHint>(value);
#endif
}
return debug << "Buffer::Target::(invalid)";
return debug << "Buffer::Target(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif
#endif

20
src/Magnum/Buffer.h

@ -370,7 +370,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @deprecated For @ref setTargetHint() only, use
* @ref TargetHint::Array instead.
*/
Array = GL_ARRAY_BUFFER,
Array CORRADE_DEPRECATED_ENUM("use Buffer::TargetHint::Array instead") = GL_ARRAY_BUFFER,
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
@ -391,14 +391,14 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @deprecated For @ref setTargetHint() only, use
* @ref TargetHint::CopyRead instead.
*/
CopyRead = GL_COPY_READ_BUFFER,
CopyRead CORRADE_DEPRECATED_ENUM("use Buffer::TargetHint::CopyRead instead") = GL_COPY_READ_BUFFER,
/**
* @copydoc TargetHint::CopyWrite
* @deprecated For @ref setTargetHint() only, use
* @ref TargetHint::CopyWrite instead.
*/
CopyWrite = GL_COPY_WRITE_BUFFER,
CopyWrite CORRADE_DEPRECATED_ENUM("use Buffer::TargetHint::CopyWrite instead") = GL_COPY_WRITE_BUFFER,
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
@ -407,14 +407,14 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @deprecated For @ref setTargetHint() only, use
* @ref TargetHint::DispatchIndirect instead.
*/
DispatchIndirect = GL_DISPATCH_INDIRECT_BUFFER,
DispatchIndirect CORRADE_DEPRECATED_ENUM("use Buffer::TargetHint::DispatchIndirect instead") = GL_DISPATCH_INDIRECT_BUFFER,
/**
* @copydoc TargetHint::DrawIndirect
* @deprecated For @ref setTargetHint() only, use
* @ref TargetHint::DrawIndirect instead.
*/
DrawIndirect = GL_DRAW_INDIRECT_BUFFER,
DrawIndirect CORRADE_DEPRECATED_ENUM("use Buffer::TargetHint::DrawIndirect instead") = GL_DRAW_INDIRECT_BUFFER,
#endif
/**
@ -422,7 +422,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @deprecated For @ref setTargetHint() only, use
* @ref TargetHint::ElementArray instead.
*/
ElementArray = GL_ELEMENT_ARRAY_BUFFER,
ElementArray CORRADE_DEPRECATED_ENUM("use Buffer::TargetHint::ElementArray instead") = GL_ELEMENT_ARRAY_BUFFER,
#ifndef MAGNUM_TARGET_GLES2
/**
@ -430,14 +430,14 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @deprecated For @ref setTargetHint() only, use
* @ref TargetHint::PixelPack instead.
*/
PixelPack = GL_PIXEL_PACK_BUFFER,
PixelPack CORRADE_DEPRECATED_ENUM("use Buffer::TargetHint::PixelPack instead") = GL_PIXEL_PACK_BUFFER,
/**
* @copydoc TargetHint::PixelUnpack
* @deprecated For @ref setTargetHint() only, use
* @ref TargetHint::PixelUnpack instead.
*/
PixelUnpack = GL_PIXEL_UNPACK_BUFFER,
PixelUnpack CORRADE_DEPRECATED_ENUM("use Buffer::TargetHint::PixelUnpack instead") = GL_PIXEL_UNPACK_BUFFER,
#endif
#endif
@ -458,7 +458,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @deprecated For @ref setTargetHint() only, use
* @ref TargetHint::Texture instead.
*/
Texture = GL_TEXTURE_BUFFER,
Texture CORRADE_DEPRECATED_ENUM("use Buffer::TargetHint::Texture instead") = GL_TEXTURE_BUFFER,
#endif
#if defined(MAGNUM_BUILD_DEPRECATED) && !defined(MAGNUM_TARGET_GLES2)
@ -467,7 +467,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject {
* @deprecated For @ref setTargetHint() only, use
* @ref TargetHint::TransformFeedback instead.
*/
TransformFeedback = GL_TRANSFORM_FEEDBACK_BUFFER,
TransformFeedback CORRADE_DEPRECATED_ENUM("use Buffer::TargetHint::TransformFeedback instead") = GL_TRANSFORM_FEEDBACK_BUFFER,
#endif
#ifndef MAGNUM_TARGET_GLES2

4
src/Magnum/BufferImage.h

@ -145,7 +145,7 @@ template<UnsignedInt dimensions> class BufferImage {
*
* See @ref PixelStorage::dataProperties() for more information.
*/
std::tuple<std::size_t, VectorTypeFor<dimensions, std::size_t>, std::size_t> dataProperties() const {
std::tuple<VectorTypeFor<dimensions, std::size_t>, VectorTypeFor<dimensions, std::size_t>, std::size_t> dataProperties() const {
return Implementation::imageDataProperties<dimensions>(*this);
}
@ -333,7 +333,7 @@ template<UnsignedInt dimensions> class CompressedBufferImage {
* @requires_gl Compressed pixel storage is hardcoded in OpenGL ES and
* WebGL.
*/
std::tuple<std::size_t, VectorTypeFor<dimensions, std::size_t>, std::size_t> dataProperties() const {
std::tuple<VectorTypeFor<dimensions, std::size_t>, VectorTypeFor<dimensions, std::size_t>, std::size_t> dataProperties() const {
return Implementation::compressedImageDataProperties<dimensions>(*this);
}
#endif

4
src/Magnum/CMakeLists.txt

@ -67,6 +67,7 @@ set(Magnum_SRCS
Trade/AbstractImporter.cpp
Trade/AbstractMaterialData.cpp
Trade/ImageData.cpp
Trade/LightData.cpp
Trade/MeshData2D.cpp
Trade/MeshData3D.cpp
Trade/MeshObjectData2D.cpp
@ -150,6 +151,7 @@ endif()
if(NOT TARGET_GLES2)
list(APPEND Magnum_SRCS
BufferImage.cpp
PrimitiveQuery.cpp
TextureArray.cpp
TransformFeedback.cpp
@ -323,7 +325,7 @@ if(BUILD_TESTS)
# Library with graceful assert for testing
add_library(MagnumMathTestLib ${SHARED_OR_STATIC}
$<TARGET_OBJECTS:MagnumMathObjects>
dummy.cpp) # XCode workaround, see file comment for details
${PROJECT_SOURCE_DIR}/src/dummy.cpp) # XCode workaround, see file comment for details
target_include_directories(MagnumMathTestLib PUBLIC $<TARGET_PROPERTY:Magnum,INTERFACE_INCLUDE_DIRECTORIES>)
target_compile_definitions(MagnumMathTestLib PRIVATE "CORRADE_GRACEFUL_ASSERT")
set_target_properties(MagnumMathTestLib PROPERTIES DEBUG_POSTFIX "-d")

59
src/Magnum/Context.cpp

@ -25,6 +25,7 @@
#include "Context.h"
#include <iostream> /* for initialization log redirection */
#include <string>
#include <unordered_map>
#include <Corrade/Utility/Arguments.h>
@ -64,6 +65,7 @@ const std::vector<Extension>& Extension::extensions(Version version) {
static const std::vector<Extension> empty;
#ifndef MAGNUM_TARGET_GLES
static const std::vector<Extension> extensions{
_extension(GL,AMD,transform_feedback3_lines_triangles),
_extension(GL,AMD,vertex_shader_layer),
_extension(GL,AMD,shader_trinary_minmax),
_extension(GL,ARB,robustness),
@ -241,6 +243,7 @@ const std::vector<Extension>& Extension::extensions(Version version) {
_extension(GL,OES,element_index_uint),
_extension(GL,OES,texture_float_linear),
_extension(GL,OES,texture_half_float_linear),
_extension(GL,OES,fbo_render_mipmap),
_extension(GL,WEBGL,compressed_texture_s3tc),
_extension(GL,WEBGL,depth_texture),
_extension(GL,WEBGL,draw_buffers)};
@ -355,6 +358,7 @@ const std::vector<Extension>& Extension::extensions(Version version) {
_extension(GL,NV,shadow_samplers_cube),
_extension(GL,OES,depth24),
_extension(GL,OES,element_index_uint),
_extension(GL,OES,fbo_render_mipmap),
_extension(GL,OES,rgb8_rgba8),
_extension(GL,OES,texture_3D),
_extension(GL,OES,texture_half_float_linear),
@ -404,28 +408,42 @@ const std::vector<Extension>& Extension::extensions(Version version) {
#endif
}
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
}
Context* Context::_current = nullptr;
namespace {
#ifdef MAGNUM_BUILD_MULTITHREADED
#if !defined(CORRADE_GCC47_COMPATIBILITY) && !defined(CORRADE_TARGET_APPLE)
thread_local
#else
__thread
#endif
#endif
Context* currentContext = nullptr;
}
bool Context::hasCurrent() { return _current; }
bool Context::hasCurrent() { return currentContext; }
Context& Context::current() {
CORRADE_ASSERT(_current, "Context::current(): no current context", *_current);
return *_current;
CORRADE_ASSERT(currentContext, "Context::current(): no current context", *currentContext);
return *currentContext;
}
Context::Context(NoCreateT, Int argc, char** argv, void functionLoader()): _functionLoader{functionLoader}, _version{Version::None} {
Context::Context(NoCreateT, Int argc, const char** argv, void functionLoader()): _functionLoader{functionLoader}, _version{Version::None} {
/* Parse arguments */
Utility::Arguments args{"magnum"};
args.addOption("disable-workarounds")
.setHelp("disable-workarounds", "driver workarounds to disable\n (see src/Magnum/Implementation/driverSpecific.cpp for detailed info)", "LIST")
.addOption("disable-extensions").setHelp("disable-extensions", "OpenGL extensions to disable", "LIST")
.addOption("log", "default").setHelp("log", "Console logging", "default|quiet")
.setFromEnvironment("disable-workarounds")
.setFromEnvironment("disable-extensions")
.setFromEnvironment("log")
.parse(argc, argv);
/* Decide whether to display initialization log */
_displayInitializationLog = !(args.value("log") == "quiet" || args.value("log") == "QUIET");
/* Disable driver workarounds */
for(auto&& workaround: Utility::String::splitWithoutEmptyParts(args.value("disable-workarounds")))
disableDriverWorkaround(workaround);
@ -446,13 +464,13 @@ Context::Context(Context&& other): _version{std::move(other._version)},
_detectedDrivers{std::move(other._detectedDrivers)}
{
other._state = nullptr;
if(_current == &other) _current = this;
if(currentContext == &other) currentContext = this;
}
Context::~Context() {
delete _state;
if(_current == this) _current = nullptr;
if(currentContext == this) currentContext = nullptr;
}
void Context::create() {
@ -638,17 +656,20 @@ bool Context::tryCreate() {
setupDriverWorkarounds();
/* Set this context as current */
CORRADE_ASSERT(!_current, "Context: Another context currently active", false);
_current = this;
CORRADE_ASSERT(!currentContext, "Context: Another context currently active", false);
currentContext = this;
/* Decide whether to print the initialization output or not */
std::ostream* output = _displayInitializationLog ? &std::cout : nullptr;
/* Print some info and initialize state tracker (which also prints some
more info) */
Debug() << "Renderer:" << rendererString() << "by" << vendorString();
Debug() << "OpenGL version:" << versionString();
Debug{output} << "Renderer:" << rendererString() << "by" << vendorString();
Debug{output} << "OpenGL version:" << versionString();
/* Disable extensions as requested by the user */
if(!_disabledExtensions.empty()) {
Debug() << "Disabling extensions:";
Debug{output} << "Disabling extensions:";
/* Put remaining extensions into the hashmap for faster lookup */
std::unordered_map<std::string, Extension> allExtensions{std::move(futureExtensions)};
@ -664,17 +685,17 @@ bool Context::tryCreate() {
if(found == allExtensions.end()) continue;
_extensionRequiredVersion[found->second._index] = Version::None;
Debug() << " " << extension;
Debug{output} << " " << extension;
}
}
_state = new Implementation::State(*this);
_state = new Implementation::State{*this, output};
/* Print a list of used workarounds */
if(!_driverWorkarounds.empty()) {
Debug() << "Using driver workarounds:";
Debug{output} << "Using driver workarounds:";
for(const auto& workaround: _driverWorkarounds)
if(!workaround.second) Debug() << " " << workaround.first;
if(!workaround.second) Debug(output) << " " << workaround.first;
}
/* Initialize functionality based on current OpenGL version and extensions */
@ -810,6 +831,7 @@ void Context::resetState(const States states) {
#ifndef DOXYGEN_GENERATING_OUTPUT
Debug& operator<<(Debug& debug, const Context::Flag value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case Context::Flag::value: return debug << "Context::Flag::" #value;
_c(Debug)
_c(NoError)
@ -817,9 +839,10 @@ Debug& operator<<(Debug& debug, const Context::Flag value) {
_c(RobustAccess)
#endif
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "Context::Flag::(invalid)";
return debug << "Context::Flag(" << Debug::nospace << reinterpret_cast<void*>(GLint(value)) << Debug::nospace << ")";
}
#endif
#endif

11
src/Magnum/Context.h

@ -244,6 +244,8 @@ class MAGNUM_EXPORT Context {
/**
* @brief Whether there is any current context
*
* If Magnum is built with @ref MAGNUM_BUILD_MULTITHREADED, current
* context is thread-local instead of global (the default).
* @see @ref current()
*/
static bool hasCurrent();
@ -251,7 +253,9 @@ class MAGNUM_EXPORT Context {
/**
* @brief Current context
*
* Expect that there is current context.
* Expect that there is current context. If Magnum is built with
* @ref MAGNUM_BUILD_MULTITHREADED, current context is thread-local
* instead of global (the default).
* @see @ref hasCurrent()
*/
static Context& current();
@ -501,9 +505,7 @@ class MAGNUM_EXPORT Context {
Implementation::State& state() { return *_state; }
private:
MAGNUM_LOCAL static Context* _current;
explicit Context(NoCreateT, Int argc, char** argv, void functionLoader());
explicit Context(NoCreateT, Int argc, const char** argv, void functionLoader());
bool tryCreate();
void create();
@ -529,6 +531,7 @@ class MAGNUM_EXPORT Context {
/* True means known and disabled, false means known */
std::vector<std::pair<std::string, bool>> _driverWorkarounds;
std::vector<std::string> _disabledExtensions;
bool _displayInitializationLog;
};
CORRADE_ENUMSET_OPERATORS(Context::DetectedDrivers)

45
src/Magnum/DebugOutput.cpp

@ -184,7 +184,7 @@ void DebugOutput::controlImplementationKhr(const GLenum source, const GLenum typ
static_cast<void>(severity);
static_cast<void>(ids);
static_cast<void>(enabled);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -206,7 +206,7 @@ void DebugOutput::callbackImplementationKhr(const Callback callback, const void*
(callbackWrapper, userParam);
#else
static_cast<void>(userParam);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
/* Deleting callback */
@ -219,7 +219,7 @@ void DebugOutput::callbackImplementationKhr(const Callback callback, const void*
#endif
(nullptr, nullptr);
#else
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
}
@ -227,6 +227,7 @@ void DebugOutput::callbackImplementationKhr(const Callback callback, const void*
#ifndef DOXYGEN_GENERATING_OUTPUT
Debug& operator<<(Debug& debug, const DebugOutput::Source value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case DebugOutput::Source::value: return debug << "DebugOutput::Source::" #value;
_c(Api)
_c(WindowSystem)
@ -235,13 +236,15 @@ Debug& operator<<(Debug& debug, const DebugOutput::Source value) {
_c(Application)
_c(Other)
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "DebugOutput::Source::(invalid)";
return debug << "DebugOutput::Source(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, const DebugOutput::Type value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case DebugOutput::Type::value: return debug << "DebugOutput::Type::" #value;
_c(Error)
_c(DeprecatedBehavior)
@ -253,9 +256,10 @@ Debug& operator<<(Debug& debug, const DebugOutput::Type value) {
_c(PopGroup)
_c(Other)
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "DebugOutput::Type::(invalid)";
return debug << "DebugOutput::Type(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, const DebugOutput::Severity value) {
@ -268,7 +272,7 @@ Debug& operator<<(Debug& debug, const DebugOutput::Severity value) {
#undef _c
}
return debug << "DebugOutput::Severity::(invalid)";
return debug << "DebugOutput::Severity(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif
@ -292,7 +296,7 @@ void DebugMessage::insertImplementationKhr(const Source source, const Type type,
static_cast<void>(id);
static_cast<void>(severity);
static_cast<void>(string);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -301,7 +305,7 @@ void DebugMessage::insertImplementationExt(Source, Type, UnsignedInt, DebugOutpu
glInsertEventMarkerEXT(string.size(), string.data());
#else
static_cast<void>(string);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -314,20 +318,29 @@ void DebugMessage::insertImplementationGremedy(Source, Type, UnsignedInt, DebugO
#ifndef DOXYGEN_GENERATING_OUTPUT
Debug& operator<<(Debug& debug, const DebugMessage::Source value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case DebugMessage::Source::value: return debug << "DebugMessage::Source::" #value;
_c(ThirdParty)
_c(Application)
#undef _c
#ifdef MAGNUM_BUILD_DEPRECATED
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
case DebugMessage::Source::Api:
case DebugMessage::Source::WindowSystem:
case DebugMessage::Source::ShaderCompiler:
case DebugMessage::Source::Other:
return debug << DebugOutput::Source(value);
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
#endif
/* LCOV_EXCL_STOP */
}
return debug << "DebugMessage::Source::(invalid)";
return debug << "DebugMessage::Source(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
Debug& operator<<(Debug& debug, const DebugMessage::Type value) {
@ -343,7 +356,7 @@ Debug& operator<<(Debug& debug, const DebugMessage::Type value) {
#undef _c
}
return debug << "DebugMessage::Type::(invalid)";
return debug << "DebugMessage::Type(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif
@ -390,7 +403,7 @@ void DebugGroup::pushImplementationKhr(const Source source, const UnsignedInt id
static_cast<void>(source);
static_cast<void>(id);
static_cast<void>(message);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -399,7 +412,7 @@ void DebugGroup::pushImplementationExt(Source, UnsignedInt, const Containers::Ar
glPushGroupMarkerEXT(message.size(), message.data());
#else
static_cast<void>(message);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -411,7 +424,7 @@ void DebugGroup::popImplementationKhr() {
#elif !defined(CORRADE_TARGET_NACL)
glPopDebugGroupKHR();
#else
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
@ -419,20 +432,22 @@ void DebugGroup::popImplementationExt() {
#ifndef CORRADE_TARGET_NACL
glPopGroupMarkerEXT();
#else
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#ifndef DOXYGEN_GENERATING_OUTPUT
Debug& operator<<(Debug& debug, const DebugGroup::Source value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case DebugGroup::Source::value: return debug << "DebugGroup::Source::" #value;
_c(ThirdParty)
_c(Application)
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "DebugGroup::Source::(invalid)";
return debug << "DebugGroup::Source(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif

12
src/Magnum/DebugOutput.h

@ -480,17 +480,17 @@ class MAGNUM_EXPORT DebugMessage {
/** @copydoc DebugOutput::Source::Api
* @deprecated Use @ref DebugOutput::Source::Api instead.
*/
Api = GLenum(DebugOutput::Source::Api),
Api CORRADE_DEPRECATED_ENUM("use DebugOutput::Source::Api instead") = GLenum(DebugOutput::Source::Api),
/** @copydoc DebugOutput::Source::WindowSystem
* @deprecated Use @ref DebugOutput::Source::WindowSystem instead.
*/
WindowSystem = GLenum(DebugOutput::Source::WindowSystem),
WindowSystem CORRADE_DEPRECATED_ENUM("use DebugOutput::Source::WindowSystem instead") = GLenum(DebugOutput::Source::WindowSystem),
/** @copydoc DebugOutput::Source::ShaderCompiler
* @deprecated Use @ref DebugOutput::Source::ShaderCompiler instead.
*/
ShaderCompiler = GLenum(DebugOutput::Source::ShaderCompiler),
ShaderCompiler CORRADE_DEPRECATED_ENUM("use DebugOutput::Source::ShaderCompiler instead") = GLenum(DebugOutput::Source::ShaderCompiler),
#endif
/** External debugger or third-party middleware */
@ -511,7 +511,7 @@ class MAGNUM_EXPORT DebugMessage {
/** @copydoc DebugOutput::Source::Other
* @deprecated Use @ref DebugOutput::Source::Other instead.
*/
Other = GLenum(DebugOutput::Source::Other)
Other CORRADE_DEPRECATED_ENUM("use DebugOutput::Source::Other instead") = GLenum(DebugOutput::Source::Other)
#endif
};
@ -581,7 +581,7 @@ class MAGNUM_EXPORT DebugMessage {
* @deprecated Use @ref DebugOutput::Callback instead.
*/
/* Can't mark this as deprecated because compiler then complains when I use it as a parameter in setCallback() */
typedef void(*Callback)(DebugMessage::Source, DebugMessage::Type, UnsignedInt, DebugOutput::Severity, const std::string&, const void*);
typedef CORRADE_DEPRECATED("use DebugOutput::Callback instead") void(*Callback)(DebugMessage::Source, DebugMessage::Type, UnsignedInt, DebugOutput::Severity, const std::string&, const void*);
/** @copybrief DebugOutput::maxLoggedMessages()
* @deprecated Use @ref DebugOutput::maxLoggedMessages() instead.
@ -635,7 +635,7 @@ class MAGNUM_EXPORT DebugMessage {
/** @copybrief DebugOutput::setCallback()
* @deprecated Use @ref DebugOutput::setCallback() instead.
*/
CORRADE_DEPRECATED("use DebugOutput::setCallback() instead") static void setCallback(Callback callback, const void* userParam = nullptr) {
CORRADE_DEPRECATED("use DebugOutput::setCallback() instead") static void setCallback(DebugOutput::Callback callback, const void* userParam = nullptr) {
DebugOutput::setCallback(reinterpret_cast<DebugOutput::Callback>(callback), userParam);
}

12
src/Magnum/DebugTools/Test/ForceRendererTest.cpp

@ -24,6 +24,7 @@
*/
#include <Corrade/TestSuite/Tester.h>
#include <Corrade/TestSuite/Compare/Numeric.h>
#include "../Implementation/ForceRendererTransformation.h"
@ -100,9 +101,18 @@ void ForceRendererTest::arbitrary3D() {
/* All vectors are orthogonal */
CORRADE_COMPARE(Math::dot(m.right(), m.up()), 0.0f);
#ifndef CORRADE_TARGET_EMSCRIPTEN
CORRADE_COMPARE(Math::dot(m.right(), m.backward()), 0.0f);
#else
/* Emscripten -O1 has slightly lower precision. -O2 works fine. */
CORRADE_COMPARE_AS(Math::abs(Math::dot(m.right(), m.backward())),
Math::TypeTraits<Float>::epsilon(),
TestSuite::Compare::Less);
#endif
/** @todo This shouldn't be too different */
CORRADE_VERIFY(Math::abs(Math::dot(m.up(), m.backward())) < Math::TypeTraits<Float>::epsilon());
CORRADE_COMPARE_AS(Math::abs(Math::dot(m.up(), m.backward())),
Math::TypeTraits<Float>::epsilon(),
TestSuite::Compare::Less);
}
}}}}

4
src/Magnum/DefaultFramebuffer.cpp

@ -117,15 +117,17 @@ void DefaultFramebuffer::initializeContextBasedFunctionality(Context& context) {
#ifndef DOXYGEN_GENERATING_OUTPUT
Debug& operator<<(Debug& debug, const DefaultFramebuffer::Status value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case DefaultFramebuffer::Status::value: return debug << "DefaultFramebuffer::Status::" #value;
_c(Complete)
#ifndef MAGNUM_TARGET_WEBGL
_c(Undefined)
#endif
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "DefaultFramebuffer::Status::(invalid)";
return debug << "DefaultFramebuffer::Status(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif

4
src/Magnum/DimensionTraits.h

@ -118,7 +118,6 @@ template<> struct DimensionTraits<2, Float> {
typedef Math::Range2D<Float> RangeType;
typedef Math::Matrix3<Float> MatrixType;
};
#ifndef MAGNUM_TARGET_GLES
template<> struct DimensionTraits<2, Double> {
DimensionTraits() = delete;
@ -126,7 +125,6 @@ template<> struct DimensionTraits<2, Double> {
typedef Math::Range2D<Double> RangeType;
typedef Math::Matrix3<Double> MatrixType;
};
#endif
/* Three dimensions - integral */
template<class T> struct DimensionTraits<3, T> {
@ -144,7 +142,6 @@ template<> struct DimensionTraits<3, Float> {
typedef Math::Range3D<Float> RangeType;
typedef Math::Matrix4<Float> MatrixType;
};
#ifndef MAGNUM_TARGET_GLES
template<> struct DimensionTraits<3, Double> {
DimensionTraits() = delete;
@ -153,7 +150,6 @@ template<> struct DimensionTraits<3, Double> {
typedef Math::Matrix4<Double> MatrixType;
};
#endif
#endif
}

3
src/Magnum/Extensions.h

@ -80,6 +80,7 @@ namespace GL {
#ifndef MAGNUM_TARGET_GLES
#line 1
namespace AMD {
_extension(GL,AMD,transform_feedback3_lines_triangles, GL210, None) // #397
_extension(GL,AMD,vertex_shader_layer, GL210, None) // #417
_extension(GL,AMD,shader_trinary_minmax, GL210, None) // #428
} namespace ARB {
@ -265,6 +266,7 @@ namespace GL {
_extension(GL,OES,element_index_uint, GLES200, GLES300) // #10
_extension(GL,OES,texture_float_linear, GLES200, GLES300) // #20
_extension(GL,OES,texture_half_float_linear, GLES200, GLES300) // #21
_extension(GL,OES,fbo_render_mipmap, GLES200, GLES300) // #28
#endif
} namespace WEBGL {
#ifdef MAGNUM_TARGET_GLES2
@ -407,6 +409,7 @@ namespace GL {
_extension(GL,OES,depth32, GLES200, None) // #25
#ifdef MAGNUM_TARGET_GLES2
_extension(GL,OES,element_index_uint, GLES200, GLES300) // #26
_extension(GL,OES,fbo_render_mipmap, GLES200, GLES300) // #27
#endif
_extension(GL,OES,mapbuffer, GLES200, None) // #29
#ifdef MAGNUM_TARGET_GLES2

6
src/Magnum/Framebuffer.cpp

@ -389,7 +389,7 @@ void Framebuffer::textureLayerImplementationDefault(BufferAttachment attachment,
static_cast<void>(textureId);
static_cast<void>(mipLevel);
static_cast<void>(layer);
CORRADE_ASSERT_UNREACHABLE();
CORRADE_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
#endif
}
#endif
@ -408,6 +408,7 @@ void Framebuffer::textureLayerImplementationDSAEXT(BufferAttachment attachment,
#ifndef DOXYGEN_GENERATING_OUTPUT
Debug& operator<<(Debug& debug, const Framebuffer::Status value) {
switch(value) {
/* LCOV_EXCL_START */
#define _c(value) case Framebuffer::Status::value: return debug << "Framebuffer::Status::" #value;
_c(Complete)
_c(IncompleteAttachment)
@ -424,9 +425,10 @@ Debug& operator<<(Debug& debug, const Framebuffer::Status value) {
_c(IncompleteLayerTargets)
#endif
#undef _c
/* LCOV_EXCL_STOP */
}
return debug << "Framebuffer::Status::(invalid)";
return debug << "Framebuffer::Status(" << Debug::nospace << reinterpret_cast<void*>(GLenum(value)) << Debug::nospace << ")";
}
#endif

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save