diff --git a/doc/changelog.dox b/doc/changelog.dox index 9b44637b3..50e188a76 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -108,8 +108,11 @@ See also: resulted in a new @cpp "firefox-deprecated-debug-renderer-info" @ce workaround being added, see @ref opengl-workarounds for more info. - Recognizing @webgl_extension{EXT,float_blend} and - @webgl_extension{WEBGL,debug_shaders} extensions, no implementation done - yet + @webgl_extension{WEBGL,debug_shaders} WebGL extensions, no implementation + done yet +- Recognizing @gl_extension{KHR,parallel_shader_compile} GL, GLES and + @webgl_extension{KHR,parallel_shader_compile} WebGL extensions, no + implementation done yet - Recognizing ANGLE GLES and WebGL base vertex, base instance and multi-draw extensions and using them in @ref GL::AbstractShaderProgram::draw(Mesh&) and @ref GL::AbstractShaderProgram::draw(Containers::ArrayView>): diff --git a/doc/developers.dox b/doc/developers.dox index 8ba8a5c6c..eca282ff5 100644 --- a/doc/developers.dox +++ b/doc/developers.dox @@ -561,14 +561,41 @@ in inverse --- but usually @ref developers-deprecation "deprecate first". 10. Iterate until the CIs are green 11. Merge to `master` -@section developers-gl-extensions Checklist for adding / removing GL versions and extensions - -1. Install [flextGL](https://github.com/mosra/flextgl) -2. Go to `src/MagnumExternal/OpenGL/`: - - Update `GL/extensions.txt`, `GLES2/extensions.txt`, +@section developers-gl-extensions Checklist for adding / removing GL extensions + +1. Add new extensions to the GL, GLES and WebGL sections of + `src/Magnum/GL/Extensions.h` + - Order them by extension ID that is mentioned in every extension spec + file. If the extension isn't in the official Khronos registry (such as + various ANGLE extensions), at it at the end of the range. + - Update the numbering to stay monotonic and unique, round up start index + of next section to nearest ten to make the updates bearable + - In case there's a lot of new extensions, + @cpp Implementation::ExtensionCount @ce might needed to be increased. +2. Add them alphabetically ordered to the correct list in + `src/magnum/GL/Context.cpp` + - run GL, ES2, ES3, WebGL1 and WebGL2 build of `GLContextTest` to verify + everything is still okay + - run GL, ES2, ES3, WebGL1 and WebGL2 build of `magnum-gl-info` + - the extension should be listed unless it's not available on given + GL flavor + - and also marked as supported unless the machine doesn't support it + (cross-check with `--extension-strings`) +3. Get [flextGL](https://github.com/mosra/flextgl) and go to + `src/MagnumExternal/OpenGL/`: + - Add/remove extensions in `GL/extensions.txt`, `GLES2/extensions.txt`, `GLES2/Emscripten/extensions.txt`, `GLES3/extensions.txt`, - `GLES3/Emscripten/extensions.txt` (bump versions or add/remove - extensions) + `GLES3/Emscripten/extensions.txt`, in the same order as in + `src/Magnum/GL/Extensions.h` + - For GLES and WebGL extensions, if they aren't in the official Khronos + registry (such as various ANGLE extensions), check if they're in + ANGLE's [gl_angle_ext.xml](https://raw.githubusercontent.com/google/angle/master/scripts/gl_angle_ext.xml) + at least. If not, like with core WebGL functionality that has no match + in the base GLES spec, you may need to craft your own XML file. See + `src/MagnumExternal/OpenGL/GLES3/webgl.xml` for an example. + - WebGL extensions usually have a GLES extension as a base, but then may + remove certains entrypoints from it. If that's the case, add it to the + function blacklist at the end of the Emscripten-specific files. - Run `./update-flextgl.sh` to update everything. Reason there is so many variants of the files are the following: - Desktop GLES on Windows still links to the ancient `opengl32.dll` @@ -580,11 +607,44 @@ in inverse --- but usually @ref developers-deprecation "deprecate first". set the function pointers to those exported symbols in case the system GL header defines them. - Emscripten doesn't have the ability to manually load extension - pointers, thus it has only header files. -3. Check @cb{.sh} git diff @ce for suspicious changes and whitespace-at-EOL -4. For every new added function, add an entry to `doc/opengl-mapping.dox` -5. For every new added limit query (various `GL_MIN_*` and `GL_MAX_*` macros - etc.), add an entry to the bottom of `doc/opengl-mapping.dox` + pointers either, thus it has only header files. +4. Check @cb{.sh} git diff @ce for suspicious changes and whitespace-at-EOL + - If any extensions don't add any useful symbols, comment them out in + the `extensions.txt` files and regenerate to avoid needless bloat +5. For every new function that appeared in the regenerated extension headers, + add an entry to `doc/opengl-mapping.dox` +6. For every new added limit query that appeared in the regenerated extension + headers (various `GL_MIN_*` and `GL_MAX_*` macros etc.), add an entry to + the bottom of `doc/opengl-mapping.dox` +7. Add new extensions to the general GL, GLES and WebGL lists in + `doc/opengl-support.dox`, again matching the order in `Extensions.h` --- + grouped by prefix, but then ordered by extension number + +In order to remove GL functionality, be sure to touch all places mentioned +above, only in inverse --- but usually @ref developers-deprecation "deprecate first", +unless it doesn't affect public API at all. + +@see @ref developers-gl-versions, @ref developers-vk-extensions + +@section developers-gl-versions Checklist for adding / removing GL versions + +1. Add new version enum value: + - to `src/Magnum/GL/Version.h` + - to debug output in `src/Magnum/GL/Version.cpp` + - to @cpp GL::Extension::extensions() @ce in `src/Magnum/GL/Context.cpp` + - to @cpp GL::Context::tryCreate() @ce in `src/Magnum/GL/Context.cpp` + - to specify GLSL version in `src/Magnum/GL/Shader.cpp` + - to the list in `src/Magnum/Platform/gl-info.cpp` + - to the test in `src/Magnum/GL/Test/ContextTest.cpp` +2. Update existing extensions with version in which they became core (last + parameter of the `_extension()` macro in `src/Magnum/GL/Extensions.h`) +3. Go to `src/MagnumExternal/OpenGL/`, bump versions in `GL/extensions.txt`, + `GLES2/extensions.txt`, `GLES2/Emscripten/extensions.txt`, + `GLES3/extensions.txt`, `GLES3/Emscripten/extensions.txt` +4. Continue with @ref developers-gl-extensions for all extensions that were + added by the new version and were not already present +5. For all existing extensions APIs that lose their suffix in the new version, + update doc references to be without the suffix 6. Add a table listing the new version and all new extensions in it to `doc/opengl-support.dox` (take a list of them from the changelog in the official spec PDF). Some extensions might be already present in the general @@ -595,31 +655,13 @@ in inverse --- but usually @ref developers-deprecation "deprecate first". 8. Add a new `requires-glXY`, `requires-glesXY` or `requires-webglXY` alias to `Doxyfile`, `Doxyfile-mcss` and `Doxyfile-public`, copypaste it from existing and change the numbers -9. Add new version enum value: - - to `src/Magnum/GL/Version.h` - - to debug output in `src/Magnum/GL/Version.cpp` - - to @ref GL::Extension::extensions() in `src/Magnum/GL/Context.cpp` - - to @cpp GL::Context::tryCreate() @ce in `src/Magnum/GL/Context.cpp` - - to specify GLSL version in `src/Magnum/GL/Shader.cpp` - - to the list in `src/Magnum/Platform/gl-info.cpp` - - to the test in `src/Magnum/GL/Test/ContextTest.cpp` -10. Add new extensions to `src/Magnum/GL/Extensions.h` - - order them by extension ID that is mentioned in every extension spec - file - - update the numbering to stay monotonic and unique, round up start index - of next section to nearest ten to make the updates bearable - - in case there's a lot of new extensions, @cpp Implementation::ExtensionCount @ce - might needed to be increased - - run `ContextTest` to verify everything is still okay -11. Update existing extensions with version in which they become core (last - parameter of the `_extension()` macro) -12. Update extension list in `src/magnum/GL/Context.cpp` according to changes - in `src/Magnum/GL/Extensions.h` In order to remove GL functionality, be sure to touch all places mentioned above, only in inverse --- but usually @ref developers-deprecation "deprecate first", unless it doesn't affect public API at all. +@see @ref developers-vk-versions + @section developers-gl-functionality Checklist for adding / removing GL functionality 1. Check if given desktop functionality has equivalent in ES or WebGL, add @@ -728,11 +770,11 @@ In order to remove OpenAL functionality, be sure to touch all places mentioned above, only in inverse --- but usually @ref developers-deprecation "deprecate first", unless it doesn't affect public API at all. -@section developers-vk-extensions Checklist for adding / removing Vulkan versions and extensions +@section developers-vk-extensions Checklist for adding / removing Vulkan extensions -1. Add new extensions to `src/Magnum/Vk/Extensions.h` +1. Add new extensions to `src/Magnum/Vk/Extensions.h` - there's a separate list for instance and device extensions, ensure each - in the right list + is in the right list - order them by extension ID that is mentioned on every extension spec page - update the numbering to stay monotonic and unique, round up start index @@ -743,37 +785,61 @@ unless it doesn't affect public API at all. need to be increased 2. Add them alphabetically ordered to the correct list in `src/Magnum/Vk/Extensions.cpp` -3. Update existing extensions with version in which they become core (last - parameter of the `_extension()` macro) -4. Get [flextGL](https://github.com/mosra/flextgl) and go to + - run `VkExtensionsTest` to verify everything is still okay + - run `magnum-vk-info`, the extension should be listed and also marked as + supported, unless the machine doesn't support it (cross-check with + `--extension-strings`) +3. Get [flextGL](https://github.com/mosra/flextgl) and go to `src/MagnumExternal/Vulkan/`: - - Update `extensions.txt` (bump a version or add/remove extensions), - in the same order as `Extensions.h` + - Add/remove extensions in `extensions.txt`, in the same order as in + `src/Magnum/Vk/Extensions.h` - Run `./update-flexgl.sh` to update everything -5. Check @cb{.sh} git diff @ce for suspicious changes and whitespace-at-EOL -6. For every new added function and structure, add an entry to +4. Check @cb{.sh} git diff @ce for suspicious changes and whitespace-at-EOL + - If any extensions don't add any useful symbols, comment them out in + the `extensions.txt` file and regenerate to avoid needless bloat +5. For every new added function and structure, add an entry to `doc/vulkan-mapping.dox` -7. For every new `*Feature` structure, expand the @ref Vk::DeviceFeatures +6. For every new `*Feature` structure, expand the @ref Vk::DeviceFeatures enum according to @ref developers-vk-features -8. Add a table listing the new version and all new extensions in it to +7. Add new extensions to the general list in `doc/vulkan-support.dox`, again + matching the order in `Extensions.h` --- grouped by prefix, but then + ordered by extension number + +In order to remove Vulkan functionality, be sure to touch all places mentioned +above, only in inverse --- but usually @ref developers-deprecation "deprecate first", +unless it doesn't affect public API at all. + +@see @ref developers-vk-versions, @ref developers-gl-extensions + +@section developers-vk-versions Checklist for adding / removing Vulkan versions + +1. Add new version enum value: + - to `src/Magnum/Vk/Version.h` + - to the list in `src/Magnum/Vk/vk-info.cpp` + - to @cpp Vk::InstanceExtension::extensions() @ce and + @cpp Vk::Extension::extensions() @ce in `src/Magnum/Vk/Extensions.cpp` +2. Update existing extensions with version in which they became core (last + parameter of the `_extension()` macro) +3. Continue with @ref developers-vk-extensions for all extensions that were + added by the new version and were not already present +4. For all existing extensions APIs that lose their suffix in the new version, + update doc references to be without the suffix +5. Add a table listing the new version and all new extensions in it to `doc/vulkan-support.dox` (take a list of them from the changelog in the - official spec PDF). Some extensions might be already present in the general + official spec). Some extensions might be already present in the general extension list, move them out of there. -9. Add a new `requires-vkXY` page with @c \@m_footernavigation to +6. Add a new `requires-vkXY` page with @c \@m_footernavigation to `doc/vulkan-support.dox`, mention it as a @c \@subpage at a correct position in the list -10. Add a new `requires-vkXY` alias to `Doxyfile`, `Doxyfile-mcss` and +7. Add a new `requires-vkXY` alias to `Doxyfile`, `Doxyfile-mcss` and `Doxyfile-public`, copypaste it from existing and change the numbers -11. Add new version enum value: - - to `src/Magnum/Vk/Version.h` - - to the list in `src/Magnum/Vk/vk-info.cpp` - - to @ref Vk::InstanceExtension::extensions() and - @ref Vk::Extension::extensions() in `src/Magnum/Vk/Extensions.cpp` In order to remove Vulkan functionality, be sure to touch all places mentioned above, only in inverse --- but usually @ref developers-deprecation "deprecate first", unless it doesn't affect public API at all. +@see @ref developers-gl-versions + @section developers-vk-functionality Checklist for adding / removing Vulkan functionality @todoc adapt from the GL section diff --git a/doc/opengl-mapping.dox b/doc/opengl-mapping.dox index 2b9d03527..2d0dbe60e 100644 --- a/doc/opengl-mapping.dox +++ b/doc/opengl-mapping.dox @@ -290,6 +290,7 @@ OpenGL function | Matching API @fn_gl_extension{MakeTextureHandleResident,ARB,bindless_texture} | | @fn_gl_extension{MakeTextureHandleNonResident,ARB,bindless_texture} | | @fn_gl{MapBuffer}, \n `glMapNamedBuffer()`, \n @fn_gl{MapBufferRange}, \n `glMapNamedBufferRange()`, \n @fn_gl{UnmapBuffer}, \n `glUnmapNamedBuffer()` | @ref GL::Buffer::map(), @ref GL::Buffer::unmap() +@fn_gl_extension{MaxShaderCompilerThreads,KHR,parallel_shader_compile} | | @fn_gl{MemoryBarrier}, \n `glMemoryBarrierByRegion()` | @ref GL::Renderer::setMemoryBarrier(), \n @ref GL::Renderer::setMemoryBarrierByRegion() @fn_gl{MinSampleShading} | @ref GL::Renderer::setMinSampleShading() @fn_gl{MultiDrawArrays}, \n @fn_gl{MultiDrawElements}, \n @fn_gl{MultiDrawElementsBaseVertex} | @ref GL::AbstractShaderProgram::draw(Containers::ArrayView>) diff --git a/doc/opengl-support.dox b/doc/opengl-support.dox index 1eeaa9c4a..cf85a07b6 100644 --- a/doc/opengl-support.dox +++ b/doc/opengl-support.dox @@ -297,6 +297,7 @@ Extension | Status @gl_extension{KHR,blend_equation_advanced} | done @gl_extension2{KHR,blend_equation_advanced_coherent,KHR_blend_equation_advanced} | done @gl_extension{KHR,texture_compression_astc_sliced_3d} | done (nothing to do) +@gl_extension{KHR,parallel_shader_compile} | | @subsection opengl-support-extensions-vendor Vendor OpenGL extensions @@ -489,6 +490,7 @@ Extension | Status @gl_extension{KHR,context_flush_control} | | @gl_extension{KHR,no_error} | done @gl_extension{KHR,texture_compression_astc_sliced_3d} | done (nothing to do) +@gl_extension{KHR,parallel_shader_compile} | | @gl_extension2{NV,read_buffer_front,NV_read_buffer} | done @gl_extension2{NV,read_depth,NV_read_depth_stencil} | done @gl_extension2{NV,read_stencil,NV_read_depth_stencil} | done @@ -564,6 +566,7 @@ Extension | Status @webgl_extension{EXT,clip_cull_distance} | done @webgl_extension{EXT,texture_norm16} | done @webgl_extension{EXT,draw_buffers_indexed} | done +@webgl_extension{KHR,parallel_shader_compile} | | @webgl_extension{OES,texture_float_linear} | done @webgl_extension{OVR,multiview2} | | @webgl_extension{WEBGL,lose_context} | | diff --git a/package/archlinux/magnum-git/PKGBUILD b/package/archlinux/magnum-git/PKGBUILD index f347ad388..68480f08c 100644 --- a/package/archlinux/magnum-git/PKGBUILD +++ b/package/archlinux/magnum-git/PKGBUILD @@ -1,6 +1,6 @@ # Author: mosra pkgname=magnum-git -pkgver=2020.06.r481.ga4979e2cd +pkgver=2020.06.r1626.g67d37c9ed pkgrel=1 pkgdesc="C++11/C++14 graphics middleware for games and data visualization (Git version)" arch=('i686' 'x86_64') diff --git a/src/Magnum/DebugTools/Test/CMakeLists.txt b/src/Magnum/DebugTools/Test/CMakeLists.txt index 02094a6c5..6e9e3db21 100644 --- a/src/Magnum/DebugTools/Test/CMakeLists.txt +++ b/src/Magnum/DebugTools/Test/CMakeLists.txt @@ -44,11 +44,6 @@ if(MAGNUM_WITH_TRADE) set(COMPAREIMAGETEST_SAVE_DIR ${CMAKE_CURRENT_BINARY_DIR}/write) endif() - # CMake before 3.8 has broken $ expressions for iOS (see - # https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since - # Corrade doesn't support dynamic plugins on iOS, this sorta works around - # that. Should be revisited when updating Travis to newer Xcode (xcode7.3 - # has CMake 3.6). if(NOT MAGNUM_BUILD_PLUGINS_STATIC) if(MAGNUM_WITH_ANYIMAGEIMPORTER) set(ANYIMAGEIMPORTER_PLUGIN_FILENAME $) diff --git a/src/Magnum/GL/Context.cpp b/src/Magnum/GL/Context.cpp index 7f8835403..58de84b38 100644 --- a/src/Magnum/GL/Context.cpp +++ b/src/Magnum/GL/Context.cpp @@ -104,6 +104,7 @@ constexpr Extension ExtensionList[]{ Extensions::GREMEDY::string_marker{}, Extensions::KHR::blend_equation_advanced{}, Extensions::KHR::blend_equation_advanced_coherent{}, + Extensions::KHR::parallel_shader_compile{}, Extensions::KHR::texture_compression_astc_hdr{}, Extensions::KHR::texture_compression_astc_ldr{}, Extensions::KHR::texture_compression_astc_sliced_3d{}, @@ -290,6 +291,7 @@ constexpr Extension ExtensionList[]{ #ifndef MAGNUM_TARGET_GLES2 Extensions::EXT::texture_norm16{}, #endif + Extensions::KHR::parallel_shader_compile{}, Extensions::OES::texture_float_linear{}, #ifndef MAGNUM_TARGET_GLES2 Extensions::OVR::multiview2{}, @@ -394,6 +396,7 @@ constexpr Extension ExtensionList[]{ Extensions::KHR::blend_equation_advanced_coherent{}, Extensions::KHR::context_flush_control{}, Extensions::KHR::no_error{}, + Extensions::KHR::parallel_shader_compile{}, Extensions::KHR::texture_compression_astc_hdr{}, Extensions::KHR::texture_compression_astc_sliced_3d{}, #ifndef MAGNUM_TARGET_GLES2 @@ -1281,11 +1284,14 @@ Context::Configuration& Context::Configuration::addDisabledExtensions(std::initi #ifndef DOXYGEN_GENERATING_OUTPUT #ifndef MAGNUM_TARGET_WEBGL Debug& operator<<(Debug& debug, const Context::Flag value) { - debug << "GL::Context::Flag" << Debug::nospace; + const bool packed = debug.immediateFlags() >= Debug::Flag::Packed; + + if(!packed) + debug << "GL::Context::Flag" << Debug::nospace; switch(value) { /* LCOV_EXCL_START */ - #define _c(value) case Context::Flag::value: return debug << "::" #value; + #define _c(value) case Context::Flag::value: return debug << (packed ? "" : "::") << Debug::nospace << #value; _c(Debug) #ifndef MAGNUM_TARGET_GLES _c(ForwardCompatible) @@ -1298,11 +1304,11 @@ Debug& operator<<(Debug& debug, const Context::Flag value) { /* LCOV_EXCL_STOP */ } - return debug << "(" << Debug::nospace << reinterpret_cast(GLint(value)) << Debug::nospace << ")"; + return debug << (packed ? "" : "(") << Debug::nospace << reinterpret_cast(GLint(value)) << Debug::nospace << (packed ? "" : ")"); } Debug& operator<<(Debug& debug, const Context::Flags value) { - return Containers::enumSetDebugOutput(debug, value, "GL::Context::Flags{}", { + return Containers::enumSetDebugOutput(debug, value, debug.immediateFlags() >= Debug::Flag::Packed ? "{}" : "GL::Context::Flags{}", { Context::Flag::Debug, #ifndef MAGNUM_TARGET_GLES Context::Flag::ForwardCompatible, @@ -1316,11 +1322,14 @@ Debug& operator<<(Debug& debug, const Context::Flags value) { #endif Debug& operator<<(Debug& debug, const Context::DetectedDriver value) { - debug << "GL::Context::DetectedDriver" << Debug::nospace; + const bool packed = debug.immediateFlags() >= Debug::Flag::Packed; + + if(!packed) + debug << "GL::Context::DetectedDriver" << Debug::nospace; switch(value) { /* LCOV_EXCL_START */ - #define _c(value) case Context::DetectedDriver::value: return debug << "::" #value; + #define _c(value) case Context::DetectedDriver::value: return debug << (packed ? "" : "::") << Debug::nospace << #value; _c(Amd) #ifdef MAGNUM_TARGET_GLES _c(Angle) @@ -1339,11 +1348,11 @@ Debug& operator<<(Debug& debug, const Context::DetectedDriver value) { /* LCOV_EXCL_STOP */ } - return debug << "(" << Debug::nospace << reinterpret_cast(GLint(value)) << Debug::nospace << ")"; + return debug << (packed ? "" : "(") << Debug::nospace << reinterpret_cast(GLint(value)) << Debug::nospace << (packed ? "" : ")"); } Debug& operator<<(Debug& debug, const Context::DetectedDrivers value) { - return Containers::enumSetDebugOutput(debug, value, "GL::Context::DetectedDrivers{}", { + return Containers::enumSetDebugOutput(debug, value, debug.immediateFlags() >= Debug::Flag::Packed ? "{}" : "GL::Context::DetectedDrivers{}", { #ifndef MAGNUM_TARGET_WEBGL Context::DetectedDriver::Amd, #endif diff --git a/src/Magnum/GL/Extensions.h b/src/Magnum/GL/Extensions.h index 11ec946b3..f0255e1f6 100644 --- a/src/Magnum/GL/Extensions.h +++ b/src/Magnum/GL/Extensions.h @@ -256,8 +256,9 @@ namespace AMD { _extension(167,KHR,blend_equation_advanced_coherent, GL210, None) // #174 _extension(168,KHR,no_error, GL210, GL460) // #175 _extension(169,KHR,texture_compression_astc_sliced_3d, GL210, None) // #189 + _extension(170,KHR,parallel_shader_compile, GL210, None) // #192 } namespace MAGNUM { - _extension(170,MAGNUM,shader_vertex_id, GL300, GL300) + _extension(171,MAGNUM,shader_vertex_id, GL300, GL300) } namespace NV { _extension(175,NV,primitive_restart, GL210, GL310) // #285 _extension(176,NV,depth_buffer_float, GL210, GL300) // #334 @@ -305,6 +306,8 @@ namespace ANGLE { #ifndef MAGNUM_TARGET_GLES2 _extension(16,EXT,draw_buffers_indexed, GLES300, None) // #45 #endif +} namespace KHR { + _extension(17,KHR,parallel_shader_compile, GLES200, None) // #37 } namespace OES { #ifdef MAGNUM_TARGET_GLES2 _extension(20,OES,texture_float, GLES200, GLES300) // #1 @@ -488,6 +491,7 @@ namespace ANDROID { _extension( 87,KHR,context_flush_control, GLES200, None) // #191 _extension( 88,KHR,no_error, GLES200, None) // #243 _extension( 89,KHR,texture_compression_astc_sliced_3d, GLES200, None) // #249 + _extension( 90,KHR,parallel_shader_compile, GLES200, None) // #288 } namespace NV { #ifdef MAGNUM_TARGET_GLES2 _extension(100,NV,draw_buffers, GLES200, GLES300) // #91 diff --git a/src/Magnum/GL/Test/CMakeLists.txt b/src/Magnum/GL/Test/CMakeLists.txt index 6aeb80b08..29ba9d095 100644 --- a/src/Magnum/GL/Test/CMakeLists.txt +++ b/src/Magnum/GL/Test/CMakeLists.txt @@ -104,11 +104,6 @@ if(MAGNUM_BUILD_GL_TESTS) set(RENDERERGLTEST_FILES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/RendererGLTestFiles) endif() - # CMake before 3.8 has broken $ expressions for iOS (see - # https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since - # Corrade doesn't support dynamic plugins on iOS, this sorta works around - # that. Should be revisited when updating Travis to newer Xcode (xcode7.3 - # has CMake 3.6). if(NOT MAGNUM_BUILD_PLUGINS_STATIC) if(MAGNUM_WITH_ANYIMAGEIMPORTER) set(ANYIMAGEIMPORTER_PLUGIN_FILENAME $) diff --git a/src/Magnum/GL/Test/ContextTest.cpp b/src/Magnum/GL/Test/ContextTest.cpp index eaa2afde1..c9070c4c3 100644 --- a/src/Magnum/GL/Test/ContextTest.cpp +++ b/src/Magnum/GL/Test/ContextTest.cpp @@ -56,10 +56,14 @@ struct ContextTest: TestSuite::Tester { void extensions(); void debugFlag(); + void debugFlagPacked(); void debugFlags(); + void debugFlagsPacked(); void debugDetectedDriver(); + void debugDetectedDriverPacked(); void debugDetectedDrivers(); + void debugDetectedDriversPacked(); }; ContextTest::ContextTest() { @@ -78,10 +82,14 @@ ContextTest::ContextTest() { &ContextTest::extensions, &ContextTest::debugFlag, + &ContextTest::debugFlagPacked, &ContextTest::debugFlags, + &ContextTest::debugFlagsPacked, &ContextTest::debugDetectedDriver, - &ContextTest::debugDetectedDrivers}); + &ContextTest::debugDetectedDriverPacked, + &ContextTest::debugDetectedDrivers, + &ContextTest::debugDetectedDriversPacked}); } void ContextTest::isExtension() { @@ -453,13 +461,35 @@ void ContextTest::debugFlag() { #endif } +void ContextTest::debugFlagPacked() { + #ifdef MAGNUM_TARGET_WEBGL + CORRADE_SKIP("No context flags on Emscripten yet."); + #else + std::ostringstream out; + /* Last is not packed, ones before should not make any flags persistent */ + Debug{&out} << Debug::packed << Context::Flag::Debug << Debug::packed << Context::Flag(0xdead) << Context::Flag::NoError; + CORRADE_COMPARE(out.str(), "Debug 0xdead GL::Context::Flag::NoError\n"); + #endif +} + void ContextTest::debugFlags() { #ifdef MAGNUM_TARGET_WEBGL CORRADE_SKIP("No context flags on Emscripten yet."); #else std::ostringstream out; - Debug(&out) << Context::Flags{} << (Context::Flag::Debug|Context::Flag::NoError) << (Context::Flag::Debug|Context::Flag(0xded0)); - CORRADE_COMPARE(out.str(), "GL::Context::Flags{} GL::Context::Flag::Debug|GL::Context::Flag::NoError GL::Context::Flag::Debug|GL::Context::Flag(0xded0)\n"); + Debug{&out} << (Context::Flag::Debug|Context::Flag::NoError|Context::Flag(0xded0)) << Context::Flags{}; + CORRADE_COMPARE(out.str(), "GL::Context::Flag::Debug|GL::Context::Flag::NoError|GL::Context::Flag(0xded0) GL::Context::Flags{}\n"); + #endif +} + +void ContextTest::debugFlagsPacked() { + #ifdef MAGNUM_TARGET_WEBGL + CORRADE_SKIP("No context flags on Emscripten yet."); + #else + std::ostringstream out; + /* Last is not packed, ones before should not make any flags persistent */ + Debug{&out} << Debug::packed << (Context::Flag::Debug|Context::Flag::NoError|Context::Flag(0xded0)) << Debug::packed << Context::Flags{} << (Context::Flag::Debug|Context::Flag::NoError); + CORRADE_COMPARE(out.str(), "Debug|NoError|0xded0 {} GL::Context::Flag::Debug|GL::Context::Flag::NoError\n"); #endif } @@ -474,14 +504,38 @@ void ContextTest::debugDetectedDriver() { #endif } +void ContextTest::debugDetectedDriverPacked() { + std::ostringstream out; + /* Last is not packed, ones before should not make any flags persistent */ + #ifndef MAGNUM_TARGET_WEBGL + Debug{&out} << Debug::packed << Context::DetectedDriver::Amd << Debug::packed << Context::DetectedDriver(0xdead) << Context::DetectedDriver::NVidia; + CORRADE_COMPARE(out.str(), "Amd 0xdead GL::Context::DetectedDriver::NVidia\n"); + #else + Debug{&out} << Debug::packed << Context::DetectedDriver::Angle << Debug::packed << Context::DetectedDriver(0xdead) << Context::DetectedDriver::Angle; + CORRADE_COMPARE(out.str(), "Angle 0xdead GL::Context::DetectedDriver::Angle\n"); + #endif +} + void ContextTest::debugDetectedDrivers() { std::ostringstream out; #ifndef MAGNUM_TARGET_WEBGL - Debug{&out} << Context::DetectedDrivers{} << (Context::DetectedDriver::Amd|Context::DetectedDriver::NVidia) << (Context::DetectedDriver::Mesa|Context::DetectedDriver(0xde00)); - CORRADE_COMPARE(out.str(), "GL::Context::DetectedDrivers{} GL::Context::DetectedDriver::Amd|GL::Context::DetectedDriver::NVidia GL::Context::DetectedDriver::Mesa|GL::Context::DetectedDriver(0xde00)\n"); + Debug{&out} << (Context::DetectedDriver::Amd|Context::DetectedDriver::Mesa|Context::DetectedDriver(0xde00)) << Context::DetectedDrivers{}; + CORRADE_COMPARE(out.str(), "GL::Context::DetectedDriver::Amd|GL::Context::DetectedDriver::Mesa|GL::Context::DetectedDriver(0xde00) GL::Context::DetectedDrivers{}\n"); + #else + Debug{&out} << (Context::DetectedDriver::Angle|Context::DetectedDriver(0xde00)) << Context::DetectedDrivers{}; + CORRADE_COMPARE(out.str(), "GL::Context::DetectedDriver::Angle|GL::Context::DetectedDriver(0xde00) GL::Context::DetectedDrivers{}\n"); + #endif +} + +void ContextTest::debugDetectedDriversPacked() { + std::ostringstream out; + /* Last is not packed, ones before should not make any flags persistent */ + #ifndef MAGNUM_TARGET_WEBGL + Debug{&out} << Debug::packed << (Context::DetectedDriver::Amd|Context::DetectedDriver::Mesa|Context::DetectedDriver(0xde00)) << Debug::packed << Context::DetectedDrivers{} << (Context::DetectedDriver::Amd|Context::DetectedDriver::Mesa); + CORRADE_COMPARE(out.str(), "Amd|Mesa|0xde00 {} GL::Context::DetectedDriver::Amd|GL::Context::DetectedDriver::Mesa\n"); #else - Debug{&out} << Context::DetectedDrivers{} << (Context::DetectedDriver::Angle) << (Context::DetectedDriver::Angle|Context::DetectedDriver(0xde00)); - CORRADE_COMPARE(out.str(), "GL::Context::DetectedDrivers{} GL::Context::DetectedDriver::Angle GL::Context::DetectedDriver::Angle|GL::Context::DetectedDriver(0xde00)\n"); + Debug{&out} << Debug::packed << (Context::DetectedDriver::Angle|Context::DetectedDriver(0xde00)) << Debug::packed << Context::DetectedDrivers{} << (Context::DetectedDriver::Angle|Context::DetectedDriver(0xde00)); + CORRADE_COMPARE(out.str(), "Angle|0xde00 {} GL::Context::DetectedDriver::Angle|GL::Context::DetectedDriver(0xde00)\n"); #endif } diff --git a/src/Magnum/MeshTools/Test/CMakeLists.txt b/src/Magnum/MeshTools/Test/CMakeLists.txt index 1c2d37f82..5281f7976 100644 --- a/src/Magnum/MeshTools/Test/CMakeLists.txt +++ b/src/Magnum/MeshTools/Test/CMakeLists.txt @@ -75,11 +75,6 @@ if(MAGNUM_BUILD_GL_TESTS) set(MESHTOOLS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}) endif() - # CMake before 3.8 has broken $ expressions for iOS (see - # https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since - # Corrade doesn't support dynamic plugins on iOS, this sorta works around - # that. Should be revisited when updating Travis to newer Xcode (xcode7.3 - # has CMake 3.6). if(NOT MAGNUM_BUILD_PLUGINS_STATIC) if(MAGNUM_WITH_ANYIMAGEIMPORTER) set(ANYIMAGEIMPORTER_PLUGIN_FILENAME $) diff --git a/src/Magnum/Platform/gl-info.cpp b/src/Magnum/Platform/gl-info.cpp index cd0d8534e..d0a317823 100644 --- a/src/Magnum/Platform/gl-info.cpp +++ b/src/Magnum/Platform/gl-info.cpp @@ -413,9 +413,9 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat Debug{} << "Core profile:" << (c.isCoreProfile() ? "yes" : "no"); #endif #ifndef MAGNUM_TARGET_WEBGL - Debug{} << "Context flags:" << c.flags(); + Debug{} << "Context flags:" << Debug::packed << c.flags(); #endif - Debug{} << "Detected driver:" << c.detectedDriver(); + Debug{} << "Detected driver:" << Debug::packed << c.detectedDriver(); Debug{} << "Supported GLSL versions:"; Debug{} << " " << ", "_s.joinWithoutEmptyParts(c.shadingLanguageVersionStrings()); diff --git a/src/Magnum/Shaders/Test/CMakeLists.txt b/src/Magnum/Shaders/Test/CMakeLists.txt index 1ba6d15b5..968adb16c 100644 --- a/src/Magnum/Shaders/Test/CMakeLists.txt +++ b/src/Magnum/Shaders/Test/CMakeLists.txt @@ -54,11 +54,6 @@ if(MAGNUM_BUILD_GL_TESTS) set(SHADERS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}) endif() - # CMake before 3.8 has broken $ expressions for iOS (see - # https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since - # Corrade doesn't support dynamic plugins on iOS, this sorta works around - # that. Should be revisited when updating Travis to newer Xcode (xcode7.3 - # has CMake 3.6). if(NOT MAGNUM_BUILD_PLUGINS_STATIC) if(MAGNUM_WITH_ANYIMAGEIMPORTER) set(ANYIMAGEIMPORTER_PLUGIN_FILENAME $) diff --git a/src/Magnum/Tags.h b/src/Magnum/Tags.h index d03446574..7725ad848 100644 --- a/src/Magnum/Tags.h +++ b/src/Magnum/Tags.h @@ -83,10 +83,10 @@ using Corrade::NoCreateT; Used to distinguish construction without allocating memory. @see @ref NoAllocate */ -/* Explicit constructor to avoid ambiguous calls when using {} */ struct NoAllocateT { #ifndef DOXYGEN_GENERATING_OUTPUT - struct Init{}; + struct Init {}; + /* Explicit constructor to avoid ambiguous calls when using {} */ constexpr explicit NoAllocateT(Init) {} #endif }; diff --git a/src/Magnum/Test/TagsTest.cpp b/src/Magnum/Test/TagsTest.cpp index 0fd60736c..5c19b7eb7 100644 --- a/src/Magnum/Test/TagsTest.cpp +++ b/src/Magnum/Test/TagsTest.cpp @@ -43,12 +43,15 @@ TagsTest::TagsTest() { } void TagsTest::noDefaultConstructor() { + /* Isn't default constructible to prevent ambiguity when calling + foo({}) if both foo(TagT) and foo(whatever) is available */ CORRADE_VERIFY(!std::is_default_constructible::value); CORRADE_VERIFY(!std::is_default_constructible::value); CORRADE_VERIFY(!std::is_default_constructible::value); } void TagsTest::inlineDefinition() { + /* Just a sanity check that the types match */ CORRADE_VERIFY(std::is_same::value); CORRADE_VERIFY(std::is_same::value); CORRADE_VERIFY(std::is_same::value); diff --git a/src/Magnum/TextureTools/Test/CMakeLists.txt b/src/Magnum/TextureTools/Test/CMakeLists.txt index 8e20ebaa3..a6a007e7e 100644 --- a/src/Magnum/TextureTools/Test/CMakeLists.txt +++ b/src/Magnum/TextureTools/Test/CMakeLists.txt @@ -39,11 +39,6 @@ if(MAGNUM_BUILD_GL_TESTS) # Otherwise CMake complains that Corrade::PluginManager is not found, wtf find_package(Corrade REQUIRED PluginManager) - # CMake before 3.8 has broken $ expressions for iOS (see - # https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since - # Corrade doesn't support dynamic plugins on iOS, this sorta works around - # that. Should be revisited when updating Travis to newer Xcode (xcode7.3 - # has CMake 3.6). if(NOT MAGNUM_BUILD_PLUGINS_STATIC) if(MAGNUM_WITH_ANYIMAGEIMPORTER) set(ANYIMAGEIMPORTER_PLUGIN_FILENAME $) diff --git a/src/Magnum/Vk/Test/CMakeLists.txt b/src/Magnum/Vk/Test/CMakeLists.txt index 492492f6d..9cdde0518 100644 --- a/src/Magnum/Vk/Test/CMakeLists.txt +++ b/src/Magnum/Vk/Test/CMakeLists.txt @@ -39,11 +39,6 @@ if(MAGNUM_BUILD_VK_TESTS) set(VK_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}) endif() - # CMake before 3.8 has broken $ expressions for iOS (see - # https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since - # Corrade doesn't support dynamic plugins on iOS, this sorta works around - # that. Should be revisited when updating Travis to newer Xcode (xcode7.3 - # has CMake 3.6). if(NOT MAGNUM_BUILD_PLUGINS_STATIC) if(MAGNUM_WITH_ANYIMAGEIMPORTER) set(ANYIMAGEIMPORTER_PLUGIN_FILENAME $) diff --git a/src/MagnumExternal/OpenGL/GL/extensions.txt b/src/MagnumExternal/OpenGL/GL/extensions.txt index cb8f6593f..b48691380 100644 --- a/src/MagnumExternal/OpenGL/GL/extensions.txt +++ b/src/MagnumExternal/OpenGL/GL/extensions.txt @@ -41,6 +41,7 @@ extension KHR_texture_compression_astc_ldr optional extension KHR_blend_equation_advanced optional extension KHR_blend_equation_advanced_coherent optional # extension KHR_texture_compression_astc_sliced_3d optional +extension KHR_parallel_shader_compile optional extension NV_sample_locations optional extension NV_fragment_shader_barycentric optional extension OVR_multiview optional diff --git a/src/MagnumExternal/OpenGL/GL/flextGL.cpp b/src/MagnumExternal/OpenGL/GL/flextGL.cpp index 1ad0e42b8..d289c4428 100644 --- a/src/MagnumExternal/OpenGL/GL/flextGL.cpp +++ b/src/MagnumExternal/OpenGL/GL/flextGL.cpp @@ -222,6 +222,9 @@ FlextGL flextGL{ /* GL_KHR_blend_equation_advanced */ nullptr, + /* GL_KHR_parallel_shader_compile */ + nullptr, + /* GL_NV_sample_locations */ nullptr, nullptr, diff --git a/src/MagnumExternal/OpenGL/GL/flextGL.h b/src/MagnumExternal/OpenGL/GL/flextGL.h index ddc166c9c..626c8aff5 100644 --- a/src/MagnumExternal/OpenGL/GL/flextGL.h +++ b/src/MagnumExternal/OpenGL/GL/flextGL.h @@ -1775,7 +1775,8 @@ typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum /* GL_KHR_parallel_shader_compile */ -#define GL_COMPLETION_STATUS_KHR 0x91B1 +#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0 +#define GL_COMPLETION_STATUS_KHR 0x91B1 /* GL_NV_sample_locations */ @@ -1880,6 +1881,10 @@ struct FlextGL { void(APIENTRY *BlendBarrierKHR)(void); + /* GL_KHR_parallel_shader_compile */ + + void(APIENTRY *MaxShaderCompilerThreadsKHR)(GLuint); + /* GL_NV_sample_locations */ void(APIENTRY *FramebufferSampleLocationsfvNV)(GLenum, GLuint, GLsizei, const GLfloat *); @@ -2684,6 +2689,10 @@ extern FLEXTGL_EXPORT FlextGL flextGL; #define glBlendBarrierKHR flextGL.BlendBarrierKHR +/* GL_KHR_parallel_shader_compile */ + +#define glMaxShaderCompilerThreadsKHR flextGL.MaxShaderCompilerThreadsKHR + /* GL_NV_sample_locations */ #define glFramebufferSampleLocationsfvNV flextGL.FramebufferSampleLocationsfvNV diff --git a/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp b/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp index f95454ebb..46da39b00 100644 --- a/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp +++ b/src/MagnumExternal/OpenGL/GL/flextGLPlatform.cpp @@ -186,6 +186,9 @@ void flextGLInit(Magnum::GL::Context& context) { /* GL_KHR_blend_equation_advanced */ flextGL.BlendBarrierKHR = reinterpret_cast(loader.load("glBlendBarrierKHR")); + /* GL_KHR_parallel_shader_compile */ + flextGL.MaxShaderCompilerThreadsKHR = reinterpret_cast(loader.load("glMaxShaderCompilerThreadsKHR")); + /* GL_NV_sample_locations */ flextGL.FramebufferSampleLocationsfvNV = reinterpret_cast(loader.load("glFramebufferSampleLocationsfvNV")); flextGL.NamedFramebufferSampleLocationsfvNV = reinterpret_cast(loader.load("glNamedFramebufferSampleLocationsfvNV")); diff --git a/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt b/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt index 1c9250f82..31cb7bb1b 100644 --- a/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES2/Emscripten/extensions.txt @@ -6,6 +6,7 @@ version 2.0 es extraspec https://raw.githubusercontent.com/google/angle/master/scripts/gl_angle_ext.xml +# WebGL 1 only extensions extension ANGLE_instanced_arrays optional extension EXT_color_buffer_half_float optional extension EXT_sRGB optional @@ -23,6 +24,7 @@ extension OES_fbo_render_mipmap optional extension ANGLE_depth_texture optional extension EXT_draw_buffers optional +# WebGL 1 and 2 extensions extension EXT_texture_filter_anisotropic optional extension EXT_disjoint_timer_query optional extension EXT_texture_compression_rgtc optional @@ -36,7 +38,11 @@ extension KHR_texture_compression_astc_ldr optional # WEBGL_blend_equation_advanced_coherent includes just the enums but not the # barrier -extension KHR_blend_equation_advanced optional +extension KHR_blend_equation_advanced optional + +# KHR_parallel_shader_compile includes just GL_COMPLETION_STATUS_KHR and not +# the max threads setting +extension KHR_parallel_shader_compile optional # From the gl_angle_ext file, base for WEBGL_multi_draw extension ANGLE_multi_draw optional @@ -50,6 +56,8 @@ extension ANGLE_base_vertex_base_instance optional begin functions blacklist # Not present in WEBGL_blend_equation_advanced_coherent BlendBarrierKHR + # Not present in WebGL variant of KHR_parallel_shader_compile + MaxShaderCompilerThreadsKHR end functions blacklist # kate: hl python diff --git a/src/MagnumExternal/OpenGL/GLES2/extensions.txt b/src/MagnumExternal/OpenGL/GLES2/extensions.txt index fff42a6ef..f95b2a0f4 100644 --- a/src/MagnumExternal/OpenGL/GLES2/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES2/extensions.txt @@ -6,6 +6,7 @@ version 2.0 es extraspec https://raw.githubusercontent.com/google/angle/master/scripts/gl_angle_ext.xml +# ES2-only extensions extension ANGLE_framebuffer_blit optional extension ANGLE_framebuffer_multisample optional extension ANGLE_instanced_arrays optional @@ -98,6 +99,7 @@ extension KHR_blend_equation_advanced_coherent optional extension KHR_context_flush_control optional extension KHR_no_error optional # extension KHR_texture_compression_astc_sliced_3d optional +extension KHR_parallel_shader_compile optional extension NV_read_buffer_front optional extension NV_read_depth optional extension NV_read_stencil optional diff --git a/src/MagnumExternal/OpenGL/GLES2/flextGL.h b/src/MagnumExternal/OpenGL/GLES2/flextGL.h index 5b24d7ccc..ad7a639df 100644 --- a/src/MagnumExternal/OpenGL/GLES2/flextGL.h +++ b/src/MagnumExternal/OpenGL/GLES2/flextGL.h @@ -1019,6 +1019,11 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 +/* GL_KHR_parallel_shader_compile */ + +#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0 +#define GL_COMPLETION_STATUS_KHR 0x91B1 + /* GL_NV_texture_border_clamp */ #define GL_TEXTURE_BORDER_COLOR_NV 0x1004 @@ -1393,6 +1398,10 @@ struct FlextGL { void(APIENTRY *PopDebugGroupKHR)(void); void(APIENTRY *PushDebugGroupKHR)(GLenum, GLuint, GLsizei, const GLchar *); + /* GL_KHR_parallel_shader_compile */ + + void(APIENTRY *MaxShaderCompilerThreadsKHR)(GLuint); + /* GL_KHR_robustness */ GLenum(APIENTRY *GetGraphicsResetStatusKHR)(void); @@ -1643,6 +1652,10 @@ extern FLEXTGL_EXPORT FlextGL flextGL; #define glPopDebugGroupKHR flextGL.PopDebugGroupKHR #define glPushDebugGroupKHR flextGL.PushDebugGroupKHR +/* GL_KHR_parallel_shader_compile */ + +#define glMaxShaderCompilerThreadsKHR flextGL.MaxShaderCompilerThreadsKHR + /* GL_KHR_robustness */ #define glGetGraphicsResetStatusKHR flextGL.GetGraphicsResetStatusKHR diff --git a/src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h b/src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h index cad27e2b0..37ac07123 100644 --- a/src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h +++ b/src/MagnumExternal/OpenGL/GLES2/flextGLEmscripten.h @@ -576,6 +576,11 @@ typedef khronos_uint64_t GLuint64; #define GL_HSL_COLOR_KHR 0x92AF #define GL_HSL_LUMINOSITY_KHR 0x92B0 +/* GL_KHR_parallel_shader_compile */ + +#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0 +#define GL_COMPLETION_STATUS_KHR 0x91B1 + /* Function prototypes */ /* GL_ANGLE_base_vertex_base_instance */ diff --git a/src/MagnumExternal/OpenGL/GLES2/flextGLPlatform.cpp b/src/MagnumExternal/OpenGL/GLES2/flextGLPlatform.cpp index b6c9e75c3..b1cad512f 100644 --- a/src/MagnumExternal/OpenGL/GLES2/flextGLPlatform.cpp +++ b/src/MagnumExternal/OpenGL/GLES2/flextGLPlatform.cpp @@ -187,6 +187,9 @@ void flextGLInit(Magnum::GL::Context&) { flextGL.PopDebugGroupKHR = reinterpret_cast(loader.load("glPopDebugGroupKHR")); flextGL.PushDebugGroupKHR = reinterpret_cast(loader.load("glPushDebugGroupKHR")); + /* GL_KHR_parallel_shader_compile */ + flextGL.MaxShaderCompilerThreadsKHR = reinterpret_cast(loader.load("glMaxShaderCompilerThreadsKHR")); + /* GL_KHR_robustness */ flextGL.GetGraphicsResetStatusKHR = reinterpret_cast(loader.load("glGetGraphicsResetStatusKHR")); flextGL.GetnUniformfvKHR = reinterpret_cast(loader.load("glGetnUniformfvKHR")); diff --git a/src/MagnumExternal/OpenGL/GLES2/flextGLPlatformIOS.cpp b/src/MagnumExternal/OpenGL/GLES2/flextGLPlatformIOS.cpp index a5d27abd9..83152cd05 100644 --- a/src/MagnumExternal/OpenGL/GLES2/flextGLPlatformIOS.cpp +++ b/src/MagnumExternal/OpenGL/GLES2/flextGLPlatformIOS.cpp @@ -131,6 +131,7 @@ #undef glObjectPtrLabelKHR #undef glPopDebugGroupKHR #undef glPushDebugGroupKHR +#undef glMaxShaderCompilerThreadsKHR #undef glGetGraphicsResetStatusKHR #undef glGetnUniformfvKHR #undef glGetnUniformivKHR @@ -372,6 +373,11 @@ void flextGLInit(Magnum::GL::Context&) { flextGL.PushDebugGroupKHR = reinterpret_cast(glPushDebugGroupKHR); #endif + /* GL_KHR_parallel_shader_compile */ + #if GL_KHR_parallel_shader_compile + flextGL.MaxShaderCompilerThreadsKHR = reinterpret_cast(glMaxShaderCompilerThreadsKHR); + #endif + /* GL_KHR_robustness */ #if GL_KHR_robustness flextGL.GetGraphicsResetStatusKHR = reinterpret_cast(glGetGraphicsResetStatusKHR); diff --git a/src/MagnumExternal/OpenGL/GLES2/flextGLPlatformWindowsDesktop.cpp b/src/MagnumExternal/OpenGL/GLES2/flextGLPlatformWindowsDesktop.cpp index 43806c227..81f64cac9 100644 --- a/src/MagnumExternal/OpenGL/GLES2/flextGLPlatformWindowsDesktop.cpp +++ b/src/MagnumExternal/OpenGL/GLES2/flextGLPlatformWindowsDesktop.cpp @@ -286,6 +286,9 @@ void flextGLInit(Magnum::GL::Context&) { flextGL.PopDebugGroupKHR = reinterpret_cast(loader.load("glPopDebugGroupKHR")); flextGL.PushDebugGroupKHR = reinterpret_cast(loader.load("glPushDebugGroupKHR")); + /* GL_KHR_parallel_shader_compile */ + flextGL.MaxShaderCompilerThreadsKHR = reinterpret_cast(loader.load("glMaxShaderCompilerThreadsKHR")); + /* GL_KHR_robustness */ flextGL.GetGraphicsResetStatusKHR = reinterpret_cast(loader.load("glGetGraphicsResetStatusKHR")); flextGL.GetnUniformfvKHR = reinterpret_cast(loader.load("glGetnUniformfvKHR")); diff --git a/src/MagnumExternal/OpenGL/GLES2/flextGLWindowsDesktop.h b/src/MagnumExternal/OpenGL/GLES2/flextGLWindowsDesktop.h index a245c1844..fe9a05fa2 100644 --- a/src/MagnumExternal/OpenGL/GLES2/flextGLWindowsDesktop.h +++ b/src/MagnumExternal/OpenGL/GLES2/flextGLWindowsDesktop.h @@ -1015,6 +1015,11 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 +/* GL_KHR_parallel_shader_compile */ + +#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0 +#define GL_COMPLETION_STATUS_KHR 0x91B1 + /* GL_NV_texture_border_clamp */ #define GL_TEXTURE_BORDER_COLOR_NV 0x1004 @@ -1393,6 +1398,10 @@ struct FlextGL { void(APIENTRY *PopDebugGroupKHR)(void); void(APIENTRY *PushDebugGroupKHR)(GLenum, GLuint, GLsizei, const GLchar *); + /* GL_KHR_parallel_shader_compile */ + + void(APIENTRY *MaxShaderCompilerThreadsKHR)(GLuint); + /* GL_KHR_robustness */ GLenum(APIENTRY *GetGraphicsResetStatusKHR)(void); @@ -1743,6 +1752,10 @@ extern FLEXTGL_EXPORT FlextGL flextGL; #define glPopDebugGroupKHR flextGL.PopDebugGroupKHR #define glPushDebugGroupKHR flextGL.PushDebugGroupKHR +/* GL_KHR_parallel_shader_compile */ + +#define glMaxShaderCompilerThreadsKHR flextGL.MaxShaderCompilerThreadsKHR + /* GL_KHR_robustness */ #define glGetGraphicsResetStatusKHR flextGL.GetGraphicsResetStatusKHR diff --git a/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt b/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt index 41d4d1ba9..3727199cc 100644 --- a/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES3/Emscripten/extensions.txt @@ -29,6 +29,10 @@ extension KHR_texture_compression_astc_ldr optional # barrier extension KHR_blend_equation_advanced optional +# KHR_parallel_shader_compile includes just GL_COMPLETION_STATUS_KHR and not +# the max threads setting +extension KHR_parallel_shader_compile optional + # From the gl_angle_ext file, base for WEBGL_multi_draw etc extension ANGLE_multi_draw optional extension ANGLE_base_vertex_base_instance optional @@ -41,6 +45,8 @@ extension MAGNUM_what_webgl_has_but_es_not optional begin functions blacklist # Not present in WEBGL_blend_equation_advanced_coherent BlendBarrierKHR + # Not present in WebGL variant of KHR_parallel_shader_compile + MaxShaderCompilerThreadsKHR end functions blacklist # kate: hl python diff --git a/src/MagnumExternal/OpenGL/GLES3/extensions.txt b/src/MagnumExternal/OpenGL/GLES3/extensions.txt index a18dada00..32a066bd2 100644 --- a/src/MagnumExternal/OpenGL/GLES3/extensions.txt +++ b/src/MagnumExternal/OpenGL/GLES3/extensions.txt @@ -73,6 +73,7 @@ extension KHR_blend_equation_advanced_coherent optional extension KHR_context_flush_control optional extension KHR_no_error optional # extension KHR_texture_compression_astc_sliced_3d optional +extension KHR_parallel_shader_compile optional extension NV_read_buffer_front optional extension NV_read_depth optional extension NV_read_stencil optional diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGL.h b/src/MagnumExternal/OpenGL/GLES3/flextGL.h index 9cae0d86a..7aeabd6ac 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGL.h +++ b/src/MagnumExternal/OpenGL/GLES3/flextGL.h @@ -1634,6 +1634,11 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 +/* GL_KHR_parallel_shader_compile */ + +#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0 +#define GL_COMPLETION_STATUS_KHR 0x91B1 + /* GL_NV_texture_border_clamp */ #define GL_TEXTURE_BORDER_COLOR_NV 0x1004 @@ -2238,6 +2243,10 @@ struct FlextGL { void(APIENTRY *PopDebugGroupKHR)(void); void(APIENTRY *PushDebugGroupKHR)(GLenum, GLuint, GLsizei, const GLchar *); + /* GL_KHR_parallel_shader_compile */ + + void(APIENTRY *MaxShaderCompilerThreadsKHR)(GLuint); + /* GL_KHR_robustness */ GLenum(APIENTRY *GetGraphicsResetStatusKHR)(void); @@ -2577,6 +2586,10 @@ extern FLEXTGL_EXPORT FlextGL flextGL; #define glPopDebugGroupKHR flextGL.PopDebugGroupKHR #define glPushDebugGroupKHR flextGL.PushDebugGroupKHR +/* GL_KHR_parallel_shader_compile */ + +#define glMaxShaderCompilerThreadsKHR flextGL.MaxShaderCompilerThreadsKHR + /* GL_KHR_robustness */ #define glGetGraphicsResetStatusKHR flextGL.GetGraphicsResetStatusKHR diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h b/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h index cb3afe11b..d7fc39281 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLEmscripten.h @@ -879,6 +879,11 @@ typedef struct __GLsync *GLsync; #define GL_HSL_COLOR_KHR 0x92AF #define GL_HSL_LUMINOSITY_KHR 0x92B0 +/* GL_KHR_parallel_shader_compile */ + +#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0 +#define GL_COMPLETION_STATUS_KHR 0x91B1 + /* Function prototypes */ /* GL_ANGLE_base_vertex_base_instance */ diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp index e19832b11..cd13791b1 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatform.cpp @@ -305,6 +305,9 @@ void flextGLInit(Magnum::GL::Context&) { flextGL.PopDebugGroupKHR = reinterpret_cast(loader.load("glPopDebugGroupKHR")); flextGL.PushDebugGroupKHR = reinterpret_cast(loader.load("glPushDebugGroupKHR")); + /* GL_KHR_parallel_shader_compile */ + flextGL.MaxShaderCompilerThreadsKHR = reinterpret_cast(loader.load("glMaxShaderCompilerThreadsKHR")); + /* GL_KHR_robustness */ flextGL.GetGraphicsResetStatusKHR = reinterpret_cast(loader.load("glGetGraphicsResetStatusKHR")); flextGL.GetnUniformfvKHR = reinterpret_cast(loader.load("glGetnUniformfvKHR")); diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformIOS.cpp b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformIOS.cpp index 81cc5911b..64ee4375e 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformIOS.cpp +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformIOS.cpp @@ -141,6 +141,7 @@ #undef glObjectPtrLabelKHR #undef glPopDebugGroupKHR #undef glPushDebugGroupKHR +#undef glMaxShaderCompilerThreadsKHR #undef glGetGraphicsResetStatusKHR #undef glGetnUniformfvKHR #undef glGetnUniformivKHR @@ -361,6 +362,11 @@ void flextGLInit(Magnum::GL::Context&) { flextGL.PushDebugGroupKHR = reinterpret_cast(glPushDebugGroupKHR); #endif + /* GL_KHR_parallel_shader_compile */ + #if GL_KHR_parallel_shader_compile + flextGL.MaxShaderCompilerThreadsKHR = reinterpret_cast(glMaxShaderCompilerThreadsKHR); + #endif + /* GL_KHR_robustness */ #if GL_KHR_robustness flextGL.GetGraphicsResetStatusKHR = reinterpret_cast(glGetGraphicsResetStatusKHR); diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp index 6c8a520a1..3dceb07db 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLPlatformWindowsDesktop.cpp @@ -507,6 +507,9 @@ void flextGLInit(Magnum::GL::Context&) { flextGL.PopDebugGroupKHR = reinterpret_cast(loader.load("glPopDebugGroupKHR")); flextGL.PushDebugGroupKHR = reinterpret_cast(loader.load("glPushDebugGroupKHR")); + /* GL_KHR_parallel_shader_compile */ + flextGL.MaxShaderCompilerThreadsKHR = reinterpret_cast(loader.load("glMaxShaderCompilerThreadsKHR")); + /* GL_KHR_robustness */ flextGL.GetGraphicsResetStatusKHR = reinterpret_cast(loader.load("glGetGraphicsResetStatusKHR")); flextGL.GetnUniformfvKHR = reinterpret_cast(loader.load("glGetnUniformfvKHR")); diff --git a/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h b/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h index 12adf192c..2ad781e50 100644 --- a/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h +++ b/src/MagnumExternal/OpenGL/GLES3/flextGLWindowsDesktop.h @@ -1627,6 +1627,11 @@ typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLen #define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 +/* GL_KHR_parallel_shader_compile */ + +#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0 +#define GL_COMPLETION_STATUS_KHR 0x91B1 + /* GL_NV_texture_border_clamp */ #define GL_TEXTURE_BORDER_COLOR_NV 0x1004 @@ -2242,6 +2247,10 @@ struct FlextGL { void(APIENTRY *PopDebugGroupKHR)(void); void(APIENTRY *PushDebugGroupKHR)(GLenum, GLuint, GLsizei, const GLchar *); + /* GL_KHR_parallel_shader_compile */ + + void(APIENTRY *MaxShaderCompilerThreadsKHR)(GLuint); + /* GL_KHR_robustness */ GLenum(APIENTRY *GetGraphicsResetStatusKHR)(void); @@ -2785,6 +2794,10 @@ extern FLEXTGL_EXPORT FlextGL flextGL; #define glPopDebugGroupKHR flextGL.PopDebugGroupKHR #define glPushDebugGroupKHR flextGL.PushDebugGroupKHR +/* GL_KHR_parallel_shader_compile */ + +#define glMaxShaderCompilerThreadsKHR flextGL.MaxShaderCompilerThreadsKHR + /* GL_KHR_robustness */ #define glGetGraphicsResetStatusKHR flextGL.GetGraphicsResetStatusKHR diff --git a/src/MagnumPlugins/AnyAudioImporter/Test/CMakeLists.txt b/src/MagnumPlugins/AnyAudioImporter/Test/CMakeLists.txt index 130ca3dfa..8767544cf 100644 --- a/src/MagnumPlugins/AnyAudioImporter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/AnyAudioImporter/Test/CMakeLists.txt @@ -33,10 +33,6 @@ else() set(WAVAUDIOIMPORTER_TEST_DIR ${PROJECT_SOURCE_DIR}/src/MagnumPlugins/WavAudioImporter/Test) endif() -# CMake before 3.8 has broken $ expressions for iOS (see -# https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since Corrade -# doesn't support dynamic plugins on iOS, this sorta works around that. Should -# be revisited when updating Travis to newer Xcode (xcode7.3 has CMake 3.6). if(NOT MAGNUM_ANYAUDIOIMPORTER_BUILD_STATIC) set(ANYAUDIOIMPORTER_PLUGIN_FILENAME $) if(MAGNUM_WITH_WAVAUDIOIMPORTER) diff --git a/src/MagnumPlugins/AnyImageConverter/Test/CMakeLists.txt b/src/MagnumPlugins/AnyImageConverter/Test/CMakeLists.txt index ee4606a40..34f416f36 100644 --- a/src/MagnumPlugins/AnyImageConverter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/AnyImageConverter/Test/CMakeLists.txt @@ -40,10 +40,6 @@ else() set(ANYIMAGEIMPORTER_TEST_DIR ${PROJECT_SOURCE_DIR}/src/MagnumPlugins/AnyImageImporter/Test) endif() -# CMake before 3.8 has broken $ expressions for iOS (see -# https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since Corrade -# doesn't support dynamic plugins on iOS, this sorta works around that. Should -# be revisited when updating Travis to newer Xcode (xcode7.3 has CMake 3.6). if(NOT MAGNUM_ANYIMAGECONVERTER_BUILD_STATIC) set(ANYIMAGECONVERTER_PLUGIN_FILENAME $) if(MAGNUM_WITH_TGAIMAGECONVERTER) diff --git a/src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt b/src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt index af0706345..f6599c548 100644 --- a/src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/AnyImageImporter/Test/CMakeLists.txt @@ -33,10 +33,6 @@ else() set(ANYIMAGEIMPORTER_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}) endif() -# CMake before 3.8 has broken $ expressions for iOS (see -# https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since Corrade -# doesn't support dynamic plugins on iOS, this sorta works around that. Should -# be revisited when updating Travis to newer Xcode (xcode7.3 has CMake 3.6). if(NOT MAGNUM_ANYIMAGEIMPORTER_BUILD_STATIC) set(ANYIMAGEIMPORTER_PLUGIN_FILENAME $) if(MAGNUM_WITH_TGAIMPORTER) diff --git a/src/MagnumPlugins/AnySceneConverter/Test/CMakeLists.txt b/src/MagnumPlugins/AnySceneConverter/Test/CMakeLists.txt index f8db40c1f..7a5c7fbf8 100644 --- a/src/MagnumPlugins/AnySceneConverter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/AnySceneConverter/Test/CMakeLists.txt @@ -37,10 +37,6 @@ else() set(ANYSCENEIMPORTER_TEST_DIR ${PROJECT_SOURCE_DIR}/src/MagnumPlugins/AnySceneImporter/Test) endif() -# CMake before 3.8 has broken $ expressions for iOS (see -# https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since Corrade -# doesn't support dynamic plugins on iOS, this sorta works around that. Should -# be revisited when updating Travis to newer Xcode (xcode7.3 has CMake 3.6). if(NOT MAGNUM_ANYSCENECONVERTER_BUILD_STATIC) set(ANYSCENECONVERTER_PLUGIN_FILENAME $) if(MAGNUM_WITH_TGAIMAGECONVERTER) diff --git a/src/MagnumPlugins/AnySceneImporter/Test/AnySceneImporterTest.cpp b/src/MagnumPlugins/AnySceneImporter/Test/AnySceneImporterTest.cpp index 267916528..4887ae510 100644 --- a/src/MagnumPlugins/AnySceneImporter/Test/AnySceneImporterTest.cpp +++ b/src/MagnumPlugins/AnySceneImporter/Test/AnySceneImporterTest.cpp @@ -78,7 +78,7 @@ const struct { const char* name; Containers::String filename; } LoadData[]{ - {"OBJ", Utility::Path::join(OBJIMPORTER_TEST_DIR, "pointMesh.obj")}, + {"OBJ", Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-primitive-points.obj")}, }; constexpr struct { @@ -157,7 +157,7 @@ void AnySceneImporterTest::loadDeprecatedMeshData() { CORRADE_SKIP("ObjImporter plugin not enabled, cannot test"); Containers::Pointer importer = _manager.instantiate("AnySceneImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "pointMesh.obj"))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-primitive-points.obj"))); /* Check only size, as it is good enough proof that it is working */ @@ -298,7 +298,7 @@ void AnySceneImporterTest::propagateFileCallback() { Containers::Array storage; importer->setFileCallback([](const std::string&, InputFileCallbackPolicy, Containers::Array& storage) -> Containers::Optional> { - Containers::Optional> data = Utility::Path::read(Utility::Path::join(OBJIMPORTER_TEST_DIR, "pointMesh.obj")); + Containers::Optional> data = Utility::Path::read(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-primitive-points.obj")); CORRADE_VERIFY(data); storage = *std::move(data); return Containers::ArrayView{storage}; diff --git a/src/MagnumPlugins/AnySceneImporter/Test/CMakeLists.txt b/src/MagnumPlugins/AnySceneImporter/Test/CMakeLists.txt index 272fe208a..48a5ce9aa 100644 --- a/src/MagnumPlugins/AnySceneImporter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/AnySceneImporter/Test/CMakeLists.txt @@ -35,10 +35,6 @@ else() set(OBJIMPORTER_TEST_DIR ${PROJECT_SOURCE_DIR}/src/MagnumPlugins/ObjImporter/Test) endif() -# CMake before 3.8 has broken $ expressions for iOS (see -# https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since Corrade -# doesn't support dynamic plugins on iOS, this sorta works around that. Should -# be revisited when updating Travis to newer Xcode (xcode7.3 has CMake 3.6). if(NOT MAGNUM_ANYSCENEIMPORTER_BUILD_STATIC) set(ANYSCENEIMPORTER_PLUGIN_FILENAME $) if(MAGNUM_WITH_OBJIMPORTER) @@ -55,7 +51,7 @@ file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$/configure.h corrade_add_test(AnySceneImporterTest AnySceneImporterTest.cpp LIBRARIES MagnumTrade FILES - ${PROJECT_SOURCE_DIR}/src/MagnumPlugins/ObjImporter/Test/pointMesh.obj + ${PROJECT_SOURCE_DIR}/src/MagnumPlugins/ObjImporter/Test/mesh-primitive-points.obj mesh-custom-attribute.gltf scene-custom-field.gltf triangle.ply) diff --git a/src/MagnumPlugins/AnyShaderConverter/Test/CMakeLists.txt b/src/MagnumPlugins/AnyShaderConverter/Test/CMakeLists.txt index 8d0425c5e..abd44cddf 100644 --- a/src/MagnumPlugins/AnyShaderConverter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/AnyShaderConverter/Test/CMakeLists.txt @@ -35,10 +35,6 @@ else() set(ANYSHADERCONVERTER_TEST_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) endif() -# CMake before 3.8 has broken $ expressions for iOS (see -# https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since Corrade -# doesn't support dynamic plugins on iOS, this sorta works around that. Should -# be revisited when updating Travis to newer Xcode (xcode7.3 has CMake 3.6). if(NOT MAGNUM_ANYSHADERCONVERTER_BUILD_STATIC) set(ANYSHADERCONVERTER_PLUGIN_FILENAME $) endif() diff --git a/src/MagnumPlugins/MagnumFont/Test/CMakeLists.txt b/src/MagnumPlugins/MagnumFont/Test/CMakeLists.txt index 6983d5415..4c6c3a904 100644 --- a/src/MagnumPlugins/MagnumFont/Test/CMakeLists.txt +++ b/src/MagnumPlugins/MagnumFont/Test/CMakeLists.txt @@ -33,10 +33,6 @@ else() set(MAGNUMFONT_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}) endif() -# CMake before 3.8 has broken $ expressions for iOS (see -# https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since Corrade -# doesn't support dynamic plugins on iOS, this sorta works around that. Should -# be revisited when updating Travis to newer Xcode (xcode7.3 has CMake 3.6). if(NOT MAGNUM_MAGNUMFONT_BUILD_STATIC) set(MAGNUMFONT_PLUGIN_FILENAME $) set(TGAIMPORTER_PLUGIN_FILENAME $) diff --git a/src/MagnumPlugins/MagnumFontConverter/Test/CMakeLists.txt b/src/MagnumPlugins/MagnumFontConverter/Test/CMakeLists.txt index 2b52cc976..cecaa048b 100644 --- a/src/MagnumPlugins/MagnumFontConverter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/MagnumFontConverter/Test/CMakeLists.txt @@ -35,10 +35,6 @@ else() set(MAGNUMFONT_TEST_DIR ${PROJECT_SOURCE_DIR}/src/MagnumPlugins/MagnumFont/Test) endif() -# CMake before 3.8 has broken $ expressions for iOS (see -# https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since Corrade -# doesn't support dynamic plugins on iOS, this sorta works around that. Should -# be revisited when updating Travis to newer Xcode (xcode7.3 has CMake 3.6). if(NOT MAGNUM_MAGNUMFONTCONVERTER_BUILD_STATIC) set(MAGNUMFONTCONVERTER_PLUGIN_FILENAME $) set(TGAIMAGECONVERTER_PLUGIN_FILENAME $) diff --git a/src/MagnumPlugins/ObjImporter/ObjImporter.cpp b/src/MagnumPlugins/ObjImporter/ObjImporter.cpp index 8c2a0e707..71b551690 100644 --- a/src/MagnumPlugins/ObjImporter/ObjImporter.cpp +++ b/src/MagnumPlugins/ObjImporter/ObjImporter.cpp @@ -38,7 +38,6 @@ #include #include "Magnum/Mesh.h" -#include "Magnum/MeshTools/CompressIndices.h" #include "Magnum/MeshTools/RemoveDuplicates.h" #include "Magnum/MeshTools/Duplicate.h" #include "Magnum/Math/Color.h" diff --git a/src/MagnumPlugins/ObjImporter/Test/CMakeLists.txt b/src/MagnumPlugins/ObjImporter/Test/CMakeLists.txt index 2bd91f662..880f94c1c 100644 --- a/src/MagnumPlugins/ObjImporter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/ObjImporter/Test/CMakeLists.txt @@ -33,10 +33,6 @@ else() set(OBJIMPORTER_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}) endif() -# CMake before 3.8 has broken $ expressions for iOS (see -# https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since Corrade -# doesn't support dynamic plugins on iOS, this sorta works around that. Should -# be revisited when updating Travis to newer Xcode (xcode7.3 has CMake 3.6). if(NOT MAGNUM_OBJIMPORTER_BUILD_STATIC) set(OBJIMPORTER_PLUGIN_FILENAME $) endif() @@ -50,23 +46,27 @@ file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$/configure.h corrade_add_test(ObjImporterTest ObjImporterTest.cpp LIBRARIES MagnumTrade FILES - emptyFile.obj - keywords.obj - lineMesh.obj - missingData.obj - mixedPrimitives.obj - moreMeshes.obj - namedMesh.obj - normals.obj - optionalCoordinates.obj - pointMesh.obj - textureCoordinatesNormals.obj - textureCoordinates.obj - triangleMesh.obj - unnamedFirstMesh.obj - wrongIndexCount.obj - wrongNumberCount.obj - wrongNumbers.obj) + empty.obj + invalid-incomplete-data.obj + invalid-inconsistent-index-tuple.obj + invalid-keyword.obj + invalid-mixed-primitives.obj + invalid-number-count.obj + invalid-numbers.obj + invalid-optional-coordinate.obj + mesh-ignored-keyword.obj + mesh-multiple.obj + mesh-named-first-unnamed.obj + mesh-named-first-unnamed-index-first.obj + mesh-named.obj + mesh-normals.obj + mesh-positions-optional-coordinate.obj + mesh-primitive-lines.obj + mesh-primitive-points.obj + mesh-primitive-triangles.obj + mesh-texture-coordinates.obj + mesh-texture-coordinates-normals.obj + mesh-texture-coordinates-optional-coordinate.obj) target_include_directories(ObjImporterTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/$) if(MAGNUM_OBJIMPORTER_BUILD_STATIC) target_link_libraries(ObjImporterTest PRIVATE ObjImporter) diff --git a/src/MagnumPlugins/ObjImporter/Test/ObjImporterTest.cpp b/src/MagnumPlugins/ObjImporter/Test/ObjImporterTest.cpp index e89db9777..925bfbdca 100644 --- a/src/MagnumPlugins/ObjImporter/Test/ObjImporterTest.cpp +++ b/src/MagnumPlugins/ObjImporter/Test/ObjImporterTest.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "Magnum/Mesh.h" @@ -43,55 +44,38 @@ namespace Magnum { namespace Trade { namespace Test { namespace { struct ObjImporterTest: TestSuite::Tester { explicit ObjImporterTest(); - void pointMesh(); - void lineMesh(); - void triangleMesh(); - void mixedPrimitives(); + void empty(); - void positionsOnly(); - void textureCoordinates(); - void normals(); - void textureCoordinatesNormals(); + void meshPrimitivePoints(); + void meshPrimitiveLines(); + void meshPrimitiveTriangles(); + + /* Positions alone are tested above */ + void meshPositionsOptionalCoordinate(); + void meshTextureCoordinates(); + void meshTextureCoordinatesOptionalCoordinate(); + void meshNormals(); + void meshTextureCoordinatesNormals(); + + void meshIgnoredKeyword(); + + void meshNamed(); + void meshNamedFirstUnnamed(); - void emptyFile(); - void unnamedMesh(); - void namedMesh(); void moreMeshes(); - void unnamedFirstMesh(); - - void wrongFloat(); - void wrongInteger(); - void unmergedIndexOutOfRange(); - void mergedIndexOutOfRange(); - void zeroIndex(); - - void explicitOptionalPositionCoordinate(); - void explicitOptionalTextureCoordinate(); - void unsupportedOptionalPositionCoordinate(); - void unsupportedOptionalTextureCoordinate(); - - void shortFloatData(); - void longFloatData(); - void longOptionalFloatData(); - - void longIndexData(); - void wrongPointIndexData(); - void wrongLineIndexData(); - void wrongTriangleIndexData(); - void polygonIndexData(); - - void missingPositionData(); - void missingNormalData(); - void missingTextureCoordinateData(); - void missingPositionIndices(); - void missingNormalIndices(); - void missingTextureCoordinateIndices(); - - void wrongTextureCoordinateIndexCount(); - void wrongNormalIndexCount(); - - void unsupportedKeyword(); - void unknownKeyword(); + + /* Technically, all invalid cases could be put into a single file, but + because the indexing is global, it would get increasingly hard to + maintain. So it's instead grouped into files by a common error scenario + with each case testing one file and just the invalid() case testing + separate files. */ + void invalid(); + void invalidMixedPrimitives(); + void invalidNumbers(); + void invalidNumberCount(); + void invalidInconsistentIndexTuple(); + void invalidIncompleteData(); + void invalidOptionalCoordinate(); void openTwice(); void importTwice(); @@ -100,58 +84,133 @@ struct ObjImporterTest: TestSuite::Tester { PluginManager::Manager _manager{"nonexistent"}; }; +const struct { + const char* name; + const char* filename; +} MeshNamedFirstUnnamedData[]{ + {"", "mesh-named-first-unnamed.obj"}, + {"index first", "mesh-named-first-unnamed-index-first.obj"}, +}; + +const struct { + const char* name; + const char* filename; + const char* message; +} InvalidData[]{ + {"unknown keyword", "invalid-keyword.obj", + "unknown keyword bleh"} +}; + +const struct { + const char* name; + const char* message; +} InvalidMixedPrimitivesData[]{ + {"points after some other", + "mixed primitive MeshPrimitive::Triangles and MeshPrimitive::Points"}, + {"lines after some other", + "mixed primitive MeshPrimitive::Points and MeshPrimitive::Lines"}, + {"triangles after some other", + "mixed primitive MeshPrimitive::Lines and MeshPrimitive::Triangles"}, +}; + +const struct { + const char* name; + const char* message; +} InvalidNumbersData[]{ + {"invalid float literal", "error while converting numeric data"}, + {"invalid integer literal", "error while converting numeric data"}, + {"position index out of range", "index 1 out of range for 1 vertices"}, + {"texture index out of range", "index 4 out of range for 3 vertices"}, + {"normal index out of range", "index 3 out of range for 2 vertices"}, + {"zero index", "index 0 out of range for 1 vertices"} +}; + +const struct { + const char* name; + const char* message; +} InvalidNumberCountData[]{ + {"two-component position", "invalid float array size"}, + {"five-component position with optional fourth component", "invalid float array size"}, + {"four-component normal", "invalid float array size"}, + {"four-component index tuple", "invalid index data"}, + {"point with two indices", "wrong index count for point"}, + {"line with one index", "wrong index count for line"}, + {"triangle with two indices", "wrong index count for triangle"}, + {"quad", "polygons are not supported"} +}; + +const struct { + const char* name; + const char* message; +} InvalidInconsistentIndexTupleData[]{ + {"missing normal reference", "some normal indices are missing"}, + {"missing texture reference", "some texture coordinate indices are missing"}, +}; + +const struct { + const char* name; + const char* message; +} InvalidIncompleteDataData[]{ + {"missing position data", "incomplete position data"}, + {"missing position indices", "incomplete position data"}, + {"missing normal data", "incomplete normal data"}, + {"missing normal indices", "incomplete normal data"}, + {"missing texture coordinate data", "incomplete texture coordinate data"}, + {"missing texture coordinate indices", "incomplete texture coordinate data"}, +}; + +const struct { + const char* name; + const char* message; +} InvalidOptionalCoordinateData[]{ + {"position with optional fourth component not one", "homogeneous coordinates are not supported"}, + {"texture with optional third component not zero", "3D texture coordinates are not supported"} +}; + ObjImporterTest::ObjImporterTest() { - addTests({&ObjImporterTest::pointMesh, - &ObjImporterTest::lineMesh, - &ObjImporterTest::triangleMesh, - &ObjImporterTest::mixedPrimitives, - - &ObjImporterTest::positionsOnly, - &ObjImporterTest::textureCoordinates, - &ObjImporterTest::normals, - &ObjImporterTest::textureCoordinatesNormals, - - &ObjImporterTest::emptyFile, - &ObjImporterTest::unnamedMesh, - &ObjImporterTest::namedMesh, - &ObjImporterTest::moreMeshes, - &ObjImporterTest::unnamedFirstMesh, - - &ObjImporterTest::wrongFloat, - &ObjImporterTest::wrongInteger, - &ObjImporterTest::unmergedIndexOutOfRange, - &ObjImporterTest::mergedIndexOutOfRange, - &ObjImporterTest::zeroIndex, - - &ObjImporterTest::explicitOptionalPositionCoordinate, - &ObjImporterTest::explicitOptionalTextureCoordinate, - &ObjImporterTest::unsupportedOptionalPositionCoordinate, - &ObjImporterTest::unsupportedOptionalTextureCoordinate, - - &ObjImporterTest::shortFloatData, - &ObjImporterTest::longFloatData, - &ObjImporterTest::longOptionalFloatData, - - &ObjImporterTest::longIndexData, - &ObjImporterTest::wrongPointIndexData, - &ObjImporterTest::wrongLineIndexData, - &ObjImporterTest::wrongTriangleIndexData, - &ObjImporterTest::polygonIndexData, - - &ObjImporterTest::missingPositionData, - &ObjImporterTest::missingNormalData, - &ObjImporterTest::missingTextureCoordinateData, - &ObjImporterTest::missingPositionIndices, - &ObjImporterTest::missingNormalIndices, - &ObjImporterTest::missingTextureCoordinateIndices, - - &ObjImporterTest::wrongTextureCoordinateIndexCount, - &ObjImporterTest::wrongNormalIndexCount, - - &ObjImporterTest::unsupportedKeyword, - &ObjImporterTest::unknownKeyword, - - &ObjImporterTest::openTwice, + addTests({&ObjImporterTest::empty, + + &ObjImporterTest::meshPrimitivePoints, + &ObjImporterTest::meshPrimitiveLines, + &ObjImporterTest::meshPrimitiveTriangles, + + &ObjImporterTest::meshPositionsOptionalCoordinate, + &ObjImporterTest::meshTextureCoordinates, + &ObjImporterTest::meshTextureCoordinatesOptionalCoordinate, + &ObjImporterTest::meshNormals, + &ObjImporterTest::meshTextureCoordinatesNormals, + + &ObjImporterTest::meshIgnoredKeyword, + + &ObjImporterTest::meshNamed}); + + addInstancedTests({&ObjImporterTest::meshNamedFirstUnnamed}, + Containers::arraySize(MeshNamedFirstUnnamedData)); + + addTests({&ObjImporterTest::moreMeshes}); + + addInstancedTests({&ObjImporterTest::invalid}, + Containers::arraySize(InvalidData)); + + addInstancedTests({&ObjImporterTest::invalidMixedPrimitives}, + Containers::arraySize(InvalidMixedPrimitivesData)); + + addInstancedTests({&ObjImporterTest::invalidNumbers}, + Containers::arraySize(InvalidNumbersData)); + + addInstancedTests({&ObjImporterTest::invalidNumberCount}, + Containers::arraySize(InvalidNumberCountData)); + + addInstancedTests({&ObjImporterTest::invalidInconsistentIndexTuple}, + Containers::arraySize(InvalidInconsistentIndexTupleData)); + + addInstancedTests({&ObjImporterTest::invalidIncompleteData}, + Containers::arraySize(InvalidIncompleteDataData)); + + addInstancedTests({&ObjImporterTest::invalidOptionalCoordinate}, + Containers::arraySize(InvalidOptionalCoordinateData)); + + addTests({&ObjImporterTest::openTwice, &ObjImporterTest::importTwice}); #ifdef OBJIMPORTER_PLUGIN_FILENAME @@ -159,9 +218,25 @@ ObjImporterTest::ObjImporterTest() { #endif } -void ObjImporterTest::pointMesh() { +void ObjImporterTest::empty() { + /* Duplicates what's in invalidIncompleteData(MissingPositionData), but + it's good to have such case explicit. It also tests for empty naming. */ + + Containers::Pointer importer = _manager.instantiate("ObjImporter"); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "empty.obj"))); + CORRADE_COMPARE(importer->meshCount(), 1); + CORRADE_COMPARE(importer->meshName(0), ""); + CORRADE_COMPARE(importer->meshForName(""), -1); + + std::ostringstream out; + Error redirectError{&out}; + CORRADE_VERIFY(!importer->mesh(0)); + CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): incomplete position data\n"); +} + +void ObjImporterTest::meshPrimitivePoints() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "pointMesh.obj"))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-primitive-points.obj"))); CORRADE_COMPARE(importer->meshCount(), 1); const Containers::Optional data = importer->mesh(0); @@ -183,9 +258,9 @@ void ObjImporterTest::pointMesh() { TestSuite::Compare::Container); } -void ObjImporterTest::lineMesh() { +void ObjImporterTest::meshPrimitiveLines() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "lineMesh.obj"))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-primitive-lines.obj"))); CORRADE_COMPARE(importer->meshCount(), 1); const Containers::Optional data = importer->mesh(0); @@ -205,9 +280,9 @@ void ObjImporterTest::lineMesh() { TestSuite::Compare::Container); } -void ObjImporterTest::triangleMesh() { +void ObjImporterTest::meshPrimitiveTriangles() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "triangleMesh.obj"))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-primitive-triangles.obj"))); CORRADE_COMPARE(importer->meshCount(), 1); const Containers::Optional data = importer->mesh(0); @@ -228,31 +303,23 @@ void ObjImporterTest::triangleMesh() { TestSuite::Compare::Container); } -void ObjImporterTest::mixedPrimitives() { +void ObjImporterTest::meshPositionsOptionalCoordinate() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mixedPrimitives.obj"))); - CORRADE_COMPARE(importer->meshCount(), 1); - - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(0)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): mixed primitive MeshPrimitive::Points and MeshPrimitive::Lines\n"); -} - -void ObjImporterTest::positionsOnly() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "triangleMesh.obj"))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-positions-optional-coordinate.obj"))); CORRADE_COMPARE(importer->meshCount(), 1); const Containers::Optional data = importer->mesh(0); CORRADE_VERIFY(data); CORRADE_COMPARE(data->attributeCount(), 1); - CORRADE_VERIFY(data->hasAttribute(MeshAttribute::Position)); + CORRADE_COMPARE_AS(data->attribute(MeshAttribute::Position), + Containers::arrayView({ + {1.5f, 2.0f, 3.0f} + }), TestSuite::Compare::Container); } -void ObjImporterTest::textureCoordinates() { +void ObjImporterTest::meshTextureCoordinates() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "textureCoordinates.obj"))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-texture-coordinates.obj"))); CORRADE_COMPARE(importer->meshCount(), 1); const Containers::Optional data = importer->mesh(0); @@ -280,9 +347,23 @@ void ObjImporterTest::textureCoordinates() { TestSuite::Compare::Container); } -void ObjImporterTest::normals() { +void ObjImporterTest::meshTextureCoordinatesOptionalCoordinate() { + Containers::Pointer importer = _manager.instantiate("ObjImporter"); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-texture-coordinates-optional-coordinate.obj"))); + CORRADE_COMPARE(importer->meshCount(), 1); + + const Containers::Optional data = importer->mesh(0); + CORRADE_VERIFY(data); + CORRADE_COMPARE(data->attributeCount(MeshAttribute::TextureCoordinates), 1); + CORRADE_COMPARE_AS(data->attribute(MeshAttribute::TextureCoordinates), + Containers::arrayView({ + {0.5f, 0.7f} + }), TestSuite::Compare::Container); +} + +void ObjImporterTest::meshNormals() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "normals.obj"))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-normals.obj"))); CORRADE_COMPARE(importer->meshCount(), 1); const Containers::Optional data = importer->mesh(0); @@ -310,9 +391,9 @@ void ObjImporterTest::normals() { TestSuite::Compare::Container); } -void ObjImporterTest::textureCoordinatesNormals() { +void ObjImporterTest::meshTextureCoordinatesNormals() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "textureCoordinatesNormals.obj"))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-texture-coordinates-normals.obj"))); CORRADE_COMPARE(importer->meshCount(), 1); const Containers::Optional data = importer->mesh(0); @@ -350,31 +431,53 @@ void ObjImporterTest::textureCoordinatesNormals() { TestSuite::Compare::Container); } -void ObjImporterTest::emptyFile() { +void ObjImporterTest::meshIgnoredKeyword() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "emptyFile.obj"))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-ignored-keyword.obj"))); CORRADE_COMPARE(importer->meshCount(), 1); -} -void ObjImporterTest::unnamedMesh() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "emptyFile.obj"))); - CORRADE_COMPARE(importer->meshCount(), 1); - CORRADE_COMPARE(importer->meshName(0), ""); - CORRADE_COMPARE(importer->meshForName(""), -1); + /* Everything should be parsed properly */ + const Containers::Optional data = importer->mesh(0); + CORRADE_VERIFY(data); + CORRADE_COMPARE(data->primitive(), MeshPrimitive::Points); + CORRADE_COMPARE(data->attributeCount(), 1); + CORRADE_COMPARE_AS(data->attribute(MeshAttribute::Position), + Containers::arrayView({ + {0.0f, 1.0f, 2.0f} + }), TestSuite::Compare::Container); + CORRADE_VERIFY(data->isIndexed()); + CORRADE_COMPARE(data->indexType(), MeshIndexType::UnsignedInt); + CORRADE_COMPARE_AS(data->indices(), + Containers::arrayView({0}), + TestSuite::Compare::Container); } -void ObjImporterTest::namedMesh() { +void ObjImporterTest::meshNamed() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "namedMesh.obj"))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-named.obj"))); CORRADE_COMPARE(importer->meshCount(), 1); CORRADE_COMPARE(importer->meshName(0), "MyMesh"); CORRADE_COMPARE(importer->meshForName("MyMesh"), 0); } +void ObjImporterTest::meshNamedFirstUnnamed() { + auto&& data = MeshNamedFirstUnnamedData[testCaseInstanceId()]; + setTestCaseDescription(data.name); + + Containers::Pointer importer = _manager.instantiate("ObjImporter"); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, data.filename))); + CORRADE_COMPARE(importer->meshCount(), 2); + + CORRADE_COMPARE(importer->meshName(0), ""); + CORRADE_COMPARE(importer->meshForName(""), -1); + + CORRADE_COMPARE(importer->meshName(1), "SecondMesh"); + CORRADE_COMPARE(importer->meshForName("SecondMesh"), 1); +} + void ObjImporterTest::moreMeshes() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "moreMeshes.obj"))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-multiple.obj"))); CORRADE_COMPARE(importer->meshCount(), 3); CORRADE_COMPARE(importer->meshName(0), "PointMesh"); @@ -452,370 +555,129 @@ void ObjImporterTest::moreMeshes() { TestSuite::Compare::Container); } -void ObjImporterTest::unnamedFirstMesh() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "unnamedFirstMesh.obj"))); - CORRADE_COMPARE(importer->meshCount(), 2); - - CORRADE_COMPARE(importer->meshName(0), ""); - CORRADE_COMPARE(importer->meshForName(""), -1); - - CORRADE_COMPARE(importer->meshName(1), "SecondMesh"); - CORRADE_COMPARE(importer->meshForName("SecondMesh"), 1); -} - -void ObjImporterTest::wrongFloat() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "wrongNumbers.obj"))); - const Int id = importer->meshForName("WrongFloat"); - CORRADE_VERIFY(id > -1); +void ObjImporterTest::invalid() { + auto&& data = InvalidData[testCaseInstanceId()]; + setTestCaseDescription(data.name); - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): error while converting numeric data\n"); -} - -void ObjImporterTest::wrongInteger() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "wrongNumbers.obj"))); - const Int id = importer->meshForName("WrongInteger"); - CORRADE_VERIFY(id > -1); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, data.filename))); - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): error while converting numeric data\n"); -} - -void ObjImporterTest::unmergedIndexOutOfRange() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "wrongNumbers.obj"))); - const Int id = importer->meshForName("PositionIndexOutOfRange"); - CORRADE_VERIFY(id > -1); - - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): index 1 out of range for 1 vertices\n"); -} - -void ObjImporterTest::mergedIndexOutOfRange() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "wrongNumbers.obj"))); - const Int id = importer->meshForName("TextureIndexOutOfRange"); - CORRADE_VERIFY(id > -1); - - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): index 2 out of range for 1 vertices\n"); -} - -void ObjImporterTest::zeroIndex() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "wrongNumbers.obj"))); - const Int id = importer->meshForName("ZeroIndex"); - CORRADE_VERIFY(id > -1); + CORRADE_COMPARE(importer->meshCount(), 1); std::ostringstream out; Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): index 0 out of range for 1 vertices\n"); + CORRADE_VERIFY(!importer->mesh(0)); + CORRADE_COMPARE(out.str(), Utility::formatString("Trade::ObjImporter::mesh(): {}\n", data.message)); } -void ObjImporterTest::explicitOptionalPositionCoordinate() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "optionalCoordinates.obj"))); - const Int id = importer->meshForName("SupportedPositionW"); - CORRADE_VERIFY(id > -1); - - const Containers::Optional data = importer->mesh(id); - CORRADE_VERIFY(data); - CORRADE_COMPARE(data->attributeCount(), 1); - CORRADE_COMPARE_AS(data->attribute(MeshAttribute::Position), - Containers::arrayView({ - {1.5f, 2.0f, 3.0f} - }), TestSuite::Compare::Container); -} +void ObjImporterTest::invalidMixedPrimitives() { + auto&& data = InvalidMixedPrimitivesData[testCaseInstanceId()]; + setTestCaseDescription(data.name); -void ObjImporterTest::explicitOptionalTextureCoordinate() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "optionalCoordinates.obj"))); - const Int id = importer->meshForName("SupportedTextureW"); - CORRADE_VERIFY(id > -1); - - const Containers::Optional data = importer->mesh(id); - CORRADE_VERIFY(data); - CORRADE_COMPARE(data->attributeCount(MeshAttribute::TextureCoordinates), 1); - CORRADE_COMPARE_AS(data->attribute(MeshAttribute::TextureCoordinates), - Containers::arrayView({ - {0.5f, 0.7f} - }), TestSuite::Compare::Container); -} + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "invalid-mixed-primitives.obj"))); -void ObjImporterTest::unsupportedOptionalPositionCoordinate() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "optionalCoordinates.obj"))); - const Int id = importer->meshForName("UnsupportedPositionW"); - CORRADE_VERIFY(id > -1); + /* Ensure we didn't forget to test any case */ + CORRADE_COMPARE(importer->meshCount(), Containers::arraySize(InvalidMixedPrimitivesData)); std::ostringstream out; Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): homogeneous coordinates are not supported\n"); + CORRADE_VERIFY(!importer->mesh(data.name)); + CORRADE_COMPARE(out.str(), Utility::formatString("Trade::ObjImporter::mesh(): {}\n", data.message)); } -void ObjImporterTest::unsupportedOptionalTextureCoordinate() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "optionalCoordinates.obj"))); - const Int id = importer->meshForName("UnsupportedTextureW"); - CORRADE_VERIFY(id > -1); - - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): 3D texture coordinates are not supported\n"); -} +void ObjImporterTest::invalidNumbers() { + auto&& data = InvalidNumbersData[testCaseInstanceId()]; + setTestCaseDescription(data.name); -void ObjImporterTest::shortFloatData() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "wrongNumberCount.obj"))); - const Int id = importer->meshForName("ShortFloat"); - CORRADE_VERIFY(id > -1); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "invalid-numbers.obj"))); - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): invalid float array size\n"); -} - -void ObjImporterTest::longFloatData() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "wrongNumberCount.obj"))); - const Int id = importer->meshForName("LongFloat"); - CORRADE_VERIFY(id > -1); + /* Ensure we didn't forget to test any case */ + CORRADE_COMPARE(importer->meshCount(), Containers::arraySize(InvalidNumbersData)); std::ostringstream out; Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): invalid float array size\n"); + CORRADE_VERIFY(!importer->mesh(data.name)); + CORRADE_COMPARE(out.str(), Utility::formatString("Trade::ObjImporter::mesh(): {}\n", data.message)); } -void ObjImporterTest::longOptionalFloatData() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "wrongNumberCount.obj"))); - const Int id = importer->meshForName("LongOptionalFloat"); - CORRADE_VERIFY(id > -1); - - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): invalid float array size\n"); -} +void ObjImporterTest::invalidNumberCount() { + auto&& data = InvalidNumberCountData[testCaseInstanceId()]; + setTestCaseDescription(data.name); -void ObjImporterTest::longIndexData() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "wrongNumberCount.obj"))); - const Int id = importer->meshForName("InvalidIndices"); - CORRADE_VERIFY(id > -1); - - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): invalid index data\n"); -} + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "invalid-number-count.obj"))); -void ObjImporterTest::wrongPointIndexData() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "wrongNumberCount.obj"))); - const Int id = importer->meshForName("WrongPointIndices"); - CORRADE_VERIFY(id > -1); + /* Ensure we didn't forget to test any case */ + CORRADE_COMPARE(importer->meshCount(), Containers::arraySize(InvalidNumberCountData)); std::ostringstream out; Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): wrong index count for point\n"); + CORRADE_VERIFY(!importer->mesh(data.name)); + CORRADE_COMPARE(out.str(), Utility::formatString("Trade::ObjImporter::mesh(): {}\n", data.message)); } -void ObjImporterTest::wrongLineIndexData() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "wrongNumberCount.obj"))); - const Int id = importer->meshForName("WrongLineIndices"); - CORRADE_VERIFY(id > -1); +void ObjImporterTest::invalidInconsistentIndexTuple() { + auto&& data = InvalidInconsistentIndexTupleData[testCaseInstanceId()]; + setTestCaseDescription(data.name); - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): wrong index count for line\n"); -} - -void ObjImporterTest::wrongTriangleIndexData() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "wrongNumberCount.obj"))); - const Int id = importer->meshForName("WrongTriangleIndices"); - CORRADE_VERIFY(id > -1); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "invalid-inconsistent-index-tuple.obj"))); - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): wrong index count for triangle\n"); -} - -void ObjImporterTest::polygonIndexData() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "wrongNumberCount.obj"))); - const Int id = importer->meshForName("PolygonIndices"); - CORRADE_VERIFY(id > -1); + /* Ensure we didn't forget to test any case */ + CORRADE_COMPARE(importer->meshCount(), Containers::arraySize(InvalidInconsistentIndexTupleData)); std::ostringstream out; Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): polygons are not supported\n"); + CORRADE_VERIFY(!importer->mesh(data.name)); + CORRADE_COMPARE(out.str(), Utility::formatString("Trade::ObjImporter::mesh(): {}\n", data.message)); } -void ObjImporterTest::missingPositionData() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "missingData.obj"))); - const Int id = importer->meshForName("MissingPositionData"); - CORRADE_VERIFY(id > -1); - - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): incomplete position data\n"); -} - -void ObjImporterTest::missingPositionIndices() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "missingData.obj"))); - const Int id = importer->meshForName("MissingPositionIndices"); - CORRADE_VERIFY(id > -1); - - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): incomplete position data\n"); -} +void ObjImporterTest::invalidIncompleteData() { + auto&& data = InvalidIncompleteDataData[testCaseInstanceId()]; + setTestCaseDescription(data.name); -void ObjImporterTest::missingNormalData() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "missingData.obj"))); - const Int id = importer->meshForName("MissingNormalData"); - CORRADE_VERIFY(id > -1); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "invalid-incomplete-data.obj"))); - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): incomplete normal data\n"); -} - -void ObjImporterTest::missingNormalIndices() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "missingData.obj"))); - const Int id = importer->meshForName("MissingNormalIndices"); - CORRADE_VERIFY(id > -1); + /* Ensure we didn't forget to test any case */ + CORRADE_COMPARE(importer->meshCount(), Containers::arraySize(InvalidIncompleteDataData)); std::ostringstream out; Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): incomplete normal data\n"); + CORRADE_VERIFY(!importer->mesh(data.name)); + CORRADE_COMPARE(out.str(), Utility::formatString("Trade::ObjImporter::mesh(): {}\n", data.message)); } -void ObjImporterTest::missingTextureCoordinateData() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "missingData.obj"))); - const Int id = importer->meshForName("MissingTextureData"); - CORRADE_VERIFY(id > -1); +void ObjImporterTest::invalidOptionalCoordinate() { + auto&& data = InvalidOptionalCoordinateData[testCaseInstanceId()]; + setTestCaseDescription(data.name); - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): incomplete texture coordinate data\n"); -} - -void ObjImporterTest::missingTextureCoordinateIndices() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "missingData.obj"))); - const Int id = importer->meshForName("MissingTextureIndices"); - CORRADE_VERIFY(id > -1); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "invalid-optional-coordinate.obj"))); - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): incomplete texture coordinate data\n"); -} - -void ObjImporterTest::wrongNormalIndexCount() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "wrongIndexCount.obj"))); - const Int id = importer->meshForName("ShortNormalIndices"); - CORRADE_VERIFY(id > -1); - - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): some normal indices are missing\n"); -} - -void ObjImporterTest::wrongTextureCoordinateIndexCount() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "wrongIndexCount.obj"))); - const Int id = importer->meshForName("ShortTextureIndices"); - CORRADE_VERIFY(id > -1); - - std::ostringstream out; - Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): some texture coordinate indices are missing\n"); -} - -void ObjImporterTest::unsupportedKeyword() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "keywords.obj"))); - const Int id = importer->meshForName("UnsupportedKeyword"); - CORRADE_VERIFY(id > -1); - - /* Everything should be parsed properly */ - const Containers::Optional data = importer->mesh(id); - CORRADE_VERIFY(data); - CORRADE_COMPARE(data->primitive(), MeshPrimitive::Points); - CORRADE_COMPARE(data->attributeCount(), 1); - CORRADE_COMPARE_AS(data->attribute(MeshAttribute::Position), - Containers::arrayView({ - {0.0f, 1.0f, 2.0f} - }), TestSuite::Compare::Container); - CORRADE_VERIFY(data->isIndexed()); - CORRADE_COMPARE(data->indexType(), MeshIndexType::UnsignedInt); - CORRADE_COMPARE_AS(data->indices(), - Containers::arrayView({0}), - TestSuite::Compare::Container); -} - -void ObjImporterTest::unknownKeyword() { - Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "keywords.obj"))); - const Int id = importer->meshForName("UnknownKeyword"); - CORRADE_VERIFY(id > -1); + /* Ensure we didn't forget to test any case */ + CORRADE_COMPARE(importer->meshCount(), Containers::arraySize(InvalidOptionalCoordinateData)); std::ostringstream out; Error redirectError{&out}; - CORRADE_VERIFY(!importer->mesh(id)); - CORRADE_COMPARE(out.str(), "Trade::ObjImporter::mesh(): unknown keyword bleh\n"); + CORRADE_VERIFY(!importer->mesh(data.name)); + CORRADE_COMPARE(out.str(), Utility::formatString("Trade::ObjImporter::mesh(): {}\n", data.message)); } void ObjImporterTest::openTwice() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "pointMesh.obj"))); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "pointMesh.obj"))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-primitive-points.obj"))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-primitive-points.obj"))); /* Shouldn't crash, leak or anything */ } void ObjImporterTest::importTwice() { Containers::Pointer importer = _manager.instantiate("ObjImporter"); - CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "pointMesh.obj"))); + CORRADE_VERIFY(importer->openFile(Utility::Path::join(OBJIMPORTER_TEST_DIR, "mesh-primitive-points.obj"))); /* Verify that everything is working the same way on second use */ { diff --git a/src/MagnumPlugins/ObjImporter/Test/emptyFile.obj b/src/MagnumPlugins/ObjImporter/Test/empty.obj similarity index 100% rename from src/MagnumPlugins/ObjImporter/Test/emptyFile.obj rename to src/MagnumPlugins/ObjImporter/Test/empty.obj diff --git a/src/MagnumPlugins/ObjImporter/Test/invalid-incomplete-data.obj b/src/MagnumPlugins/ObjImporter/Test/invalid-incomplete-data.obj new file mode 100644 index 000000000..3133e1127 --- /dev/null +++ b/src/MagnumPlugins/ObjImporter/Test/invalid-incomplete-data.obj @@ -0,0 +1,23 @@ +o missing position data +p 1 + +o missing position indices +v 1 2 3 + +o missing normal data +v 1 2 3 +p 3//3 + +o missing normal indices +v 1 2 3 +vn 1 2 3 +p 4 + +o missing texture coordinate data +v 1 2 3 +p 5/1 + +o missing texture coordinate indices +v 1 2 3 +vt 1 2 +p 6 diff --git a/src/MagnumPlugins/ObjImporter/Test/wrongIndexCount.obj b/src/MagnumPlugins/ObjImporter/Test/invalid-inconsistent-index-tuple.obj similarity index 54% rename from src/MagnumPlugins/ObjImporter/Test/wrongIndexCount.obj rename to src/MagnumPlugins/ObjImporter/Test/invalid-inconsistent-index-tuple.obj index 0a98d1573..f71889bab 100644 --- a/src/MagnumPlugins/ObjImporter/Test/wrongIndexCount.obj +++ b/src/MagnumPlugins/ObjImporter/Test/invalid-inconsistent-index-tuple.obj @@ -1,11 +1,11 @@ -o ShortNormalIndices +o missing normal reference v 1 2 3 vn 1 2 3 p 1//1 p 1 p 1//1 -o ShortTextureIndices +o missing texture reference v 1 2 3 vt 1 2 p 2/2 diff --git a/src/MagnumPlugins/ObjImporter/Test/invalid-keyword.obj b/src/MagnumPlugins/ObjImporter/Test/invalid-keyword.obj new file mode 100644 index 000000000..3149e4c0a --- /dev/null +++ b/src/MagnumPlugins/ObjImporter/Test/invalid-keyword.obj @@ -0,0 +1 @@ +bleh diff --git a/src/MagnumPlugins/ObjImporter/Test/invalid-mixed-primitives.obj b/src/MagnumPlugins/ObjImporter/Test/invalid-mixed-primitives.obj new file mode 100644 index 000000000..825fd24c6 --- /dev/null +++ b/src/MagnumPlugins/ObjImporter/Test/invalid-mixed-primitives.obj @@ -0,0 +1,14 @@ +o points after some other +v 2 3 5.0 +f 1 1 1 +p 1 + +o lines after some other +v 2 3 5.0 +p 2 +l 2 2 2 + +o triangles after some other +v 2 3 5.0 +l 3 3 +f 3 3 3 diff --git a/src/MagnumPlugins/ObjImporter/Test/invalid-number-count.obj b/src/MagnumPlugins/ObjImporter/Test/invalid-number-count.obj new file mode 100644 index 000000000..088b54fed --- /dev/null +++ b/src/MagnumPlugins/ObjImporter/Test/invalid-number-count.obj @@ -0,0 +1,29 @@ +o two-component position +v 0.5 1.0 + +o five-component position with optional fourth component +v 0.5 1 2 0.0 3.5 + +o four-component normal +v 0.5 1 2 +vn 0.5 1.0 2.3 7.4 + +o four-component index tuple +v 1 2 3 +p 4/1/1/1 + +o point with two indices +v 1 2 3 +p 5 5 + +o line with one index +v 1 2 3 +l 6 + +o triangle with two indices +v 1 2 3 +f 7 7 + +o quad +v 1 2 3 +f 8 8 8 8 diff --git a/src/MagnumPlugins/ObjImporter/Test/invalid-numbers.obj b/src/MagnumPlugins/ObjImporter/Test/invalid-numbers.obj new file mode 100644 index 000000000..88eb62e51 --- /dev/null +++ b/src/MagnumPlugins/ObjImporter/Test/invalid-numbers.obj @@ -0,0 +1,31 @@ +o invalid float literal +v 1 bleh 2 +p 1 + +o invalid integer literal +v 1 0 2 +p bleh + +o position index out of range +v 1 0 2 +# Should be 3 +p 1 + +o texture index out of range +v 1 0 2 +vt 0 1 +vt 0 1 +vt 0 1 +# Should be 4/3 +p 4/4 + +o normal index out of range +v 1 0 2 +vn 0 0 1 +vn 0 0 1 +# Should be 5/2 +p 5//3 + +o zero index +v 1 0 2 +p 0 diff --git a/src/MagnumPlugins/ObjImporter/Test/invalid-optional-coordinate.obj b/src/MagnumPlugins/ObjImporter/Test/invalid-optional-coordinate.obj new file mode 100644 index 000000000..0ffafa3e7 --- /dev/null +++ b/src/MagnumPlugins/ObjImporter/Test/invalid-optional-coordinate.obj @@ -0,0 +1,8 @@ +o position with optional fourth component not one +v 1.5 2 3 0.8 +p 1 + +o texture with optional third component not zero +v 1.5 2 3 +vt 0.5 0.7 0.5 +p 2/1 diff --git a/src/MagnumPlugins/ObjImporter/Test/keywords.obj b/src/MagnumPlugins/ObjImporter/Test/keywords.obj deleted file mode 100644 index c93dce27f..000000000 --- a/src/MagnumPlugins/ObjImporter/Test/keywords.obj +++ /dev/null @@ -1,7 +0,0 @@ -o UnsupportedKeyword -g VertexGroup -v 0 1 2 -p 1 - -o UnknownKeyword -bleh diff --git a/src/MagnumPlugins/ObjImporter/Test/mesh-ignored-keyword.obj b/src/MagnumPlugins/ObjImporter/Test/mesh-ignored-keyword.obj new file mode 100644 index 000000000..b0ccfc957 --- /dev/null +++ b/src/MagnumPlugins/ObjImporter/Test/mesh-ignored-keyword.obj @@ -0,0 +1,3 @@ +g VertexGroup +v 0 1 2 +p 1 diff --git a/src/MagnumPlugins/ObjImporter/Test/moreMeshes.obj b/src/MagnumPlugins/ObjImporter/Test/mesh-multiple.obj similarity index 100% rename from src/MagnumPlugins/ObjImporter/Test/moreMeshes.obj rename to src/MagnumPlugins/ObjImporter/Test/mesh-multiple.obj diff --git a/src/MagnumPlugins/ObjImporter/Test/mesh-named-first-unnamed-index-first.obj b/src/MagnumPlugins/ObjImporter/Test/mesh-named-first-unnamed-index-first.obj new file mode 100644 index 000000000..89a8ea72d --- /dev/null +++ b/src/MagnumPlugins/ObjImporter/Test/mesh-named-first-unnamed-index-first.obj @@ -0,0 +1,3 @@ +p 1 +v 1 2 3 +o SecondMesh diff --git a/src/MagnumPlugins/ObjImporter/Test/unnamedFirstMesh.obj b/src/MagnumPlugins/ObjImporter/Test/mesh-named-first-unnamed.obj similarity index 100% rename from src/MagnumPlugins/ObjImporter/Test/unnamedFirstMesh.obj rename to src/MagnumPlugins/ObjImporter/Test/mesh-named-first-unnamed.obj diff --git a/src/MagnumPlugins/ObjImporter/Test/namedMesh.obj b/src/MagnumPlugins/ObjImporter/Test/mesh-named.obj similarity index 100% rename from src/MagnumPlugins/ObjImporter/Test/namedMesh.obj rename to src/MagnumPlugins/ObjImporter/Test/mesh-named.obj diff --git a/src/MagnumPlugins/ObjImporter/Test/normals.obj b/src/MagnumPlugins/ObjImporter/Test/mesh-normals.obj similarity index 100% rename from src/MagnumPlugins/ObjImporter/Test/normals.obj rename to src/MagnumPlugins/ObjImporter/Test/mesh-normals.obj diff --git a/src/MagnumPlugins/ObjImporter/Test/mesh-positions-optional-coordinate.obj b/src/MagnumPlugins/ObjImporter/Test/mesh-positions-optional-coordinate.obj new file mode 100644 index 000000000..b6c111625 --- /dev/null +++ b/src/MagnumPlugins/ObjImporter/Test/mesh-positions-optional-coordinate.obj @@ -0,0 +1,2 @@ +v 1.5 2 3 1.0 +p 1 diff --git a/src/MagnumPlugins/ObjImporter/Test/lineMesh.obj b/src/MagnumPlugins/ObjImporter/Test/mesh-primitive-lines.obj similarity index 100% rename from src/MagnumPlugins/ObjImporter/Test/lineMesh.obj rename to src/MagnumPlugins/ObjImporter/Test/mesh-primitive-lines.obj diff --git a/src/MagnumPlugins/ObjImporter/Test/pointMesh.obj b/src/MagnumPlugins/ObjImporter/Test/mesh-primitive-points.obj similarity index 100% rename from src/MagnumPlugins/ObjImporter/Test/pointMesh.obj rename to src/MagnumPlugins/ObjImporter/Test/mesh-primitive-points.obj diff --git a/src/MagnumPlugins/ObjImporter/Test/triangleMesh.obj b/src/MagnumPlugins/ObjImporter/Test/mesh-primitive-triangles.obj similarity index 100% rename from src/MagnumPlugins/ObjImporter/Test/triangleMesh.obj rename to src/MagnumPlugins/ObjImporter/Test/mesh-primitive-triangles.obj diff --git a/src/MagnumPlugins/ObjImporter/Test/textureCoordinatesNormals.obj b/src/MagnumPlugins/ObjImporter/Test/mesh-texture-coordinates-normals.obj similarity index 100% rename from src/MagnumPlugins/ObjImporter/Test/textureCoordinatesNormals.obj rename to src/MagnumPlugins/ObjImporter/Test/mesh-texture-coordinates-normals.obj diff --git a/src/MagnumPlugins/ObjImporter/Test/mesh-texture-coordinates-optional-coordinate.obj b/src/MagnumPlugins/ObjImporter/Test/mesh-texture-coordinates-optional-coordinate.obj new file mode 100644 index 000000000..82933e5dc --- /dev/null +++ b/src/MagnumPlugins/ObjImporter/Test/mesh-texture-coordinates-optional-coordinate.obj @@ -0,0 +1,3 @@ +v 1.5 2 3 +vt 0.5 0.7 0.0 +p 1/1 diff --git a/src/MagnumPlugins/ObjImporter/Test/textureCoordinates.obj b/src/MagnumPlugins/ObjImporter/Test/mesh-texture-coordinates.obj similarity index 100% rename from src/MagnumPlugins/ObjImporter/Test/textureCoordinates.obj rename to src/MagnumPlugins/ObjImporter/Test/mesh-texture-coordinates.obj diff --git a/src/MagnumPlugins/ObjImporter/Test/missingData.obj b/src/MagnumPlugins/ObjImporter/Test/missingData.obj deleted file mode 100644 index 554d520b9..000000000 --- a/src/MagnumPlugins/ObjImporter/Test/missingData.obj +++ /dev/null @@ -1,23 +0,0 @@ -o MissingPositionData -p 1 - -o MissingPositionIndices -v 1 2 3 - -o MissingNormalData -v 1 2 3 -p 3//3 - -o MissingNormalIndices -v 1 2 3 -vn 1 2 3 -p 4 - -o MissingTextureData -v 1 2 3 -p 5/1 - -o MissingTextureIndices -v 1 2 3 -vt 1 2 -p 6 diff --git a/src/MagnumPlugins/ObjImporter/Test/mixedPrimitives.obj b/src/MagnumPlugins/ObjImporter/Test/mixedPrimitives.obj deleted file mode 100644 index e4ab55130..000000000 --- a/src/MagnumPlugins/ObjImporter/Test/mixedPrimitives.obj +++ /dev/null @@ -1,13 +0,0 @@ -# Positions -v 0.5 2 3 -v 0 1.5 1 -v 2 3 5.0 - -# Points -p 1 -p 3 -p 2 - -# Lines -l 1 2 -l 2 3 diff --git a/src/MagnumPlugins/ObjImporter/Test/optionalCoordinates.obj b/src/MagnumPlugins/ObjImporter/Test/optionalCoordinates.obj deleted file mode 100644 index 7e9132465..000000000 --- a/src/MagnumPlugins/ObjImporter/Test/optionalCoordinates.obj +++ /dev/null @@ -1,17 +0,0 @@ -o SupportedPositionW -v 1.5 2 3 1.0 -p 1 - -o SupportedTextureW -v 1.5 2 3 -vt 0.5 0.7 0.0 -p 2/1 - -o UnsupportedPositionW -v 1.5 2 3 0.8 -p 3 - -o UnsupportedTextureW -v 1.5 2 3 -vt 0.5 0.7 0.5 -p 4/2 diff --git a/src/MagnumPlugins/ObjImporter/Test/wrongNumberCount.obj b/src/MagnumPlugins/ObjImporter/Test/wrongNumberCount.obj deleted file mode 100644 index 4bfab647f..000000000 --- a/src/MagnumPlugins/ObjImporter/Test/wrongNumberCount.obj +++ /dev/null @@ -1,29 +0,0 @@ -o ShortFloat -v 0.5 1.0 - -o LongFloat -v 0.5 1 2 -vn 0.5 1.0 2.3 7.4 - -o LongOptionalFloat -v 0.5 1 2 0.0 3.5 - -o InvalidIndices -v 1 2 3 -p 4/1/1/1 - -o WrongPointIndices -v 1 2 3 -p 5 5 - -o WrongLineIndices -v 1 2 3 -l 6 - -o WrongTriangleIndices -v 1 2 3 -f 7 7 - -o PolygonIndices -v 1 2 3 -f 8 8 8 8 diff --git a/src/MagnumPlugins/ObjImporter/Test/wrongNumbers.obj b/src/MagnumPlugins/ObjImporter/Test/wrongNumbers.obj deleted file mode 100644 index ce6589a05..000000000 --- a/src/MagnumPlugins/ObjImporter/Test/wrongNumbers.obj +++ /dev/null @@ -1,22 +0,0 @@ -o WrongFloat -v 1 bleh 2 -p 1 - -o WrongInteger -v 1 0 2 -p bleh - -o PositionIndexOutOfRange -v 1 0 2 -# Should be 3 -p 1 - -o TextureIndexOutOfRange -v 1 0 2 -vt 0 1 -# Should be 4/1 -p 4/2 - -o ZeroIndex -v 1 0 2 -p 0 diff --git a/src/MagnumPlugins/TgaImageConverter/Test/CMakeLists.txt b/src/MagnumPlugins/TgaImageConverter/Test/CMakeLists.txt index da4d4acf2..40e5c707e 100644 --- a/src/MagnumPlugins/TgaImageConverter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/TgaImageConverter/Test/CMakeLists.txt @@ -27,10 +27,6 @@ # property that would have to be set on each target separately. set(CMAKE_FOLDER "MagnumPlugins/TgaImageConverter/Test") -# CMake before 3.8 has broken $ expressions for iOS (see -# https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since Corrade -# doesn't support dynamic plugins on iOS, this sorta works around that. Should -# be revisited when updating Travis to newer Xcode (xcode7.3 has CMake 3.6). if(NOT MAGNUM_TGAIMAGECONVERTER_BUILD_STATIC) set(TGAIMAGECONVERTER_PLUGIN_FILENAME $) if(MAGNUM_WITH_TGAIMPORTER) diff --git a/src/MagnumPlugins/TgaImporter/Test/CMakeLists.txt b/src/MagnumPlugins/TgaImporter/Test/CMakeLists.txt index f28f6f425..2dc529fd3 100644 --- a/src/MagnumPlugins/TgaImporter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/TgaImporter/Test/CMakeLists.txt @@ -33,10 +33,6 @@ else() set(TGAIMPORTER_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}) endif() -# CMake before 3.8 has broken $ expressions for iOS (see -# https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since Corrade -# doesn't support dynamic plugins on iOS, this sorta works around that. Should -# be revisited when updating Travis to newer Xcode (xcode7.3 has CMake 3.6). if(NOT MAGNUM_TGAIMPORTER_BUILD_STATIC) set(TGAIMPORTER_PLUGIN_FILENAME $) endif() diff --git a/src/MagnumPlugins/WavAudioImporter/Test/CMakeLists.txt b/src/MagnumPlugins/WavAudioImporter/Test/CMakeLists.txt index 0204a028e..f1e46c78c 100644 --- a/src/MagnumPlugins/WavAudioImporter/Test/CMakeLists.txt +++ b/src/MagnumPlugins/WavAudioImporter/Test/CMakeLists.txt @@ -33,10 +33,6 @@ else() set(WAVAUDIOIMPORTER_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}) endif() -# CMake before 3.8 has broken $ expressions for iOS (see -# https://gitlab.kitware.com/cmake/cmake/merge_requests/404) and since Corrade -# doesn't support dynamic plugins on iOS, this sorta works around that. Should -# be revisited when updating Travis to newer Xcode (xcode7.3 has CMake 3.6). if(NOT MAGNUM_WAVAUDIOIMPORTER_BUILD_STATIC) set(WAVAUDIOIMPORTER_PLUGIN_FILENAME $) endif() diff --git a/toolchains b/toolchains index 8847ed069..65568a98f 160000 --- a/toolchains +++ b/toolchains @@ -1 +1 @@ -Subproject commit 8847ed06932798f884d8edc7f58d8c0ccf5f1620 +Subproject commit 65568a98fa48de0369f35e9788779fdfbe14cacc