Browse Source

Adapt to Corrade changes.

pull/556/head
Vladimír Vondruš 4 years ago
parent
commit
b0bfcbe00e
  1. 1
      doc/snippets/MagnumShaderTools.cpp
  2. 4
      src/Magnum/Animation/Player.hpp
  3. 8
      src/Magnum/Animation/Test/TrackTest.cpp
  4. 8
      src/Magnum/Animation/Test/TrackViewTest.cpp
  5. 4
      src/Magnum/Animation/Track.h
  6. 5
      src/Magnum/DebugTools/TextureImage.cpp
  7. 2
      src/Magnum/GL/AbstractShaderProgram.cpp
  8. 4
      src/Magnum/GL/Context.cpp
  9. 8
      src/Magnum/GL/Mesh.cpp
  10. 33
      src/Magnum/GL/Test/AbstractShaderProgramGLTest.cpp
  11. 2
      src/Magnum/GL/Test/BufferGLTest.cpp
  12. 2
      src/Magnum/GL/Test/BufferTextureGLTest.cpp
  13. 18
      src/Magnum/GL/Test/ContextTest.cpp
  14. 50
      src/Magnum/GL/Test/CubeMapTextureArrayGLTest.cpp
  15. 70
      src/Magnum/GL/Test/CubeMapTextureGLTest.cpp
  16. 2
      src/Magnum/GL/Test/FramebufferGLTest.cpp
  17. 2
      src/Magnum/GL/Test/MeshGLTest.cpp
  18. 4
      src/Magnum/GL/Test/MultisampleTextureGLTest.cpp
  19. 2
      src/Magnum/GL/Test/PipelineStatisticsQueryGLTest.cpp
  20. 2
      src/Magnum/GL/Test/PrimitiveQueryGLTest.cpp
  21. 20
      src/Magnum/GL/Test/RectangleTextureGLTest.cpp
  22. 2
      src/Magnum/GL/Test/RenderbufferGLTest.cpp
  23. 2
      src/Magnum/GL/Test/SampleQueryGLTest.cpp
  24. 2
      src/Magnum/GL/Test/ShaderGLTest.cpp
  25. 58
      src/Magnum/GL/Test/TextureArrayGLTest.cpp
  26. 96
      src/Magnum/GL/Test/TextureGLTest.cpp
  27. 2
      src/Magnum/GL/Test/TimeQueryGLTest.cpp
  28. 2
      src/Magnum/GL/Test/TransformFeedbackGLTest.cpp
  29. 2
      src/Magnum/Implementation/ImageProperties.h
  30. 10
      src/Magnum/Math/FunctionsBatch.h
  31. 2
      src/Magnum/MeshTools/Combine.cpp
  32. 8
      src/Magnum/MeshTools/Concatenate.cpp
  33. 4
      src/Magnum/MeshTools/Concatenate.h
  34. 2
      src/Magnum/MeshTools/GenerateNormals.cpp
  35. 4
      src/Magnum/MeshTools/Interleave.cpp
  36. 4
      src/Magnum/MeshTools/RemoveDuplicates.cpp
  37. 8
      src/Magnum/MeshTools/Test/CompileGLTest.cpp
  38. 2
      src/Magnum/MeshTools/Test/FullScreenTriangleGLTest.cpp
  39. 14
      src/Magnum/MeshTools/Test/InterleaveTest.cpp
  40. 2
      src/Magnum/MeshTools/Test/ReferenceTest.cpp
  41. 2
      src/Magnum/MeshTools/Tipsify.cpp
  42. 2
      src/Magnum/Platform/EmscriptenApplication.cpp
  43. 2
      src/Magnum/Primitives/Implementation/WireframeSpheroid.cpp
  44. 8
      src/Magnum/SceneTools/Implementation/convertToSingleFunctionObjects.h
  45. 32
      src/Magnum/SceneTools/Test/FlattenMeshHierarchyTest.cpp
  46. 8
      src/Magnum/ShaderTools/AbstractConverter.cpp
  47. 10
      src/Magnum/ShaderTools/Implementation/spirv.h
  48. 4
      src/Magnum/ShaderTools/Test/SpirvTest.cpp
  49. 8
      src/Magnum/Shaders/DistanceFieldVectorGL.cpp
  50. 8
      src/Magnum/Shaders/FlatGL.cpp
  51. 4
      src/Magnum/Shaders/Implementation/CreateCompatibilityShader.h
  52. 20
      src/Magnum/Shaders/MeshVisualizerGL.cpp
  53. 8
      src/Magnum/Shaders/PhongGL.cpp
  54. 8
      src/Magnum/Shaders/VectorGL.cpp
  55. 8
      src/Magnum/Shaders/VertexColorGL.cpp
  56. 6
      src/Magnum/TextureTools/DistanceField.cpp
  57. 4
      src/Magnum/Trade/AbstractImageConverter.cpp
  58. 10
      src/Magnum/Trade/AbstractImporter.cpp
  59. 2
      src/Magnum/Trade/AnimationData.cpp
  60. 2
      src/Magnum/Trade/MaterialData.cpp
  61. 2
      src/Magnum/Trade/MaterialData.h
  62. 14
      src/Magnum/Trade/MeshData.cpp
  63. 6
      src/Magnum/Trade/SceneData.cpp
  64. 10
      src/Magnum/Trade/Test/MaterialDataTest.cpp
  65. 6
      src/Magnum/Trade/Test/MeshDataTest.cpp
  66. 12
      src/Magnum/Trade/Test/SceneDataTest.cpp
  67. 6
      src/Magnum/Trade/imageconverter.cpp
  68. 2
      src/Magnum/Vk/DescriptorPool.cpp
  69. 8
      src/Magnum/Vk/Device.cpp
  70. 2
      src/Magnum/Vk/DeviceProperties.cpp
  71. 6
      src/Magnum/Vk/Instance.cpp
  72. 6
      src/Magnum/Vk/MeshLayout.cpp
  73. 6
      src/Magnum/Vk/RenderPass.cpp
  74. 2
      src/Magnum/Vk/ShaderSet.cpp
  75. 40
      src/Magnum/Vk/Test/DevicePropertiesVkTest.cpp
  76. 2
      src/Magnum/Vk/Test/DeviceVkTest.cpp
  77. 2
      src/Magnum/Vk/Test/InstanceVkTest.cpp
  78. 6
      src/Magnum/Vk/Test/MeshTest.cpp
  79. 2
      src/Magnum/Vk/Test/MeshVkTest.cpp
  80. 2
      src/Magnum/Vk/Test/PipelineTest.cpp
  81. 12
      src/Magnum/Vk/Test/ShaderSetTest.cpp
  82. 6
      src/Magnum/Vk/vk-info.cpp
  83. 20
      src/MagnumPlugins/AnyShaderConverter/AnyConverter.cpp
  84. 6
      src/MagnumPlugins/ObjImporter/ObjImporter.cpp
  85. 2
      src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp
  86. 6
      src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp
  87. 10
      src/MagnumPlugins/TgaImporter/TgaImporter.cpp
  88. 2
      src/MagnumPlugins/WavAudioImporter/Test/WavImporterTest.cpp

1
doc/snippets/MagnumShaderTools.cpp

@ -27,6 +27,7 @@
#include <Corrade/Containers/Array.h> #include <Corrade/Containers/Array.h>
#include <Corrade/Containers/Optional.h> #include <Corrade/Containers/Optional.h>
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#include <Corrade/Containers/StringStl.h> /** @todo drop when file callbacks are <string>-free */
#include <Corrade/Utility/Resource.h> #include <Corrade/Utility/Resource.h>
#include "Magnum/FileCallback.h" #include "Magnum/FileCallback.h"

4
src/Magnum/Animation/Player.hpp

@ -87,7 +87,7 @@ template<class T, class K> Player<T, K>::Player(Scaler scaler): _scaler{scaler}
template<class T, class K> Player<T, K>::~Player() = default; template<class T, class K> Player<T, K>::~Player() = default;
template<class T, class K> bool Player<T, K>::isEmpty() const { template<class T, class K> bool Player<T, K>::isEmpty() const {
return _tracks.empty(); return _tracks.isEmpty();
} }
template<class T, class K> std::size_t Player<T, K>::size() const { template<class T, class K> std::size_t Player<T, K>::size() const {
@ -102,7 +102,7 @@ template<class T, class K> const TrackViewStorage<const K>& Player<T, K>::track(
} }
template<class T, class K> Player<T, K>& Player<T, K>::addInternal(const TrackViewStorage<const K>& track, void(*const advancer)(const TrackViewStorage<const K>&, K, std::size_t&, void*, void(*)(), void*), void* const destination, void(*const userCallback)(), void* const userCallbackData) { template<class T, class K> Player<T, K>& Player<T, K>::addInternal(const TrackViewStorage<const K>& track, void(*const advancer)(const TrackViewStorage<const K>&, K, std::size_t&, void*, void(*)(), void*), void* const destination, void(*const userCallback)(), void* const userCallbackData) {
if(_tracks.empty() && _duration == Math::Range1D<K>{}) if(_tracks.isEmpty() && _duration == Math::Range1D<K>{})
_duration = track.duration(); _duration = track.duration();
else else
_duration = Math::join(track.duration(), _duration); _duration = Math::join(track.duration(), _duration);

8
src/Magnum/Animation/Test/TrackTest.cpp

@ -129,10 +129,10 @@ void TrackTest::constructEmpty() {
CORRADE_VERIFY(!ca.interpolator()); CORRADE_VERIFY(!ca.interpolator());
CORRADE_VERIFY(!ca.size()); CORRADE_VERIFY(!ca.size());
CORRADE_VERIFY(ca.keys().empty()); CORRADE_VERIFY(ca.keys().isEmpty());
CORRADE_VERIFY(ca.keys().empty()); CORRADE_VERIFY(ca.keys().isEmpty());
CORRADE_VERIFY(a.values().empty()); CORRADE_VERIFY(a.values().isEmpty());
CORRADE_VERIFY(ca.values().empty()); CORRADE_VERIFY(ca.values().isEmpty());
CORRADE_COMPARE(ca.at(42.0f), Vector3{}); CORRADE_COMPARE(ca.at(42.0f), Vector3{});
} }

8
src/Magnum/Animation/Test/TrackViewTest.cpp

@ -126,15 +126,15 @@ void TrackViewTest::constructEmpty() {
CORRADE_VERIFY(!a.interpolator()); CORRADE_VERIFY(!a.interpolator());
CORRADE_COMPARE(a.duration(), Range1D{}); CORRADE_COMPARE(a.duration(), Range1D{});
CORRADE_VERIFY(!a.size()); CORRADE_VERIFY(!a.size());
CORRADE_VERIFY(a.keys().empty()); CORRADE_VERIFY(a.keys().isEmpty());
CORRADE_VERIFY(a.values().empty()); CORRADE_VERIFY(a.values().isEmpty());
CORRADE_COMPARE(a.at(42.0f), Vector3{}); CORRADE_COMPARE(a.at(42.0f), Vector3{});
CORRADE_VERIFY(!ca.interpolator()); CORRADE_VERIFY(!ca.interpolator());
CORRADE_COMPARE(ca.duration(), Range1D{}); CORRADE_COMPARE(ca.duration(), Range1D{});
CORRADE_VERIFY(!ca.size()); CORRADE_VERIFY(!ca.size());
CORRADE_VERIFY(ca.keys().empty()); CORRADE_VERIFY(ca.keys().isEmpty());
CORRADE_VERIFY(ca.values().empty()); CORRADE_VERIFY(ca.values().isEmpty());
CORRADE_COMPARE(ca.at(42.0f), Vector3{}); CORRADE_COMPARE(ca.at(42.0f), Vector3{});
} }

4
src/Magnum/Animation/Track.h

@ -290,7 +290,7 @@ template<class K, class V, class R
* calculate combined duration for a set of tracks. * calculate combined duration for a set of tracks.
*/ */
Math::Range1D<K> duration() const { Math::Range1D<K> duration() const {
return _data.empty() ? Math::Range1D<K>{} : Math::Range1D<K>{_data.front().first, _data.back().first}; return _data.isEmpty() ? Math::Range1D<K>{} : Math::Range1D<K>{_data.front().first, _data.back().first};
} }
/** @brief Keyframe count */ /** @brief Keyframe count */
@ -474,7 +474,7 @@ template<class K> class TrackViewStorage {
* calculate combined duration for a set of tracks. * calculate combined duration for a set of tracks.
*/ */
Math::Range1D<typename std::remove_const<K>::type> duration() const { Math::Range1D<typename std::remove_const<K>::type> duration() const {
return _keys.empty() ? Math::Range1D<typename std::remove_const<K>::type>{} : Math::Range1D<typename std::remove_const<K>::type>{_keys.front(), _keys.back()}; return _keys.isEmpty() ? Math::Range1D<typename std::remove_const<K>::type>{} : Math::Range1D<typename std::remove_const<K>::type>{_keys.front(), _keys.back()};
} }
/** @brief Keyframe count */ /** @brief Keyframe count */

5
src/Magnum/DebugTools/TextureImage.cpp

@ -36,6 +36,7 @@
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2) #if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_GLES2)
#include <Corrade/Containers/Reference.h> #include <Corrade/Containers/Reference.h>
#include <Corrade/Containers/StringStl.h> /** @todo remove once GL::Shader is <string>-free */
#include <Corrade/Utility/Resource.h> #include <Corrade/Utility/Resource.h>
#include "Magnum/GL/AbstractShaderProgram.h" #include "Magnum/GL/AbstractShaderProgram.h"
@ -83,8 +84,8 @@ FloatReinterpretShader::FloatReinterpretShader() {
GL::Shader frag{GL::Version::GLES300, GL::Shader::Type::Fragment}; GL::Shader frag{GL::Version::GLES300, GL::Shader::Type::Fragment};
if(!GL::Context::current().isExtensionSupported<GL::Extensions::MAGNUM::shader_vertex_id>()) if(!GL::Context::current().isExtensionSupported<GL::Extensions::MAGNUM::shader_vertex_id>())
vert.addSource("#define DISABLE_GL_MAGNUM_shader_vertex_id\n"); vert.addSource("#define DISABLE_GL_MAGNUM_shader_vertex_id\n");
vert.addSource(rs.get("TextureImage.vert")); vert.addSource(rs.getString("TextureImage.vert"));
frag.addSource(rs.get("TextureImage.frag")); frag.addSource(rs.getString("TextureImage.frag"));
CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag})); CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag}));
attachShaders({vert, frag}); attachShaders({vert, frag});

2
src/Magnum/GL/AbstractShaderProgram.cpp

@ -471,7 +471,7 @@ AbstractShaderProgram& AbstractShaderProgram::draw(Mesh& mesh, const Containers:
#endif #endif
AbstractShaderProgram& AbstractShaderProgram::draw(Containers::ArrayView<const Containers::Reference<MeshView>> meshes) { AbstractShaderProgram& AbstractShaderProgram::draw(Containers::ArrayView<const Containers::Reference<MeshView>> meshes) {
if(meshes.empty()) return *this; if(meshes.isEmpty()) return *this;
use(); use();

4
src/Magnum/GL/Context.cpp

@ -974,7 +974,7 @@ bool Context::tryCreate(const Configuration& configuration) {
Debug{output} << "OpenGL version:" << versionString(); Debug{output} << "OpenGL version:" << versionString();
/* Print the extensions that were disabled above */ /* Print the extensions that were disabled above */
if(!_disabledExtensions.empty()) { if(!_disabledExtensions.isEmpty()) {
Debug{output} << "Disabling extensions:"; Debug{output} << "Disabling extensions:";
for(const Extension& extension: _disabledExtensions) for(const Extension& extension: _disabledExtensions)
Debug{output} << " " << extension.string(); Debug{output} << " " << extension.string();
@ -985,7 +985,7 @@ bool Context::tryCreate(const Configuration& configuration) {
_state = &state.second; _state = &state.second;
/* Print a list of used workarounds */ /* Print a list of used workarounds */
if(!_driverWorkarounds.empty()) { if(!_driverWorkarounds.isEmpty()) {
Debug{output} << "Using driver workarounds:"; Debug{output} << "Using driver workarounds:";
for(const auto& workaround: _driverWorkarounds) for(const auto& workaround: _driverWorkarounds)
if(!workaround.second) Debug(output) << " " << workaround.first; if(!workaround.second) Debug(output) << " " << workaround.first;

8
src/Magnum/GL/Mesh.cpp

@ -442,7 +442,7 @@ void Mesh::drawInternal(const Containers::ArrayView<const UnsignedInt>& counts,
"GL::AbstractShaderProgram::draw(): expected" << counts.size() << "index offset items but got" << indexOffsets.size(), ); "GL::AbstractShaderProgram::draw(): expected" << counts.size() << "index offset items but got" << indexOffsets.size(), );
/* Indexed meshes */ /* Indexed meshes */
if(vertexOffsets.empty()) { if(vertexOffsets.isEmpty()) {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
glMultiDrawElements glMultiDrawElements
#else #else
@ -495,7 +495,7 @@ void Mesh::drawInternal(const Containers::ArrayView<const UnsignedInt>& counts,
/* Non-indexed instanced meshes */ /* Non-indexed instanced meshes */
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
if(instanceOffsets.empty()) if(instanceOffsets.isEmpty())
#endif #endif
{ {
state.multiDrawArraysInstancedImplementation(GLenum(_primitive), reinterpret_cast<const GLint*>(vertexOffsets.data()), reinterpret_cast<const GLsizei*>(counts.data()), reinterpret_cast<const GLsizei*>(instanceCounts.data()), counts.size()); state.multiDrawArraysInstancedImplementation(GLenum(_primitive), reinterpret_cast<const GLint*>(vertexOffsets.data()), reinterpret_cast<const GLsizei*>(counts.data()), reinterpret_cast<const GLsizei*>(instanceCounts.data()), counts.size());
@ -518,9 +518,9 @@ void Mesh::drawInternal(const Containers::ArrayView<const UnsignedInt>& counts,
"GL::AbstractShaderProgram::draw(): expected" << counts.size() << "index offset items but got" << indexOffsets.size(), ); "GL::AbstractShaderProgram::draw(): expected" << counts.size() << "index offset items but got" << indexOffsets.size(), );
/* Indexed meshes */ /* Indexed meshes */
if(vertexOffsets.empty() if(vertexOffsets.isEmpty()
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
&& instanceOffsets.empty() && instanceOffsets.isEmpty()
#endif #endif
) { ) {
state.multiDrawElementsInstancedImplementation(GLenum(_primitive), reinterpret_cast<const GLsizei*>(counts.data()), GLenum(_indexType), reinterpret_cast<const void* const*>(indexOffsets.data()), reinterpret_cast<const GLsizei*>(instanceCounts.data()), counts.size()); state.multiDrawElementsInstancedImplementation(GLenum(_primitive), reinterpret_cast<const GLsizei*>(counts.data()), GLenum(_indexType), reinterpret_cast<const void* const*>(indexOffsets.data()), reinterpret_cast<const GLsizei*>(instanceCounts.data()), counts.size());

33
src/Magnum/GL/Test/AbstractShaderProgramGLTest.cpp

@ -25,6 +25,7 @@
#include <sstream> #include <sstream>
#include <Corrade/Containers/Reference.h> #include <Corrade/Containers/Reference.h>
#include <Corrade/Containers/StringStl.h> /** @todo remove when Shader is <string>-free */
#include <Corrade/TestSuite/Compare/Container.h> #include <Corrade/TestSuite/Compare/Container.h>
#include <Corrade/Utility/DebugStl.h> #include <Corrade/Utility/DebugStl.h>
#include <Corrade/Utility/Resource.h> #include <Corrade/Utility/Resource.h>
@ -188,7 +189,7 @@ void AbstractShaderProgramGLTest::label() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
shader.setLabel("DummyShader!"_s.except(1)); shader.setLabel("DummyShader!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(shader.label(), "DummyShader"); CORRADE_COMPARE(shader.label(), "DummyShader");
@ -224,7 +225,7 @@ void AbstractShaderProgramGLTest::create() {
Version::GLES200 Version::GLES200
#endif #endif
, Shader::Type::Vertex); , Shader::Type::Vertex);
vert.addSource(rs.get("MyShader.vert")); vert.addSource(rs.getString("MyShader.vert"));
const bool vertCompiled = vert.compile(); const bool vertCompiled = vert.compile();
Shader frag( Shader frag(
@ -238,7 +239,7 @@ void AbstractShaderProgramGLTest::create() {
Version::GLES200 Version::GLES200
#endif #endif
, Shader::Type::Fragment); , Shader::Type::Fragment);
frag.addSource(rs.get("MyShader.frag")); frag.addSource(rs.getString("MyShader.frag"));
const bool fragCompiled = frag.compile(); const bool fragCompiled = frag.compile();
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
@ -289,7 +290,7 @@ void AbstractShaderProgramGLTest::createMultipleOutputs() {
Version::GL310 Version::GL310
#endif #endif
, Shader::Type::Vertex); , Shader::Type::Vertex);
vert.addSource(rs.get("MyShader.vert")); vert.addSource(rs.getString("MyShader.vert"));
const bool vertCompiled = vert.compile(); const bool vertCompiled = vert.compile();
Shader frag( Shader frag(
@ -299,7 +300,7 @@ void AbstractShaderProgramGLTest::createMultipleOutputs() {
Version::GL310 Version::GL310
#endif #endif
, Shader::Type::Fragment); , Shader::Type::Fragment);
frag.addSource(rs.get("MyShaderFragmentOutputs.frag")); frag.addSource(rs.getString("MyShaderFragmentOutputs.frag"));
const bool fragCompiled = frag.compile(); const bool fragCompiled = frag.compile();
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
@ -348,7 +349,7 @@ void AbstractShaderProgramGLTest::createMultipleOutputsIndexed() {
Version::GL310 Version::GL310
#endif #endif
, Shader::Type::Vertex); , Shader::Type::Vertex);
vert.addSource(rs.get("MyShader.vert")); vert.addSource(rs.getString("MyShader.vert"));
const bool vertCompiled = vert.compile(); const bool vertCompiled = vert.compile();
Shader frag( Shader frag(
@ -358,7 +359,7 @@ void AbstractShaderProgramGLTest::createMultipleOutputsIndexed() {
Version::GL310 Version::GL310
#endif #endif
, Shader::Type::Fragment); , Shader::Type::Fragment);
frag.addSource(rs.get("MyShaderFragmentOutputs.frag")); frag.addSource(rs.getString("MyShaderFragmentOutputs.frag"));
const bool fragCompiled = frag.compile(); const bool fragCompiled = frag.compile();
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
@ -496,8 +497,8 @@ MyShader::MyShader() {
Version::GLES200 Version::GLES200
#endif #endif
, Shader::Type::Fragment); , Shader::Type::Fragment);
vert.addSource(rs.get("MyShader.vert")); vert.addSource(rs.getString("MyShader.vert"));
frag.addSource(rs.get("MyShader.frag")); frag.addSource(rs.getString("MyShader.frag"));
Shader::compile({vert, frag}); Shader::compile({vert, frag});
@ -580,8 +581,8 @@ MyDoubleShader::MyDoubleShader() {
Shader vert(Version::GL320, Shader::Type::Vertex); Shader vert(Version::GL320, Shader::Type::Vertex);
Shader frag(Version::GL320, Shader::Type::Fragment); Shader frag(Version::GL320, Shader::Type::Fragment);
vert.addSource(rs.get("MyDoubleShader.vert")); vert.addSource(rs.getString("MyDoubleShader.vert"));
frag.addSource(rs.get("MyDoubleShader.frag")); frag.addSource(rs.getString("MyDoubleShader.frag"));
Shader::compile({vert, frag}); Shader::compile({vert, frag});
@ -675,7 +676,7 @@ void AbstractShaderProgramGLTest::createUniformBlocks() {
Version::GLES300 Version::GLES300
#endif #endif
, Shader::Type::Vertex); , Shader::Type::Vertex);
vert.addSource(rs.get("UniformBlockShader.vert")); vert.addSource(rs.getString("UniformBlockShader.vert"));
const bool vertCompiled = vert.compile(); const bool vertCompiled = vert.compile();
Shader frag( Shader frag(
@ -685,7 +686,7 @@ void AbstractShaderProgramGLTest::createUniformBlocks() {
Version::GLES300 Version::GLES300
#endif #endif
, Shader::Type::Fragment); , Shader::Type::Fragment);
frag.addSource(rs.get("UniformBlockShader.frag")); frag.addSource(rs.getString("UniformBlockShader.frag"));
const bool fragCompiled = frag.compile(); const bool fragCompiled = frag.compile();
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
@ -783,8 +784,8 @@ UniformBlockShader::UniformBlockShader() {
Version::GLES300 Version::GLES300
#endif #endif
, Shader::Type::Fragment); , Shader::Type::Fragment);
vert.addSource(rs.get("UniformBlockShader.vert")); vert.addSource(rs.getString("UniformBlockShader.vert"));
frag.addSource(rs.get("UniformBlockShader.frag")); frag.addSource(rs.getString("UniformBlockShader.frag"));
Shader::compile({vert, frag}); Shader::compile({vert, frag});
attachShaders({vert, frag}); attachShaders({vert, frag});
@ -833,7 +834,7 @@ void AbstractShaderProgramGLTest::compute() {
Version::GLES310, Version::GLES310,
#endif #endif
Shader::Type::Compute); Shader::Type::Compute);
compute.addSource(rs.get("ComputeShader.comp")); compute.addSource(rs.getString("ComputeShader.comp"));
CORRADE_INTERNAL_ASSERT_OUTPUT(compute.compile()); CORRADE_INTERNAL_ASSERT_OUTPUT(compute.compile());
attachShader(compute); attachShader(compute);

2
src/Magnum/GL/Test/BufferGLTest.cpp

@ -206,7 +206,7 @@ void BufferGLTest::label() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
buffer.setLabel("MyBuffer!"_s.except(1)); buffer.setLabel("MyBuffer!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(buffer.label(), "MyBuffer"); CORRADE_COMPARE(buffer.label(), "MyBuffer");

2
src/Magnum/GL/Test/BufferTextureGLTest.cpp

@ -162,7 +162,7 @@ void BufferTextureGLTest::label() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
texture.setLabel("MyTexture!"_s.except(1)); texture.setLabel("MyTexture!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.label(), "MyTexture"); CORRADE_COMPARE(texture.label(), "MyTexture");

18
src/Magnum/GL/Test/ContextTest.cpp

@ -151,13 +151,13 @@ void ContextTest::configurationConstruct() {
non-null-terminated which blocks the compiler from combining them non-null-terminated which blocks the compiler from combining them
together. */ together. */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
const Containers::StringView a = "no-layout-qualifiers-on-old-glsl!"_s.except(1); const Containers::StringView a = "no-layout-qualifiers-on-old-glsl!"_s.exceptSuffix(1);
const Containers::StringView b = "nv-compressed-block-size-in-bits!"_s.except(1); const Containers::StringView b = "nv-compressed-block-size-in-bits!"_s.exceptSuffix(1);
const Containers::StringView c = "nv-cubemap-inconsistent-compressed-image-size!"_s.except(1); const Containers::StringView c = "nv-cubemap-inconsistent-compressed-image-size!"_s.exceptSuffix(1);
#elif !defined(MAGNUM_TARGET_WEBGL) #elif !defined(MAGNUM_TARGET_WEBGL)
const Containers::StringView a = "swiftshader-no-empty-egl-context-flags!"_s.except(1); const Containers::StringView a = "swiftshader-no-empty-egl-context-flags!"_s.exceptSuffix(1);
const Containers::StringView b = "swiftshader-egl-context-needs-pbuffer!"_s.except(1); const Containers::StringView b = "swiftshader-egl-context-needs-pbuffer!"_s.exceptSuffix(1);
const Containers::StringView c = "angle-chatty-shader-compiler!"_s.except(1); const Containers::StringView c = "angle-chatty-shader-compiler!"_s.exceptSuffix(1);
#else #else
/* No general WebGL workarounds to test */ /* No general WebGL workarounds to test */
#endif #endif
@ -226,7 +226,7 @@ void ContextTest::configurationConstructUnknownWorkaround() {
std::ostringstream out; std::ostringstream out;
Warning redirectWarning{&out}; Warning redirectWarning{&out};
configuration.addDisabledWorkarounds({"all-drivers-are-shit"}); configuration.addDisabledWorkarounds({"all-drivers-are-shit"});
CORRADE_VERIFY(configuration.disabledWorkarounds().empty()); CORRADE_VERIFY(configuration.disabledWorkarounds().isEmpty());
CORRADE_COMPARE(out.str(), "GL::Context::Configuration::addDisabledWorkarounds(): unknown workaround all-drivers-are-shit\n"); CORRADE_COMPARE(out.str(), "GL::Context::Configuration::addDisabledWorkarounds(): unknown workaround all-drivers-are-shit\n");
} }
@ -299,8 +299,8 @@ void ContextTest::configurationConstructMove() {
Context::Configuration b = std::move(a); Context::Configuration b = std::move(a);
CORRADE_COMPARE(UnsignedLong(b.flags()), UnsignedLong(Context::Configuration::Flag::VerboseLog)); CORRADE_COMPARE(UnsignedLong(b.flags()), UnsignedLong(Context::Configuration::Flag::VerboseLog));
CORRADE_VERIFY(a.disabledWorkarounds().empty()); CORRADE_VERIFY(a.disabledWorkarounds().isEmpty());
CORRADE_VERIFY(a.disabledExtensions().empty()); CORRADE_VERIFY(a.disabledExtensions().isEmpty());
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
CORRADE_COMPARE_AS(b.disabledWorkarounds(), CORRADE_COMPARE_AS(b.disabledWorkarounds(),
Containers::arrayView({workaround}), Containers::arrayView({workaround}),

50
src/Magnum/GL/Test/CubeMapTextureArrayGLTest.cpp

@ -138,10 +138,10 @@ const struct {
std::size_t offset; std::size_t offset;
} PixelStorageData[]{ } PixelStorageData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(Data).suffix(16), {}, Containers::arrayView(Data).exceptPrefix(16), {},
Containers::arrayView(Data).suffix(16), 0}, Containers::arrayView(Data).exceptPrefix(16), 0},
{"skip Z", {"skip Z",
Containers::arrayView(Data).suffix(16), PixelStorage{}.setSkip({0, 0, 1}), Containers::arrayView(Data).exceptPrefix(16), PixelStorage{}.setSkip({0, 0, 1}),
Containers::arrayView(Data), 16} Containers::arrayView(Data), 16}
}; };
@ -178,14 +178,14 @@ const struct {
std::size_t offset; std::size_t offset;
} CompressedPixelStorageData[]{ } CompressedPixelStorageData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(CompressedData).suffix(16*4), Containers::arrayView(CompressedData).exceptPrefix(16*4),
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{}, {},
#endif #endif
Containers::arrayView(CompressedData).suffix(16*4), 0}, Containers::arrayView(CompressedData).exceptPrefix(16*4), 0},
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{"skip Z", {"skip Z",
Containers::arrayView(CompressedData).suffix(16*4), Containers::arrayView(CompressedData).exceptPrefix(16*4),
CompressedPixelStorage{} CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 1}) .setCompressedBlockSize({4, 4, 1})
.setCompressedBlockDataSize(16) .setCompressedBlockDataSize(16)
@ -217,10 +217,10 @@ const struct {
std::size_t offset; std::size_t offset;
} SubPixelStorageData[]{ } SubPixelStorageData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(SubData).suffix(16), {}, Containers::arrayView(SubData).exceptPrefix(16), {},
Containers::arrayView(SubData).suffix(16), 0}, Containers::arrayView(SubData).exceptPrefix(16), 0},
{"skip Z", {"skip Z",
Containers::arrayView(SubData).suffix(16), PixelStorage{}.setSkip({0, 0, 1}), Containers::arrayView(SubData).exceptPrefix(16), PixelStorage{}.setSkip({0, 0, 1}),
Containers::arrayView(SubData), 16} Containers::arrayView(SubData), 16}
}; };
@ -251,14 +251,14 @@ const struct {
std::size_t offset; std::size_t offset;
} CompressedSubPixelStorageData[]{ } CompressedSubPixelStorageData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(CompressedSubData).suffix(16*4), Containers::arrayView(CompressedSubData).exceptPrefix(16*4),
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{}, {},
#endif #endif
Containers::arrayView(CompressedSubData).suffix(16*4), 0}, Containers::arrayView(CompressedSubData).exceptPrefix(16*4), 0},
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{"skip Z", {"skip Z",
Containers::arrayView(CompressedSubData).suffix(16*4), Containers::arrayView(CompressedSubData).exceptPrefix(16*4),
CompressedPixelStorage{} CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 1}) .setCompressedBlockSize({4, 4, 1})
.setCompressedBlockDataSize(16) .setCompressedBlockDataSize(16)
@ -396,7 +396,7 @@ void CubeMapTextureArrayGLTest::label() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
texture.setLabel("MyTexture!"_s.except(1)); texture.setLabel("MyTexture!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.label(), "MyTexture"); CORRADE_COMPARE(texture.label(), "MyTexture");
@ -641,7 +641,7 @@ void CubeMapTextureArrayGLTest::image() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6)); CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -676,7 +676,7 @@ void CubeMapTextureArrayGLTest::imageBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6)); CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -704,7 +704,7 @@ void CubeMapTextureArrayGLTest::imageQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6)); CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -749,7 +749,7 @@ void CubeMapTextureArrayGLTest::compressedImage() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 6})); CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 6}));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorageData[testCaseInstanceId()].offset),
CompressedPixelStorageData[testCaseInstanceId()].data, CompressedPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -797,7 +797,7 @@ void CubeMapTextureArrayGLTest::compressedImageBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 6})); CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 6}));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(CompressedPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(CompressedPixelStorageData[testCaseInstanceId()].offset),
CompressedPixelStorageData[testCaseInstanceId()].data, CompressedPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -832,7 +832,7 @@ void CubeMapTextureArrayGLTest::compressedImageQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 6})); CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 6}));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorageData[testCaseInstanceId()].offset),
CompressedPixelStorageData[testCaseInstanceId()].data, CompressedPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -964,7 +964,7 @@ void CubeMapTextureArrayGLTest::subImageQuery() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 4)); CORRADE_COMPARE(image.size(), Vector3i(2, 2, 4));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(SubPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(SubPixelStorageData[testCaseInstanceId()].offset),
SubPixelStorageData[testCaseInstanceId()].data, SubPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -990,7 +990,7 @@ void CubeMapTextureArrayGLTest::subImageQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 4)); CORRADE_COMPARE(image.size(), Vector3i(2, 2, 4));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(SubPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(SubPixelStorageData[testCaseInstanceId()].offset),
SubPixelStorageData[testCaseInstanceId()].data, SubPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1017,7 +1017,7 @@ void CubeMapTextureArrayGLTest::subImageQueryBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 4)); CORRADE_COMPARE(image.size(), Vector3i(2, 2, 4));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(SubPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(SubPixelStorageData[testCaseInstanceId()].offset),
SubPixelStorageData[testCaseInstanceId()].data, SubPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1217,7 +1217,7 @@ void CubeMapTextureArrayGLTest::compressedSubImageQuery() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i{4}); CORRADE_COMPARE(image.size(), Vector3i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedSubPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedSubPixelStorageData[testCaseInstanceId()].offset),
CompressedSubPixelStorageData[testCaseInstanceId()].data, CompressedSubPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1249,7 +1249,7 @@ void CubeMapTextureArrayGLTest::compressedSubImageQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i{4}); CORRADE_COMPARE(image.size(), Vector3i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedSubPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedSubPixelStorageData[testCaseInstanceId()].offset),
CompressedSubPixelStorageData[testCaseInstanceId()].data, CompressedSubPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1280,7 +1280,7 @@ void CubeMapTextureArrayGLTest::compressedSubImageQueryBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i{4}); CORRADE_COMPARE(image.size(), Vector3i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(CompressedSubPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(CompressedSubPixelStorageData[testCaseInstanceId()].offset),
CompressedSubPixelStorageData[testCaseInstanceId()].data, CompressedSubPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }

70
src/Magnum/GL/Test/CubeMapTextureGLTest.cpp

@ -188,11 +188,11 @@ const struct {
std::size_t offset; std::size_t offset;
} PixelStorageData[]{ } PixelStorageData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(Data).suffix(8), {}, Containers::arrayView(Data).exceptPrefix(8), {},
Containers::arrayView(Data).suffix(8), 0}, Containers::arrayView(Data).exceptPrefix(8), 0},
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
{"skip Y", {"skip Y",
Containers::arrayView(Data).suffix(8), PixelStorage{}.setSkip({0, 1, 0}), Containers::arrayView(Data).exceptPrefix(8), PixelStorage{}.setSkip({0, 1, 0}),
Containers::arrayView(Data), 8} Containers::arrayView(Data), 8}
#endif #endif
}; };
@ -214,14 +214,14 @@ const struct {
std::size_t offset; std::size_t offset;
} CompressedPixelStorageData[]{ } CompressedPixelStorageData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(CompressedData).suffix(16), Containers::arrayView(CompressedData).exceptPrefix(16),
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{}, {},
#endif #endif
Containers::arrayView(CompressedData).suffix(16), 0}, Containers::arrayView(CompressedData).exceptPrefix(16), 0},
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{"skip Y", {"skip Y",
Containers::arrayView(CompressedData).suffix(16), Containers::arrayView(CompressedData).exceptPrefix(16),
CompressedPixelStorage{} CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 1}) .setCompressedBlockSize({4, 4, 1})
.setCompressedBlockDataSize(16) .setCompressedBlockDataSize(16)
@ -259,10 +259,10 @@ const struct {
std::size_t offset; std::size_t offset;
} FullPixelStorageData[]{ } FullPixelStorageData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(FullData).suffix(16), {}, 0}, Containers::arrayView(FullData).exceptPrefix(16), {}, 0},
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
{"skip Z", {"skip Z",
Containers::arrayView(FullData).suffix(16), PixelStorage{}.setSkip({0, 0, 1}), 16} Containers::arrayView(FullData).exceptPrefix(16), PixelStorage{}.setSkip({0, 0, 1}), 16}
#endif #endif
}; };
@ -299,14 +299,14 @@ const struct {
std::size_t offset; std::size_t offset;
} CompressedFullPixelStorageData[]{ } CompressedFullPixelStorageData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(CompressedFullData).suffix(16*4), Containers::arrayView(CompressedFullData).exceptPrefix(16*4),
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{}, {},
#endif #endif
0}, 0},
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{"skip Z", {"skip Z",
Containers::arrayView(CompressedFullData).suffix(16*4), Containers::arrayView(CompressedFullData).exceptPrefix(16*4),
CompressedPixelStorage{} CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 1}) .setCompressedBlockSize({4, 4, 1})
.setCompressedBlockDataSize(16) .setCompressedBlockDataSize(16)
@ -506,7 +506,7 @@ void CubeMapTextureGLTest::label() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
texture.setLabel("MyTexture!"_s.except(1)); texture.setLabel("MyTexture!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.label(), "MyTexture"); CORRADE_COMPARE(texture.label(), "MyTexture");
@ -785,7 +785,7 @@ void CubeMapTextureGLTest::storage() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} { } {
@ -796,7 +796,7 @@ void CubeMapTextureGLTest::storage() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} { } {
@ -807,7 +807,7 @@ void CubeMapTextureGLTest::storage() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -862,7 +862,7 @@ void CubeMapTextureGLTest::image() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} { } {
@ -873,7 +873,7 @@ void CubeMapTextureGLTest::image() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} { } {
@ -884,7 +884,7 @@ void CubeMapTextureGLTest::image() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -923,7 +923,7 @@ void CubeMapTextureGLTest::imageBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -951,7 +951,7 @@ void CubeMapTextureGLTest::imageQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1116,7 +1116,7 @@ void CubeMapTextureGLTest::subImageQuery() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 1)); CORRADE_COMPARE(image.size(), Vector3i(2, 2, 1));
CORRADE_COMPARE_AS(Containers::arrayCast<const UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<const UnsignedByte>(image.data()).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1141,7 +1141,7 @@ void CubeMapTextureGLTest::subImageQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 1)); CORRADE_COMPARE(image.size(), Vector3i(2, 2, 1));
CORRADE_COMPARE_AS(Containers::arrayCast<const UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<const UnsignedByte>(image.data()).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1166,7 +1166,7 @@ void CubeMapTextureGLTest::subImageQueryBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 1)); CORRADE_COMPARE(image.size(), Vector3i(2, 2, 1));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1214,7 +1214,7 @@ void CubeMapTextureGLTest::compressedImage() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{4}); CORRADE_COMPARE(image.size(), Vector2i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorageData[testCaseInstanceId()].offset),
CompressedPixelStorageData[testCaseInstanceId()].data, CompressedPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -1266,7 +1266,7 @@ void CubeMapTextureGLTest::compressedImageBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{4}); CORRADE_COMPARE(image.size(), Vector2i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(CompressedPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(CompressedPixelStorageData[testCaseInstanceId()].offset),
CompressedPixelStorageData[testCaseInstanceId()].data, CompressedPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -1301,7 +1301,7 @@ void CubeMapTextureGLTest::compressedImageQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{4}); CORRADE_COMPARE(image.size(), Vector2i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorageData[testCaseInstanceId()].offset),
CompressedPixelStorageData[testCaseInstanceId()].data, CompressedPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1452,7 +1452,7 @@ void CubeMapTextureGLTest::immutableCompressedImage() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{4}); CORRADE_COMPARE(image.size(), Vector2i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorageData[testCaseInstanceId()].offset),
CompressedPixelStorageData[testCaseInstanceId()].data, CompressedPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -1629,7 +1629,7 @@ void CubeMapTextureGLTest::compressedSubImageQuery() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 1})); CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 1}));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorageData[testCaseInstanceId()].offset),
CompressedPixelStorageData[testCaseInstanceId()].data, CompressedPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1659,7 +1659,7 @@ void CubeMapTextureGLTest::compressedSubImageQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 1})); CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 1}));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorageData[testCaseInstanceId()].offset),
CompressedPixelStorageData[testCaseInstanceId()].data, CompressedPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1776,7 +1776,7 @@ void CubeMapTextureGLTest::compressedSubImageQueryBuffer() {
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 1})); CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 1}));
CORRADE_COMPARE_AS( CORRADE_COMPARE_AS(
Containers::arrayCast<UnsignedByte>(imageData).suffix(CompressedPixelStorageData[testCaseInstanceId()].offset), Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(CompressedPixelStorageData[testCaseInstanceId()].offset),
CompressedPixelStorageData[testCaseInstanceId()].data, CompressedPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1809,7 +1809,7 @@ void CubeMapTextureGLTest::image3D() {
{ {
CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && FullPixelStorageData[testCaseInstanceId()].storage != PixelStorage{}, CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && FullPixelStorageData[testCaseInstanceId()].storage != PixelStorage{},
"Mesa drivers can't handle non-default pixel storage for full cubemap image queries."); "Mesa drivers can't handle non-default pixel storage for full cubemap image queries.");
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(FullPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(FullPixelStorageData[testCaseInstanceId()].offset),
FullPixelStorageData[testCaseInstanceId()].data, FullPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1841,7 +1841,7 @@ void CubeMapTextureGLTest::image3DBuffer() {
{ {
CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && FullPixelStorageData[testCaseInstanceId()].storage != PixelStorage{}, CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && FullPixelStorageData[testCaseInstanceId()].storage != PixelStorage{},
"Mesa drivers can't handle non-default pixel storage for full cubemap image queries."); "Mesa drivers can't handle non-default pixel storage for full cubemap image queries.");
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(FullPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(FullPixelStorageData[testCaseInstanceId()].offset),
FullPixelStorageData[testCaseInstanceId()].data, TestSuite::Compare::Container); FullPixelStorageData[testCaseInstanceId()].data, TestSuite::Compare::Container);
} }
#endif #endif
@ -1870,7 +1870,7 @@ void CubeMapTextureGLTest::image3DQueryView() {
{ {
CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && FullPixelStorageData[testCaseInstanceId()].storage != PixelStorage{}, CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && FullPixelStorageData[testCaseInstanceId()].storage != PixelStorage{},
"Mesa drivers can't handle non-default pixel storage for full cubemap image queries."); "Mesa drivers can't handle non-default pixel storage for full cubemap image queries.");
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(FullPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(FullPixelStorageData[testCaseInstanceId()].offset),
FullPixelStorageData[testCaseInstanceId()].data, FullPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1961,7 +1961,7 @@ void CubeMapTextureGLTest::compressedImage3D() {
{ {
CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && CompressedFullPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{}, CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && CompressedFullPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{},
"Mesa drivers can't handle non-default pixel storage for full cubemap image queries."); "Mesa drivers can't handle non-default pixel storage for full cubemap image queries.");
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedFullPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedFullPixelStorageData[testCaseInstanceId()].offset),
CompressedFullPixelStorageData[testCaseInstanceId()].data, CompressedFullPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -2013,7 +2013,7 @@ void CubeMapTextureGLTest::compressedImage3DBuffer() {
{ {
CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && CompressedFullPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{}, CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && CompressedFullPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{},
"Mesa drivers can't handle non-default pixel storage for full cubemap image queries."); "Mesa drivers can't handle non-default pixel storage for full cubemap image queries.");
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(CompressedFullPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(CompressedFullPixelStorageData[testCaseInstanceId()].offset),
CompressedFullPixelStorageData[testCaseInstanceId()].data, CompressedFullPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -2065,7 +2065,7 @@ void CubeMapTextureGLTest::compressedImage3DQueryView() {
{ {
CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && CompressedFullPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{}, CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && CompressedFullPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{},
"Mesa drivers can't handle non-default pixel storage for full cubemap image queries."); "Mesa drivers can't handle non-default pixel storage for full cubemap image queries.");
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedFullPixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedFullPixelStorageData[testCaseInstanceId()].offset),
CompressedFullPixelStorageData[testCaseInstanceId()].data, CompressedFullPixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }

2
src/Magnum/GL/Test/FramebufferGLTest.cpp

@ -418,7 +418,7 @@ void FramebufferGLTest::label() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
framebuffer.setLabel("MyFramebuffer!"_s.except(1)); framebuffer.setLabel("MyFramebuffer!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(framebuffer.label(), "MyFramebuffer"); CORRADE_COMPARE(framebuffer.label(), "MyFramebuffer");

2
src/Magnum/GL/Test/MeshGLTest.cpp

@ -938,7 +938,7 @@ void MeshGLTest::label() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
mesh.setLabel("MyMesh!"_s.except(1)); mesh.setLabel("MyMesh!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(mesh.label(), "MyMesh"); CORRADE_COMPARE(mesh.label(), "MyMesh");

4
src/Magnum/GL/Test/MultisampleTextureGLTest.cpp

@ -201,7 +201,7 @@ void MultisampleTextureGLTest::label2D() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
texture.setLabel("MyTexture!"_s.except(1)); texture.setLabel("MyTexture!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.label(), "MyTexture"); CORRADE_COMPARE(texture.label(), "MyTexture");
@ -221,7 +221,7 @@ void MultisampleTextureGLTest::label2DArray() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
texture.setLabel("MyTexture!"_s.except(1)); texture.setLabel("MyTexture!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.label(), "MyTexture"); CORRADE_COMPARE(texture.label(), "MyTexture");

2
src/Magnum/GL/Test/PipelineStatisticsQueryGLTest.cpp

@ -115,7 +115,7 @@ void PipelineStatisticsQueryGLTest::label() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
query.setLabel("MyQuery!"_s.except(1)); query.setLabel("MyQuery!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(query.label(), "MyQuery"); CORRADE_COMPARE(query.label(), "MyQuery");

2
src/Magnum/GL/Test/PrimitiveQueryGLTest.cpp

@ -161,7 +161,7 @@ void PrimitiveQueryGLTest::label() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
query.setLabel("MyQuery!"_s.except(1)); query.setLabel("MyQuery!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(query.label(), "MyQuery"); CORRADE_COMPARE(query.label(), "MyQuery");

20
src/Magnum/GL/Test/RectangleTextureGLTest.cpp

@ -108,11 +108,11 @@ const struct {
std::size_t offset; std::size_t offset;
} PixelStorageData[]{ } PixelStorageData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(Data).suffix(8), {}, Containers::arrayView(Data).exceptPrefix(8), {},
Containers::arrayView(Data).suffix(8), 0}, Containers::arrayView(Data).exceptPrefix(8), 0},
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
{"skip Y", {"skip Y",
Containers::arrayView(Data).suffix(8), PixelStorage{}.setSkip({0, 1, 0}), Containers::arrayView(Data).exceptPrefix(8), PixelStorage{}.setSkip({0, 1, 0}),
Containers::arrayView(Data), 8} Containers::arrayView(Data), 8}
#endif #endif
}; };
@ -215,7 +215,7 @@ void RectangleTextureGLTest::label() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
texture.setLabel("MyTexture!"_s.except(1)); texture.setLabel("MyTexture!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.label(), "MyTexture"); CORRADE_COMPARE(texture.label(), "MyTexture");
@ -374,7 +374,7 @@ void RectangleTextureGLTest::image() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -401,7 +401,7 @@ void RectangleTextureGLTest::imageBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -427,7 +427,7 @@ void RectangleTextureGLTest::imageQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -514,7 +514,7 @@ void RectangleTextureGLTest::subImageQuery() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{2}); CORRADE_COMPARE(image.size(), Vector2i{2});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -540,7 +540,7 @@ void RectangleTextureGLTest::subImageQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{2}); CORRADE_COMPARE(image.size(), Vector2i{2});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -567,7 +567,7 @@ void RectangleTextureGLTest::subImageQueryBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{2}); CORRADE_COMPARE(image.size(), Vector2i{2});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorageData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(PixelStorageData[testCaseInstanceId()].offset),
PixelStorageData[testCaseInstanceId()].data, PixelStorageData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }

2
src/Magnum/GL/Test/RenderbufferGLTest.cpp

@ -156,7 +156,7 @@ void RenderbufferGLTest::label() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
renderbuffer.setLabel("MyRenderbuffer!"_s.except(1)); renderbuffer.setLabel("MyRenderbuffer!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(renderbuffer.label(), "MyRenderbuffer"); CORRADE_COMPARE(renderbuffer.label(), "MyRenderbuffer");

2
src/Magnum/GL/Test/SampleQueryGLTest.cpp

@ -150,7 +150,7 @@ void SampleQueryGLTest::label() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
query.setLabel("MyQuery!"_s.except(1)); query.setLabel("MyQuery!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(query.label(), "MyQuery"); CORRADE_COMPARE(query.label(), "MyQuery");

2
src/Magnum/GL/Test/ShaderGLTest.cpp

@ -168,7 +168,7 @@ void ShaderGLTest::label() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
shader.setLabel("MyShader!"_s.except(1)); shader.setLabel("MyShader!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(shader.label(), "MyShader"); CORRADE_COMPARE(shader.label(), "MyShader");

58
src/Magnum/GL/Test/TextureArrayGLTest.cpp

@ -213,10 +213,10 @@ const struct {
std::size_t offset; std::size_t offset;
} PixelStorage1DData[]{ } PixelStorage1DData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(Data1D).suffix(8), {}, Containers::arrayView(Data1D).exceptPrefix(8), {},
Containers::arrayView(Data1D).suffix(8), 0}, Containers::arrayView(Data1D).exceptPrefix(8), 0},
{"skip Y", {"skip Y",
Containers::arrayView(Data1D).suffix(8), PixelStorage{}.setSkip({0, 1, 0}), Containers::arrayView(Data1D).exceptPrefix(8), PixelStorage{}.setSkip({0, 1, 0}),
Containers::arrayView(Data1D), 8}}; Containers::arrayView(Data1D), 8}};
#endif #endif
@ -237,10 +237,10 @@ const struct {
std::size_t offset; std::size_t offset;
} PixelStorage2DData[]{ } PixelStorage2DData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(Data2D).suffix(16), {}, Containers::arrayView(Data2D).exceptPrefix(16), {},
Containers::arrayView(Data2D).suffix(16), 0}, Containers::arrayView(Data2D).exceptPrefix(16), 0},
{"skip Z", {"skip Z",
Containers::arrayView(Data2D).suffix(16), PixelStorage{}.setSkip({0, 0, 1}), Containers::arrayView(Data2D).exceptPrefix(16), PixelStorage{}.setSkip({0, 0, 1}),
Containers::arrayView(Data2D), 16}}; Containers::arrayView(Data2D), 16}};
/* Just 4x4x3 0x00 - 0x7f compressed using RGBA DXT3 by the driver */ /* Just 4x4x3 0x00 - 0x7f compressed using RGBA DXT3 by the driver */
@ -263,14 +263,14 @@ const struct {
std::size_t offset; std::size_t offset;
} CompressedPixelStorage2DData[]{ } CompressedPixelStorage2DData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(CompressedData2D).suffix(16), Containers::arrayView(CompressedData2D).exceptPrefix(16),
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{}, {},
#endif #endif
Containers::arrayView(CompressedData2D).suffix(16), 0}, Containers::arrayView(CompressedData2D).exceptPrefix(16), 0},
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{"skip Y", {"skip Y",
Containers::arrayView(CompressedData2D).suffix(16), Containers::arrayView(CompressedData2D).exceptPrefix(16),
CompressedPixelStorage{} CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 1}) .setCompressedBlockSize({4, 4, 1})
.setCompressedBlockDataSize(16) .setCompressedBlockDataSize(16)
@ -520,7 +520,7 @@ void TextureArrayGLTest::label1D() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
texture.setLabel("MyTexture!"_s.except(1)); texture.setLabel("MyTexture!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.label(), "MyTexture"); CORRADE_COMPARE(texture.label(), "MyTexture");
@ -540,7 +540,7 @@ void TextureArrayGLTest::label2D() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
texture.setLabel("MyTexture!"_s.except(1)); texture.setLabel("MyTexture!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.label(), "MyTexture"); CORRADE_COMPARE(texture.label(), "MyTexture");
@ -955,7 +955,7 @@ void TextureArrayGLTest::image1D() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage1DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage1DData[testCaseInstanceId()].offset),
PixelStorage1DData[testCaseInstanceId()].data, PixelStorage1DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -982,7 +982,7 @@ void TextureArrayGLTest::image1DBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorage1DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(PixelStorage1DData[testCaseInstanceId()].offset),
PixelStorage1DData[testCaseInstanceId()].data, PixelStorage1DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1008,7 +1008,7 @@ void TextureArrayGLTest::image1DQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage1DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage1DData[testCaseInstanceId()].offset),
PixelStorage1DData[testCaseInstanceId()].data, PixelStorage1DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1095,7 +1095,7 @@ void TextureArrayGLTest::subImage1DQuery() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{2}); CORRADE_COMPARE(image.size(), Vector2i{2});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage1DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage1DData[testCaseInstanceId()].offset),
PixelStorage1DData[testCaseInstanceId()].data, PixelStorage1DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1122,7 +1122,7 @@ void TextureArrayGLTest::subImage1DQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{2}); CORRADE_COMPARE(image.size(), Vector2i{2});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage1DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage1DData[testCaseInstanceId()].offset),
PixelStorage1DData[testCaseInstanceId()].data, PixelStorage1DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1151,7 +1151,7 @@ void TextureArrayGLTest::subImage1DQueryBuffer() {
CORRADE_COMPARE(image.size(), Vector2i{2}); CORRADE_COMPARE(image.size(), Vector2i{2});
/* Was broken on NV since 370.xx (May 2017), fixed in 390.25 (Mar 2018) */ /* Was broken on NV since 370.xx (May 2017), fixed in 390.25 (Mar 2018) */
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorage1DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(PixelStorage1DData[testCaseInstanceId()].offset),
PixelStorage1DData[testCaseInstanceId()].data, PixelStorage1DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1213,7 +1213,7 @@ void TextureArrayGLTest::image2D() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2)); CORRADE_COMPARE(image.size(), Vector3i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage2DData[testCaseInstanceId()].offset),
PixelStorage2DData[testCaseInstanceId()].data, PixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -1245,7 +1245,7 @@ void TextureArrayGLTest::image2DBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2)); CORRADE_COMPARE(image.size(), Vector3i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(PixelStorage2DData[testCaseInstanceId()].offset),
PixelStorage2DData[testCaseInstanceId()].data, PixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -1274,7 +1274,7 @@ void TextureArrayGLTest::image2DQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2)); CORRADE_COMPARE(image.size(), Vector3i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage2DData[testCaseInstanceId()].offset),
PixelStorage2DData[testCaseInstanceId()].data, PixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1392,7 +1392,7 @@ void TextureArrayGLTest::subImage2DQuery() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i{2}); CORRADE_COMPARE(image.size(), Vector3i{2});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage2DData[testCaseInstanceId()].offset),
PixelStorage2DData[testCaseInstanceId()].data, PixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1419,7 +1419,7 @@ void TextureArrayGLTest::subImage2DQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i{2}); CORRADE_COMPARE(image.size(), Vector3i{2});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage2DData[testCaseInstanceId()].offset),
PixelStorage2DData[testCaseInstanceId()].data, PixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1446,7 +1446,7 @@ void TextureArrayGLTest::subImage2DQueryBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i{2}); CORRADE_COMPARE(image.size(), Vector3i{2});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(PixelStorage2DData[testCaseInstanceId()].offset),
PixelStorage2DData[testCaseInstanceId()].data, PixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1491,7 +1491,7 @@ void TextureArrayGLTest::compressedImage2D() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 2})); CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 2}));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorage2DData[testCaseInstanceId()].offset),
CompressedPixelStorage2DData[testCaseInstanceId()].data, CompressedPixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -1538,7 +1538,7 @@ void TextureArrayGLTest::compressedImage2DBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 2})); CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 2}));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(CompressedPixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(CompressedPixelStorage2DData[testCaseInstanceId()].offset),
CompressedPixelStorage2DData[testCaseInstanceId()].data, CompressedPixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -1571,7 +1571,7 @@ void TextureArrayGLTest::compressedImage2DQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 2})); CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 2}));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorage2DData[testCaseInstanceId()].offset),
CompressedPixelStorage2DData[testCaseInstanceId()].data, CompressedPixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1742,7 +1742,7 @@ void TextureArrayGLTest::compressedSubImage2DQuery() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 2})); CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 2}));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorage2DData[testCaseInstanceId()].offset),
CompressedPixelStorage2DData[testCaseInstanceId()].data, CompressedPixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1775,7 +1775,7 @@ void TextureArrayGLTest::compressedSubImage2DQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 2})); CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 2}));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorage2DData[testCaseInstanceId()].offset),
CompressedPixelStorage2DData[testCaseInstanceId()].data, CompressedPixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1811,7 +1811,7 @@ void TextureArrayGLTest::compressedSubImage2DQueryBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 2})); CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 2}));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(CompressedPixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(CompressedPixelStorage2DData[testCaseInstanceId()].offset),
CompressedPixelStorage2DData[testCaseInstanceId()].data, CompressedPixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }

96
src/Magnum/GL/Test/TextureGLTest.cpp

@ -301,10 +301,10 @@ const struct {
std::size_t offset; std::size_t offset;
} PixelStorage1DData[]{ } PixelStorage1DData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(Data1D).suffix(4), {}, Containers::arrayView(Data1D).exceptPrefix(4), {},
Containers::arrayView(Data1D).suffix(4), 0}, Containers::arrayView(Data1D).exceptPrefix(4), 0},
{"skip X", {"skip X",
Containers::arrayView(Data1D).suffix(4), PixelStorage{}.setSkip({1, 0, 0}), Containers::arrayView(Data1D).exceptPrefix(4), PixelStorage{}.setSkip({1, 0, 0}),
Containers::arrayView(Data1D), 4}}; Containers::arrayView(Data1D), 4}};
#endif #endif
@ -322,11 +322,11 @@ const struct {
std::size_t offset; std::size_t offset;
} PixelStorage2DData[]{ } PixelStorage2DData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(Data2D).suffix(8), {}, Containers::arrayView(Data2D).exceptPrefix(8), {},
Containers::arrayView(Data2D).suffix(8), 0}, Containers::arrayView(Data2D).exceptPrefix(8), 0},
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
{"skip Y", {"skip Y",
Containers::arrayView(Data2D).suffix(8), PixelStorage{}.setSkip({0, 1, 0}), Containers::arrayView(Data2D).exceptPrefix(8), PixelStorage{}.setSkip({0, 1, 0}),
Containers::arrayView(Data2D), 8} Containers::arrayView(Data2D), 8}
#endif #endif
}; };
@ -349,14 +349,14 @@ const struct {
std::size_t offset; std::size_t offset;
} CompressedPixelStorage2DData[]{ } CompressedPixelStorage2DData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(CompressedData2D).suffix(16), Containers::arrayView(CompressedData2D).exceptPrefix(16),
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{}, {},
#endif #endif
Containers::arrayView(CompressedData2D).suffix(16), 0}, Containers::arrayView(CompressedData2D).exceptPrefix(16), 0},
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{"skip Y", {"skip Y",
Containers::arrayView(CompressedData2D).suffix(16), Containers::arrayView(CompressedData2D).exceptPrefix(16),
CompressedPixelStorage{} CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 1}) .setCompressedBlockSize({4, 4, 1})
.setCompressedBlockDataSize(16) .setCompressedBlockDataSize(16)
@ -385,11 +385,11 @@ const struct {
std::size_t offset; std::size_t offset;
} PixelStorage3DData[]{ } PixelStorage3DData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(Data3D).suffix(16), {}, Containers::arrayView(Data3D).exceptPrefix(16), {},
Containers::arrayView(Data3D).suffix(16), 0}, Containers::arrayView(Data3D).exceptPrefix(16), 0},
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
{"skip Z", {"skip Z",
Containers::arrayView(Data3D).suffix(16), PixelStorage{}.setSkip({0, 0, 1}), Containers::arrayView(Data3D).exceptPrefix(16), PixelStorage{}.setSkip({0, 0, 1}),
Containers::arrayView(Data3D), 16} Containers::arrayView(Data3D), 16}
#endif #endif
}; };
@ -422,12 +422,12 @@ const struct {
std::size_t offset; std::size_t offset;
} CompressedPixelStorage3DData[]{ } CompressedPixelStorage3DData[]{
{"default pixel storage", {"default pixel storage",
Containers::arrayView(CompressedData3D).suffix(16*4), Containers::arrayView(CompressedData3D).exceptPrefix(16*4),
{}, {},
Containers::arrayView(CompressedData3D).suffix(16*4), 0}, Containers::arrayView(CompressedData3D).exceptPrefix(16*4), 0},
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
{"skip Z", {"skip Z",
Containers::arrayView(CompressedData3D).suffix(16*4), Containers::arrayView(CompressedData3D).exceptPrefix(16*4),
CompressedPixelStorage{} CompressedPixelStorage{}
.setCompressedBlockSize({4, 4, 4}) .setCompressedBlockSize({4, 4, 4})
.setCompressedBlockDataSize(16*4) .setCompressedBlockDataSize(16*4)
@ -795,7 +795,7 @@ void TextureGLTest::label1D() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
texture.setLabel("MyTexture!"_s.except(1)); texture.setLabel("MyTexture!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.label(), "MyTexture"); CORRADE_COMPARE(texture.label(), "MyTexture");
@ -815,7 +815,7 @@ void TextureGLTest::label2D() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
texture.setLabel("MyTexture!"_s.except(1)); texture.setLabel("MyTexture!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.label(), "MyTexture"); CORRADE_COMPARE(texture.label(), "MyTexture");
@ -834,7 +834,7 @@ void TextureGLTest::label3D() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
texture.setLabel("MyTexture!"_s.except(1)); texture.setLabel("MyTexture!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.label(), "MyTexture"); CORRADE_COMPARE(texture.label(), "MyTexture");
@ -1430,7 +1430,7 @@ void TextureGLTest::image1D() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), 2); CORRADE_COMPARE(image.size(), 2);
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage1DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage1DData[testCaseInstanceId()].offset),
PixelStorage1DData[testCaseInstanceId()].data, PixelStorage1DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1454,7 +1454,7 @@ void TextureGLTest::image1DBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), 2); CORRADE_COMPARE(image.size(), 2);
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorage1DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(PixelStorage1DData[testCaseInstanceId()].offset),
PixelStorage1DData[testCaseInstanceId()].data, PixelStorage1DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1478,7 +1478,7 @@ void TextureGLTest::image1DQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), 2); CORRADE_COMPARE(image.size(), 2);
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage1DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage1DData[testCaseInstanceId()].offset),
PixelStorage1DData[testCaseInstanceId()].data, PixelStorage1DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1554,7 +1554,7 @@ void TextureGLTest::subImage1DQuery() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), 2); CORRADE_COMPARE(image.size(), 2);
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage1DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage1DData[testCaseInstanceId()].offset),
PixelStorage1DData[testCaseInstanceId()].data, PixelStorage1DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1579,7 +1579,7 @@ void TextureGLTest::subImage1DQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), 2); CORRADE_COMPARE(image.size(), 2);
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage1DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage1DData[testCaseInstanceId()].offset),
PixelStorage1DData[testCaseInstanceId()].data, PixelStorage1DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1604,7 +1604,7 @@ void TextureGLTest::subImage1DQueryBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), 2); CORRADE_COMPARE(image.size(), 2);
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorage1DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(PixelStorage1DData[testCaseInstanceId()].offset),
PixelStorage1DData[testCaseInstanceId()].data, PixelStorage1DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1677,7 +1677,7 @@ void TextureGLTest::image2D() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage2DData[testCaseInstanceId()].offset),
PixelStorage2DData[testCaseInstanceId()].data, PixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -1706,7 +1706,7 @@ void TextureGLTest::image2DBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(PixelStorage2DData[testCaseInstanceId()].offset),
PixelStorage2DData[testCaseInstanceId()].data, PixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -1733,7 +1733,7 @@ void TextureGLTest::image2DQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage2DData[testCaseInstanceId()].offset),
PixelStorage2DData[testCaseInstanceId()].data, PixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1838,7 +1838,7 @@ void TextureGLTest::subImage2DQuery() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{2}); CORRADE_COMPARE(image.size(), Vector2i{2});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage2DData[testCaseInstanceId()].offset),
PixelStorage2DData[testCaseInstanceId()].data, PixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1863,7 +1863,7 @@ void TextureGLTest::subImage2DQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{2}); CORRADE_COMPARE(image.size(), Vector2i{2});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage2DData[testCaseInstanceId()].offset),
PixelStorage2DData[testCaseInstanceId()].data, PixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1888,7 +1888,7 @@ void TextureGLTest::subImage2DQueryBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{2}); CORRADE_COMPARE(image.size(), Vector2i{2});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(PixelStorage2DData[testCaseInstanceId()].offset),
PixelStorage2DData[testCaseInstanceId()].data, PixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -1930,7 +1930,7 @@ void TextureGLTest::compressedImage2D() {
CORRADE_COMPARE(image.size(), Vector2i{4}); CORRADE_COMPARE(image.size(), Vector2i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorage2DData[testCaseInstanceId()].offset),
CompressedPixelStorage2DData[testCaseInstanceId()].data, CompressedPixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -1974,7 +1974,7 @@ void TextureGLTest::compressedImage2DBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{4}); CORRADE_COMPARE(image.size(), Vector2i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(CompressedPixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(CompressedPixelStorage2DData[testCaseInstanceId()].offset),
CompressedPixelStorage2DData[testCaseInstanceId()].data, CompressedPixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -2007,7 +2007,7 @@ void TextureGLTest::compressedImage2DQueryView() {
CORRADE_COMPARE(image.size(), Vector2i{4}); CORRADE_COMPARE(image.size(), Vector2i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorage2DData[testCaseInstanceId()].offset),
CompressedPixelStorage2DData[testCaseInstanceId()].data, CompressedPixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -2143,7 +2143,7 @@ void TextureGLTest::compressedSubImage2DQuery() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{4}); CORRADE_COMPARE(image.size(), Vector2i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorage2DData[testCaseInstanceId()].offset),
CompressedPixelStorage2DData[testCaseInstanceId()].data, CompressedPixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -2173,7 +2173,7 @@ void TextureGLTest::compressedSubImage2DQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{4}); CORRADE_COMPARE(image.size(), Vector2i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorage2DData[testCaseInstanceId()].offset),
CompressedPixelStorage2DData[testCaseInstanceId()].data, CompressedPixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -2203,7 +2203,7 @@ void TextureGLTest::compressedSubImage2DQueryBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{4}); CORRADE_COMPARE(image.size(), Vector2i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(CompressedPixelStorage2DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(CompressedPixelStorage2DData[testCaseInstanceId()].offset),
CompressedPixelStorage2DData[testCaseInstanceId()].data, CompressedPixelStorage2DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -2236,7 +2236,7 @@ void TextureGLTest::image3D() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2)); CORRADE_COMPARE(image.size(), Vector3i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage3DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage3DData[testCaseInstanceId()].offset),
PixelStorage3DData[testCaseInstanceId()].data, PixelStorage3DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -2265,7 +2265,7 @@ void TextureGLTest::image3DBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2)); CORRADE_COMPARE(image.size(), Vector3i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorage3DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(PixelStorage3DData[testCaseInstanceId()].offset),
PixelStorage3DData[testCaseInstanceId()].data, PixelStorage3DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -2292,7 +2292,7 @@ void TextureGLTest::image3DQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2)); CORRADE_COMPARE(image.size(), Vector3i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage3DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage3DData[testCaseInstanceId()].offset),
PixelStorage3DData[testCaseInstanceId()].data, PixelStorage3DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -2406,7 +2406,7 @@ void TextureGLTest::subImage3DQuery() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i{2}); CORRADE_COMPARE(image.size(), Vector3i{2});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage3DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage3DData[testCaseInstanceId()].offset),
PixelStorage3DData[testCaseInstanceId()].data, PixelStorage3DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -2431,7 +2431,7 @@ void TextureGLTest::subImage3DQueryView() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i{2}); CORRADE_COMPARE(image.size(), Vector3i{2});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorage3DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(PixelStorage3DData[testCaseInstanceId()].offset),
PixelStorage3DData[testCaseInstanceId()].data, PixelStorage3DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -2456,7 +2456,7 @@ void TextureGLTest::subImage3DQueryBuffer() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i{2}); CORRADE_COMPARE(image.size(), Vector3i{2});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorage3DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(PixelStorage3DData[testCaseInstanceId()].offset),
PixelStorage3DData[testCaseInstanceId()].data, PixelStorage3DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -2496,7 +2496,7 @@ void TextureGLTest::compressedImage3D() {
{ {
CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && CompressedPixelStorage3DData[testCaseInstanceId()].storage != CompressedPixelStorage{}, CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && CompressedPixelStorage3DData[testCaseInstanceId()].storage != CompressedPixelStorage{},
"Mesa drivers can't handle non-default compressed 3D pixel storage."); "Mesa drivers can't handle non-default compressed 3D pixel storage.");
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorage3DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorage3DData[testCaseInstanceId()].offset),
CompressedPixelStorage3DData[testCaseInstanceId()].data, CompressedPixelStorage3DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -2538,7 +2538,7 @@ void TextureGLTest::compressedImage3DBuffer() {
{ {
CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && CompressedPixelStorage3DData[testCaseInstanceId()].storage != CompressedPixelStorage{}, CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && CompressedPixelStorage3DData[testCaseInstanceId()].storage != CompressedPixelStorage{},
"Mesa drivers can't handle non-default compressed 3D pixel storage."); "Mesa drivers can't handle non-default compressed 3D pixel storage.");
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(CompressedPixelStorage3DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(CompressedPixelStorage3DData[testCaseInstanceId()].offset),
CompressedPixelStorage3DData[testCaseInstanceId()].data, CompressedPixelStorage3DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -2573,7 +2573,7 @@ void TextureGLTest::compressedImage3DQueryView() {
{ {
CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && CompressedPixelStorage3DData[testCaseInstanceId()].storage != CompressedPixelStorage{}, CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && CompressedPixelStorage3DData[testCaseInstanceId()].storage != CompressedPixelStorage{},
"Mesa drivers can't handle non-default compressed 3D pixel storage."); "Mesa drivers can't handle non-default compressed 3D pixel storage.");
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorage3DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorage3DData[testCaseInstanceId()].offset),
CompressedPixelStorage3DData[testCaseInstanceId()].data, CompressedPixelStorage3DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -2748,7 +2748,7 @@ void TextureGLTest::compressedSubImage3DQuery() {
"Default compressed pixel storage behaves weirdly with BPTC compression on NVidia."); "Default compressed pixel storage behaves weirdly with BPTC compression on NVidia.");
CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa), CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa),
"Mesa drivers can't handle compressed 3D pixel storage for subimages."); "Mesa drivers can't handle compressed 3D pixel storage for subimages.");
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorage3DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorage3DData[testCaseInstanceId()].offset),
CompressedPixelStorage3DData[testCaseInstanceId()].data, CompressedPixelStorage3DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -2785,7 +2785,7 @@ void TextureGLTest::compressedSubImage3DQueryView() {
"Default compressed pixel storage behaves weirdly with BPTC compression on NVidia."); "Default compressed pixel storage behaves weirdly with BPTC compression on NVidia.");
CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa), CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa),
"Mesa drivers can't handle compressed 3D pixel storage for subimages."); "Mesa drivers can't handle compressed 3D pixel storage for subimages.");
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorage3DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).exceptPrefix(CompressedPixelStorage3DData[testCaseInstanceId()].offset),
CompressedPixelStorage3DData[testCaseInstanceId()].data, CompressedPixelStorage3DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }
@ -2822,7 +2822,7 @@ void TextureGLTest::compressedSubImage3DQueryBuffer() {
"Default compressed pixel storage behaves weirdly with BPTC compression on NVidia."); "Default compressed pixel storage behaves weirdly with BPTC compression on NVidia.");
CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa), CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa),
"Mesa drivers can't handle compressed 3D pixel storage for subimages."); "Mesa drivers can't handle compressed 3D pixel storage for subimages.");
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(CompressedPixelStorage3DData[testCaseInstanceId()].offset), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).exceptPrefix(CompressedPixelStorage3DData[testCaseInstanceId()].offset),
CompressedPixelStorage3DData[testCaseInstanceId()].data, CompressedPixelStorage3DData[testCaseInstanceId()].data,
TestSuite::Compare::Container); TestSuite::Compare::Container);
} }

2
src/Magnum/GL/Test/TimeQueryGLTest.cpp

@ -146,7 +146,7 @@ void TimeQueryGLTest::label() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
query.setLabel("MyQuery!"_s.except(1)); query.setLabel("MyQuery!"_s.exceptSuffix(1));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(query.label(), "MyQuery"); CORRADE_COMPARE(query.label(), "MyQuery");

2
src/Magnum/GL/Test/TransformFeedbackGLTest.cpp

@ -208,7 +208,7 @@ void TransformFeedbackGLTest::label() {
/* Test the string size gets correctly used, instead of relying on null /* Test the string size gets correctly used, instead of relying on null
termination */ termination */
feedback.setLabel("MyXfb!"_s.except(1)); feedback.setLabel("MyXfb!"_s.exceptSuffix(1));
{ {
#ifdef MAGNUM_TARGET_GLES #ifdef MAGNUM_TARGET_GLES
CORRADE_EXPECT_FAIL_IF(Context::current().detectedDriver() & Context::DetectedDriver::NVidia && CORRADE_EXPECT_FAIL_IF(Context::current().detectedDriver() & Context::DetectedDriver::NVidia &&

2
src/Magnum/Implementation/ImageProperties.h

@ -70,7 +70,7 @@ template<UnsignedInt dimensions, class T, class Image, class Data> Containers::S
static_assert(sizeof(decltype(image.data().front())) == 1, static_assert(sizeof(decltype(image.data().front())) == 1,
"pointer arithmetic expects image data type to have 1 byte"); "pointer arithmetic expects image data type to have 1 byte");
return {data.suffix(properties.first[dimensions - 1]), data + properties.first.sum(), size, stride}; return {data.exceptPrefix(properties.first[dimensions - 1]), data + properties.first.sum(), size, stride};
} }
}} }}

10
src/Magnum/Math/FunctionsBatch.h

@ -63,7 +63,7 @@ empty, returns @cpp false @ce or a @ref BoolVector with no bits set.
@see @ref isInf(T), @ref Constants::inf() @see @ref isInf(T), @ref Constants::inf()
*/ */
template<class T> auto isInf(const Corrade::Containers::StridedArrayView1D<const T>& range) -> decltype(isInf(std::declval<T>())) { template<class T> auto isInf(const Corrade::Containers::StridedArrayView1D<const T>& range) -> decltype(isInf(std::declval<T>())) {
if(range.empty()) return {}; if(range.isEmpty()) return {};
/* For scalars, this loop exits once any value is infinity. For vectors /* For scalars, this loop exits once any value is infinity. For vectors
the loop accumulates the bits and exits as soon as all bits are set the loop accumulates the bits and exits as soon as all bits are set
@ -115,7 +115,7 @@ returns @cpp false @ce or a @ref BoolVector with no bits set.
@see @ref isNan(T), @ref Constants::nan() @see @ref isNan(T), @ref Constants::nan()
*/ */
template<class T> inline auto isNan(const Corrade::Containers::StridedArrayView1D<const T>& range) -> decltype(isNan(std::declval<T>())) { template<class T> inline auto isNan(const Corrade::Containers::StridedArrayView1D<const T>& range) -> decltype(isNan(std::declval<T>())) {
if(range.empty()) return {}; if(range.isEmpty()) return {};
/* For scalars, this loop exits once any value is infinity. For vectors /* For scalars, this loop exits once any value is infinity. For vectors
the loop accumulates the bits and exits as soon as all bits are set the loop accumulates the bits and exits as soon as all bits are set
@ -200,7 +200,7 @@ ignored, unless the range is all <em>NaN</em>s.
@see @ref min(T, T), @ref isNan(const Corrade::Containers::StridedArrayView1D<const T>&) @see @ref min(T, T), @ref isNan(const Corrade::Containers::StridedArrayView1D<const T>&)
*/ */
template<class T> inline T min(const Corrade::Containers::StridedArrayView1D<const T>& range) { template<class T> inline T min(const Corrade::Containers::StridedArrayView1D<const T>& range) {
if(range.empty()) return {}; if(range.isEmpty()) return {};
std::pair<std::size_t, T> iOut = Implementation::firstNonNan(range, IsFloatingPoint<T>{}, IsVector<T>{}); std::pair<std::size_t, T> iOut = Implementation::firstNonNan(range, IsFloatingPoint<T>{}, IsVector<T>{});
for(++iOut.first; iOut.first != range.size(); ++iOut.first) for(++iOut.first; iOut.first != range.size(); ++iOut.first)
@ -245,7 +245,7 @@ ignored, unless the range is all <em>NaN</em>s.
@see @ref max(T, T), @ref isNan(const Corrade::Containers::StridedArrayView1D<const T>&) @see @ref max(T, T), @ref isNan(const Corrade::Containers::StridedArrayView1D<const T>&)
*/ */
template<class T> inline T max(const Corrade::Containers::StridedArrayView1D<const T>& range) { template<class T> inline T max(const Corrade::Containers::StridedArrayView1D<const T>& range) {
if(range.empty()) return {}; if(range.isEmpty()) return {};
std::pair<std::size_t, T> iOut = Implementation::firstNonNan(range, IsFloatingPoint<T>{}, IsVector<T>{}); std::pair<std::size_t, T> iOut = Implementation::firstNonNan(range, IsFloatingPoint<T>{}, IsVector<T>{});
for(++iOut.first; iOut.first != range.size(); ++iOut.first) for(++iOut.first; iOut.first != range.size(); ++iOut.first)
@ -305,7 +305,7 @@ ignored, unless the range is all <em>NaN</em>s.
@ref isNan(const Corrade::Containers::StridedArrayView1D<const T>&) @ref isNan(const Corrade::Containers::StridedArrayView1D<const T>&)
*/ */
template<class T> inline std::pair<T, T> minmax(const Corrade::Containers::StridedArrayView1D<const T>& range) { template<class T> inline std::pair<T, T> minmax(const Corrade::Containers::StridedArrayView1D<const T>& range) {
if(range.empty()) return {}; if(range.isEmpty()) return {};
std::pair<std::size_t, T> iOut = Implementation::firstNonNan(range, IsFloatingPoint<T>{}, IsVector<T>{}); std::pair<std::size_t, T> iOut = Implementation::firstNonNan(range, IsFloatingPoint<T>{}, IsVector<T>{});
T min{iOut.second}, max{iOut.second}; T min{iOut.second}, max{iOut.second};

2
src/Magnum/MeshTools/Combine.cpp

@ -112,7 +112,7 @@ Trade::MeshData combineIndexedImplementation(
} }
Trade::MeshData combineIndexedAttributes(const Containers::ArrayView<const Containers::Reference<const Trade::MeshData>> data) { Trade::MeshData combineIndexedAttributes(const Containers::ArrayView<const Containers::Reference<const Trade::MeshData>> data) {
CORRADE_ASSERT(!data.empty(), CORRADE_ASSERT(!data.isEmpty(),
"MeshTools::combineIndexedAttributes(): no meshes passed", "MeshTools::combineIndexedAttributes(): no meshes passed",
(Trade::MeshData{MeshPrimitive{}, 0})); (Trade::MeshData{MeshPrimitive{}, 0}));

8
src/Magnum/MeshTools/Concatenate.cpp

@ -95,7 +95,7 @@ Trade::MeshData concatenate(Containers::Array<char>&& indexData, const UnsignedI
Trade::MeshData out{meshes.front()->primitive(), Trade::MeshData out{meshes.front()->primitive(),
/* If the index array is empty, we're creating a non-indexed mesh (not /* If the index array is empty, we're creating a non-indexed mesh (not
an indexed mesh with zero indices) */ an indexed mesh with zero indices) */
std::move(indexData), indices.empty() ? std::move(indexData), indices.isEmpty() ?
Trade::MeshIndexData{} : Trade::MeshIndexData{indices}, Trade::MeshIndexData{} : Trade::MeshIndexData{indices},
std::move(vertexData), std::move(attributeData), vertexCount}; std::move(vertexData), std::move(attributeData), vertexCount};
/* Create an attribute map. Yes, this is an inevitable fugly thing that /* Create an attribute map. Yes, this is an inevitable fugly thing that
@ -133,7 +133,7 @@ Trade::MeshData concatenate(Containers::Array<char>&& indexData, const UnsignedI
/* Otherwise, if we need an index buffer (meaning at least one of the /* Otherwise, if we need an index buffer (meaning at least one of the
meshes is indexed), generate a trivial index buffer */ meshes is indexed), generate a trivial index buffer */
} else if(!indices.empty()) { } else if(!indices.isEmpty()) {
std::iota(indices + indexOffset, indices + indexOffset + mesh.vertexCount(), UnsignedInt(vertexOffset)); std::iota(indices + indexOffset, indices + indexOffset + mesh.vertexCount(), UnsignedInt(vertexOffset));
indexOffset += mesh.vertexCount(); indexOffset += mesh.vertexCount();
} }
@ -190,7 +190,7 @@ Trade::MeshData concatenate(Containers::Array<char>&& indexData, const UnsignedI
} }
Trade::MeshData concatenate(const Containers::ArrayView<const Containers::Reference<const Trade::MeshData>> meshes, const InterleaveFlags flags) { Trade::MeshData concatenate(const Containers::ArrayView<const Containers::Reference<const Trade::MeshData>> meshes, const InterleaveFlags flags) {
CORRADE_ASSERT(!meshes.empty(), CORRADE_ASSERT(!meshes.isEmpty(),
"MeshTools::concatenate(): expected at least one mesh", "MeshTools::concatenate(): expected at least one mesh",
(Trade::MeshData{MeshPrimitive::Points, 0})); (Trade::MeshData{MeshPrimitive::Points, 0}));
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT
@ -223,7 +223,7 @@ Trade::MeshData concatenate(const Containers::ArrayView<const Containers::Refere
Containers::Array<char> indexData{NoInit, Containers::Array<char> indexData{NoInit,
indexVertexCount.first*sizeof(UnsignedInt)}; indexVertexCount.first*sizeof(UnsignedInt)};
Containers::Array<char> vertexData{ValueInit, Containers::Array<char> vertexData{ValueInit,
attributeData.empty() ? 0 : (attributeData[0].stride()*indexVertexCount.second)}; attributeData.isEmpty() ? 0 : (attributeData[0].stride()*indexVertexCount.second)};
return Implementation::concatenate(std::move(indexData), indexVertexCount.second, std::move(vertexData), std::move(attributeData), meshes, "MeshTools::concatenate():"); return Implementation::concatenate(std::move(indexData), indexVertexCount.second, std::move(vertexData), std::move(attributeData), meshes, "MeshTools::concatenate():");
} }

4
src/Magnum/MeshTools/Concatenate.h

@ -107,7 +107,7 @@ layout from @p destination is used, all vertex/index data are taken from
@p meshes. Expects that @p meshes contains at least one item. @p meshes. Expects that @p meshes contains at least one item.
*/ */
template<template<class> class Allocator = Containers::ArrayAllocator> void concatenateInto(Trade::MeshData& destination, Containers::ArrayView<const Containers::Reference<const Trade::MeshData>> meshes, InterleaveFlags flags = InterleaveFlag::PreserveInterleavedAttributes) { template<template<class> class Allocator = Containers::ArrayAllocator> void concatenateInto(Trade::MeshData& destination, Containers::ArrayView<const Containers::Reference<const Trade::MeshData>> meshes, InterleaveFlags flags = InterleaveFlag::PreserveInterleavedAttributes) {
CORRADE_ASSERT(!meshes.empty(), CORRADE_ASSERT(!meshes.isEmpty(),
"MeshTools::concatenateInto(): no meshes passed", ); "MeshTools::concatenateInto(): no meshes passed", );
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT
for(std::size_t i = 0; i != destination.attributeCount(); ++i) { for(std::size_t i = 0; i != destination.attributeCount(); ++i) {
@ -129,7 +129,7 @@ template<template<class> class Allocator = Containers::ArrayAllocator> void conc
Containers::Array<Trade::MeshAttributeData> attributeData = Implementation::interleavedLayout(std::move(destination), {}, flags); Containers::Array<Trade::MeshAttributeData> attributeData = Implementation::interleavedLayout(std::move(destination), {}, flags);
Containers::Array<char> vertexData; Containers::Array<char> vertexData;
if(!attributeData.empty() && indexVertexCount.second) { if(!attributeData.isEmpty() && indexVertexCount.second) {
const UnsignedInt attributeStride = attributeData[0].stride(); const UnsignedInt attributeStride = attributeData[0].stride();
vertexData = destination.releaseVertexData(); vertexData = destination.releaseVertexData();
/* Resize to 0 and then to the desired size to zero-out whatever was /* Resize to 0 and then to the desired size to zero-out whatever was

2
src/Magnum/MeshTools/GenerateNormals.cpp

@ -104,7 +104,7 @@ template<class T> inline void generateSmoothNormalsIntoImplementation(const Cont
CORRADE_ASSERT(normals.size() == positions.size(), CORRADE_ASSERT(normals.size() == positions.size(),
"MeshTools::generateSmoothNormalsInto(): bad output size, expected" << positions.size() << "but got" << normals.size(), ); "MeshTools::generateSmoothNormalsInto(): bad output size, expected" << positions.size() << "but got" << normals.size(), );
if(indices.empty()) return; if(indices.isEmpty()) return;
/* Gather count of triangles for every vertex. This abuses the output /* Gather count of triangles for every vertex. This abuses the output
storage to avoid extra allocations, zero-initialize it first to avoid storage to avoid extra allocations, zero-initialize it first to avoid

4
src/Magnum/MeshTools/Interleave.cpp

@ -118,7 +118,7 @@ namespace Implementation {
Containers::Array<Trade::MeshAttributeData> interleavedLayout(Trade::MeshData&& data, const Containers::ArrayView<const Trade::MeshAttributeData> extra, const InterleaveFlags flags) { Containers::Array<Trade::MeshAttributeData> interleavedLayout(Trade::MeshData&& data, const Containers::ArrayView<const Trade::MeshAttributeData> extra, const InterleaveFlags flags) {
/* Nothing to do here, bye! */ /* Nothing to do here, bye! */
if(!data.attributeCount() && extra.empty()) return {}; if(!data.attributeCount() && extra.isEmpty()) return {};
/* If we're not told to preserve the layout, treat the mesh as /* If we're not told to preserve the layout, treat the mesh as
noninterleaved always, forcing a repack. Otherwise check if it's already noninterleaved always, forcing a repack. Otherwise check if it's already
@ -317,7 +317,7 @@ Trade::MeshData interleave(Trade::MeshData&& data, const Containers::ArrayView<c
steal that data as well */ steal that data as well */
Containers::Array<char> vertexData; Containers::Array<char> vertexData;
Containers::Array<Trade::MeshAttributeData> attributeData; Containers::Array<Trade::MeshAttributeData> attributeData;
if(interleaved && extra.empty() && (data.vertexDataFlags() & Trade::DataFlag::Owned)) { if(interleaved && extra.isEmpty() && (data.vertexDataFlags() & Trade::DataFlag::Owned)) {
attributeData = data.releaseAttributeData(); attributeData = data.releaseAttributeData();
vertexData = data.releaseVertexData(); vertexData = data.releaseVertexData();

4
src/Magnum/MeshTools/RemoveDuplicates.cpp

@ -66,7 +66,7 @@ struct ArrayHash {
std::size_t removeDuplicatesInto(const Containers::StridedArrayView2D<const char>& data, const Containers::StridedArrayView1D<UnsignedInt>& indices) { std::size_t removeDuplicatesInto(const Containers::StridedArrayView2D<const char>& data, const Containers::StridedArrayView1D<UnsignedInt>& indices) {
/* Assuming the second dimension is contiguous so we can calculate the /* Assuming the second dimension is contiguous so we can calculate the
hashes easily */ hashes easily */
CORRADE_ASSERT(data.empty()[0] || data.isContiguous<1>(), CORRADE_ASSERT(data.isEmpty()[0] || data.isContiguous<1>(),
"MeshTools::removeDuplicatesInto(): second data view dimension is not contiguous", {}); "MeshTools::removeDuplicatesInto(): second data view dimension is not contiguous", {});
const std::size_t dataSize = data.size()[0]; const std::size_t dataSize = data.size()[0];
@ -106,7 +106,7 @@ std::pair<Containers::Array<UnsignedInt>, std::size_t> removeDuplicates(const Co
std::size_t removeDuplicatesInPlaceInto(const Containers::StridedArrayView2D<char>& data, const Containers::StridedArrayView1D<UnsignedInt>& indices) { std::size_t removeDuplicatesInPlaceInto(const Containers::StridedArrayView2D<char>& data, const Containers::StridedArrayView1D<UnsignedInt>& indices) {
/* Assuming the second dimension is contiguous so we can calculate the /* Assuming the second dimension is contiguous so we can calculate the
hashes easily */ hashes easily */
CORRADE_ASSERT(data.empty()[0] || data.isContiguous<1>(), CORRADE_ASSERT(data.isEmpty()[0] || data.isContiguous<1>(),
"MeshTools::removeDuplicatesInPlaceInto(): second data view dimension is not contiguous", {}); "MeshTools::removeDuplicatesInPlaceInto(): second data view dimension is not contiguous", {});
const std::size_t dataSize = data.size()[0]; const std::size_t dataSize = data.size()[0];

8
src/Magnum/MeshTools/Test/CompileGLTest.cpp

@ -470,9 +470,9 @@ template<class T> void CompileGLTest::twoDimensions() {
Trade::MeshIndexData indices; Trade::MeshIndexData indices;
if(data.indexType) if(data.indexType)
indices = Trade::MeshIndexData{*data.indexType, Containers::stridedArrayView(Containers::arrayView(indexData).suffix(3))}; indices = Trade::MeshIndexData{*data.indexType, Containers::stridedArrayView(Containers::arrayView(indexData).exceptPrefix(3))};
else else
indices = Trade::MeshIndexData{Containers::arrayView(indexData).suffix(3)}; indices = Trade::MeshIndexData{Containers::arrayView(indexData).exceptPrefix(3)};
Trade::MeshData meshData{MeshPrimitive::Triangles, Trade::MeshData meshData{MeshPrimitive::Triangles,
{}, indexData, indices, {}, indexData, indices,
@ -704,9 +704,9 @@ template<class T> void CompileGLTest::threeDimensions() {
Trade::MeshIndexData indices; Trade::MeshIndexData indices;
if(data.indexType) if(data.indexType)
indices = Trade::MeshIndexData{*data.indexType, Containers::stridedArrayView(Containers::arrayView(indexData).suffix(3))}; indices = Trade::MeshIndexData{*data.indexType, Containers::stridedArrayView(Containers::arrayView(indexData).exceptPrefix(3))};
else else
indices = Trade::MeshIndexData{Containers::arrayView(indexData).suffix(3)}; indices = Trade::MeshIndexData{Containers::arrayView(indexData).exceptPrefix(3)};
Trade::MeshData meshData{MeshPrimitive::Triangles, Trade::MeshData meshData{MeshPrimitive::Triangles,
{}, indexData, indices, {}, indexData, indices,

2
src/Magnum/MeshTools/Test/FullScreenTriangleGLTest.cpp

@ -82,7 +82,7 @@ void FullScreenTriangleGLTest::test() {
Utility::Resource rs{"FullScreenTriangleTest"}; Utility::Resource rs{"FullScreenTriangleTest"};
GL::Shader vert = Shaders::Implementation::createCompatibilityShader(rs, version, GL::Shader::Type::Vertex); GL::Shader vert = Shaders::Implementation::createCompatibilityShader(rs, version, GL::Shader::Type::Vertex);
vert.addSource(rs.get("FullScreenTriangle.glsl")) vert.addSource(rs.getString("FullScreenTriangle.glsl"))
.addSource(R"( .addSource(R"(
void main() { void main() {
fullScreenTriangle(); fullScreenTriangle();

14
src/Magnum/MeshTools/Test/InterleaveTest.cpp

@ -536,8 +536,8 @@ void InterleaveTest::interleavedDataNotInterleaved() {
#endif #endif
Containers::Array<char> vertexData{100 + 3*20}; Containers::Array<char> vertexData{100 + 3*20};
auto positions = Containers::arrayCast<Vector2>(vertexData.suffix(100).prefix(3*8)); auto positions = Containers::arrayCast<Vector2>(vertexData.exceptPrefix(100).prefix(3*8));
auto normals = Containers::arrayCast<Vector3>(vertexData.suffix(100).suffix(3*8)); auto normals = Containers::arrayCast<Vector3>(vertexData.exceptPrefix(100+3*8));
Trade::MeshData data{MeshPrimitive::Triangles, std::move(vertexData), { Trade::MeshData data{MeshPrimitive::Triangles, std::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals}, Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals},
@ -745,7 +745,7 @@ void InterleaveTest::interleavedLayout() {
Containers::arrayCast<Vector3>(vertexData.slice(3*8, 3*20))}, Containers::arrayCast<Vector3>(vertexData.slice(3*8, 3*20))},
/* Array attribute to verify it's correctly propagated */ /* Array attribute to verify it's correctly propagated */
Trade::MeshAttributeData{Trade::meshAttributeCustom(42), Trade::MeshAttributeData{Trade::meshAttributeCustom(42),
VertexFormat::Short, Containers::StridedArrayView2D<char>{vertexData.suffix(3*20), {3, 4}}, 2} VertexFormat::Short, Containers::StridedArrayView2D<char>{vertexData.exceptPrefix(3*20), {3, 4}}, 2}
}; };
Trade::MeshIndexData indices{Containers::arrayCast<UnsignedShort>(indexData)}; Trade::MeshIndexData indices{Containers::arrayCast<UnsignedShort>(indexData)};
@ -801,7 +801,7 @@ void InterleaveTest::interleavedLayoutExtra() {
Trade::MeshAttributeData positions{Trade::MeshAttribute::Position, Trade::MeshAttributeData positions{Trade::MeshAttribute::Position,
Containers::arrayCast<Vector2>(vertexData.prefix(3*8))}; Containers::arrayCast<Vector2>(vertexData.prefix(3*8))};
Trade::MeshAttributeData normals{Trade::MeshAttribute::Normal, Trade::MeshAttributeData normals{Trade::MeshAttribute::Normal,
Containers::arrayCast<Vector3>(vertexData.suffix(3*8))}; Containers::arrayCast<Vector3>(vertexData.exceptPrefix(3*8))};
Trade::MeshData data{MeshPrimitive::Triangles, Trade::MeshData data{MeshPrimitive::Triangles,
std::move(vertexData), {positions, normals}}; std::move(vertexData), {positions, normals}};
@ -1119,7 +1119,7 @@ void InterleaveTest::interleavedLayoutRvalue() {
attributeData[0] = Trade::MeshAttributeData{Trade::MeshAttribute::Position, attributeData[0] = Trade::MeshAttributeData{Trade::MeshAttribute::Position,
Containers::arrayCast<Vector2>(vertexData.prefix(3*8))}; Containers::arrayCast<Vector2>(vertexData.prefix(3*8))};
attributeData[1] = Trade::MeshAttributeData{Trade::MeshAttribute::Normal, attributeData[1] = Trade::MeshAttributeData{Trade::MeshAttribute::Normal,
Containers::arrayCast<Vector3>(vertexData.suffix(3*8))}; Containers::arrayCast<Vector3>(vertexData.exceptPrefix(3*8))};
const void* originalAttributeData = attributeData.data(); const void* originalAttributeData = attributeData.data();
Trade::MeshIndexData indices{Containers::arrayCast<UnsignedShort>(indexData)}; Trade::MeshIndexData indices{Containers::arrayCast<UnsignedShort>(indexData)};
@ -1190,7 +1190,7 @@ void InterleaveTest::interleaveMeshDataIndexed() {
/* Testing also offset */ /* Testing also offset */
UnsignedShort indexData[50 + 3]; UnsignedShort indexData[50 + 3];
Containers::StridedArrayView1D<UnsignedShort> indices = Containers::arrayView(indexData).suffix(50); Containers::StridedArrayView1D<UnsignedShort> indices = Containers::arrayView(indexData).exceptPrefix(50);
if(data.flip) indices = indices.flipped<0>(); if(data.flip) indices = indices.flipped<0>();
Utility::copy({0, 2, 1}, indices); Utility::copy({0, 2, 1}, indices);
@ -1446,7 +1446,7 @@ void InterleaveTest::interleaveMeshDataAlreadyInterleavedMoveIndices() {
/* Testing also offset */ /* Testing also offset */
Containers::Array<char> indexData{(50 + 3)*sizeof(UnsignedShort)}; Containers::Array<char> indexData{(50 + 3)*sizeof(UnsignedShort)};
Containers::StridedArrayView1D<UnsignedShort> indices = Containers::arrayCast<UnsignedShort>(indexData).suffix(50); Containers::StridedArrayView1D<UnsignedShort> indices = Containers::arrayCast<UnsignedShort>(indexData).exceptPrefix(50);
if(data.flip) indices = indices.flipped<0>(); if(data.flip) indices = indices.flipped<0>();
Utility::copy({0, 2, 1}, indices); Utility::copy({0, 2, 1}, indices);

2
src/Magnum/MeshTools/Test/ReferenceTest.cpp

@ -299,7 +299,7 @@ void ReferenceTest::ownedStridedIndices() {
const UnsignedShort indices[7]{0, 3, 0, 7, 0, 15, 0}; const UnsignedShort indices[7]{0, 3, 0, 7, 0, 15, 0};
Trade::MeshData stuff{MeshPrimitive::Points, Trade::MeshData stuff{MeshPrimitive::Points,
{}, indices, Trade::MeshIndexData{data.type, Containers::stridedArrayView(indices).suffix(1).every(2)}, {}, indices, Trade::MeshIndexData{data.type, Containers::stridedArrayView(indices).exceptPrefix(1).every(2)},
16}; 16};
/* The full index data layout including whatever format should be /* The full index data layout including whatever format should be

2
src/Magnum/MeshTools/Tipsify.cpp

@ -115,7 +115,7 @@ template<class T> void tipsifyInPlaceImplementation(const Containers::StridedArr
/* On dead-end */ /* On dead-end */
if(fanningVertex == 0xFFFFFFFFu) { if(fanningVertex == 0xFFFFFFFFu) {
/* Find vertex with live triangles in dead-end stack */ /* Find vertex with live triangles in dead-end stack */
while(!deadEndStack.empty()) { while(!deadEndStack.isEmpty()) {
UnsignedInt d = deadEndStack.back(); UnsignedInt d = deadEndStack.back();
arrayRemoveSuffix(deadEndStack); arrayRemoveSuffix(deadEndStack);

2
src/Magnum/Platform/EmscriptenApplication.cpp

@ -145,7 +145,7 @@ namespace {
/* Numpad keys */ /* Numpad keys */
} else if(codeView.hasPrefix(numpad)) { } else if(codeView.hasPrefix(numpad)) {
const Containers::StringView numKey = codeView.suffix(numpad.size()); const Containers::StringView numKey = codeView.exceptPrefix(numpad.size());
if(numKey == "Add"_s) return Key::NumAdd; if(numKey == "Add"_s) return Key::NumAdd;
if(numKey == "Decimal"_s) return Key::NumDecimal; if(numKey == "Decimal"_s) return Key::NumDecimal;
if(numKey == "Divide"_s) return Key::NumDivide; if(numKey == "Divide"_s) return Key::NumDivide;

2
src/Magnum/Primitives/Implementation/WireframeSpheroid.cpp

@ -36,7 +36,7 @@ namespace Magnum { namespace Primitives { namespace Implementation {
WireframeSpheroid::WireframeSpheroid(const UnsignedInt segments): _segments(segments) {} WireframeSpheroid::WireframeSpheroid(const UnsignedInt segments): _segments(segments) {}
void WireframeSpheroid::bottomHemisphere(const Float endY, const UnsignedInt rings) { void WireframeSpheroid::bottomHemisphere(const Float endY, const UnsignedInt rings) {
CORRADE_INTERNAL_ASSERT(_vertexData.empty()); CORRADE_INTERNAL_ASSERT(_vertexData.isEmpty());
/* Initial vertex */ /* Initial vertex */
Containers::arrayAppend<Trade::ArrayAllocator>(_vertexData, Containers::arrayAppend<Trade::ArrayAllocator>(_vertexData,

8
src/Magnum/SceneTools/Implementation/convertToSingleFunctionObjects.h

@ -179,8 +179,8 @@ inline Trade::SceneData convertToSingleFunctionObjects(const Trade::SceneData& s
} }
/* List new objects at the end of the extended parent field */ /* List new objects at the end of the extended parent field */
const Containers::StridedArrayView1D<UnsignedInt> newParentMapping = outParentMapping.suffix(scene.fieldSize(parentFieldId)); const Containers::StridedArrayView1D<UnsignedInt> newParentMapping = outParentMapping.exceptPrefix(scene.fieldSize(parentFieldId));
const Containers::StridedArrayView1D<Int> newParents = outParents.suffix(scene.fieldSize(parentFieldId)); const Containers::StridedArrayView1D<Int> newParents = outParents.exceptPrefix(scene.fieldSize(parentFieldId));
for(std::size_t i = 0; i != newParentMapping.size(); ++i) { for(std::size_t i = 0; i != newParentMapping.size(); ++i) {
newParentMapping[i] = newObjectOffset + i; newParentMapping[i] = newObjectOffset + i;
newParents[i] = -1; newParents[i] = -1;
@ -221,8 +221,8 @@ inline Trade::SceneData convertToSingleFunctionObjects(const Trade::SceneData& s
/* Views to put the mapping to and copy the data to */ /* Views to put the mapping to and copy the data to */
const std::size_t newFieldToCopyOffset = scene.fieldSize(*fieldToCopyId); const std::size_t newFieldToCopyOffset = scene.fieldSize(*fieldToCopyId);
const Containers::StridedArrayView1D<UnsignedInt> newFieldToCopyMapping = out.mutableMapping<UnsignedInt>(*fieldToCopyId).suffix(newFieldToCopyOffset); const Containers::StridedArrayView1D<UnsignedInt> newFieldToCopyMapping = out.mutableMapping<UnsignedInt>(*fieldToCopyId).exceptPrefix(newFieldToCopyOffset);
const Containers::StridedArrayView2D<char> newFieldToCopy = out.mutableField(*fieldToCopyId).suffix(newFieldToCopyOffset); const Containers::StridedArrayView2D<char> newFieldToCopy = out.mutableField(*fieldToCopyId).exceptPrefix(newFieldToCopyOffset);
/* As long as there are entries attached to the /* As long as there are entries attached to the
original objects, copy them */ original objects, copy them */

32
src/Magnum/SceneTools/Test/FlattenMeshHierarchyTest.cpp

@ -173,31 +173,31 @@ void FlattenMeshHierarchyTest::test2D() {
Trade::SceneFieldData{Trade::SceneField::Parent, Trade::SceneFieldData{Trade::SceneField::Parent,
Containers::stridedArrayView(data->parents) Containers::stridedArrayView(data->parents)
.slice(&Data::Parent::object) .slice(&Data::Parent::object)
.except(instanceData.parentsToExclude), .exceptSuffix(instanceData.parentsToExclude),
Containers::stridedArrayView(data->parents) Containers::stridedArrayView(data->parents)
.slice(&Data::Parent::parent) .slice(&Data::Parent::parent)
.except(instanceData.parentsToExclude)}, .exceptSuffix(instanceData.parentsToExclude)},
Trade::SceneFieldData{Trade::SceneField::Transformation, Trade::SceneFieldData{Trade::SceneField::Transformation,
Containers::stridedArrayView(data->transforms) Containers::stridedArrayView(data->transforms)
.slice(&Data::Transformation::object) .slice(&Data::Transformation::object)
.except(instanceData.transformationsToExclude), .exceptSuffix(instanceData.transformationsToExclude),
Containers::stridedArrayView(data->transforms) Containers::stridedArrayView(data->transforms)
.slice(&Data::Transformation::transformation) .slice(&Data::Transformation::transformation)
.except(instanceData.transformationsToExclude)}, .exceptSuffix(instanceData.transformationsToExclude)},
Trade::SceneFieldData{Trade::SceneField::Mesh, Trade::SceneFieldData{Trade::SceneField::Mesh,
Containers::stridedArrayView(data->meshes) Containers::stridedArrayView(data->meshes)
.slice(&Data::Mesh::object) .slice(&Data::Mesh::object)
.suffix(instanceData.meshesToExclude), .exceptPrefix(instanceData.meshesToExclude),
Containers::stridedArrayView(data->meshes) Containers::stridedArrayView(data->meshes)
.slice(&Data::Mesh::mesh) .slice(&Data::Mesh::mesh)
.suffix(instanceData.meshesToExclude)}, .exceptPrefix(instanceData.meshesToExclude)},
Trade::SceneFieldData{Trade::SceneField::MeshMaterial, Trade::SceneFieldData{Trade::SceneField::MeshMaterial,
Containers::stridedArrayView(data->meshes) Containers::stridedArrayView(data->meshes)
.slice(&Data::Mesh::object) .slice(&Data::Mesh::object)
.suffix(instanceData.meshesToExclude), .exceptPrefix(instanceData.meshesToExclude),
Containers::stridedArrayView(data->meshes) Containers::stridedArrayView(data->meshes)
.slice(&Data::Mesh::meshMaterial) .slice(&Data::Mesh::meshMaterial)
.suffix(instanceData.meshesToExclude)}, .exceptPrefix(instanceData.meshesToExclude)},
}}; }};
Containers::Array<Containers::Triple<UnsignedInt, Int, Matrix3>> out; Containers::Array<Containers::Triple<UnsignedInt, Int, Matrix3>> out;
@ -313,31 +313,31 @@ void FlattenMeshHierarchyTest::test3D() {
Trade::SceneFieldData{Trade::SceneField::Parent, Trade::SceneFieldData{Trade::SceneField::Parent,
Containers::stridedArrayView(data->parents) Containers::stridedArrayView(data->parents)
.slice(&Data::Parent::object) .slice(&Data::Parent::object)
.except(instanceData.parentsToExclude), .exceptSuffix(instanceData.parentsToExclude),
Containers::stridedArrayView(data->parents) Containers::stridedArrayView(data->parents)
.slice(&Data::Parent::parent) .slice(&Data::Parent::parent)
.except(instanceData.parentsToExclude)}, .exceptSuffix(instanceData.parentsToExclude)},
Trade::SceneFieldData{Trade::SceneField::Transformation, Trade::SceneFieldData{Trade::SceneField::Transformation,
Containers::stridedArrayView(data->transforms) Containers::stridedArrayView(data->transforms)
.slice(&Data::Transformation::object) .slice(&Data::Transformation::object)
.except(instanceData.transformationsToExclude), .exceptSuffix(instanceData.transformationsToExclude),
Containers::stridedArrayView(data->transforms) Containers::stridedArrayView(data->transforms)
.slice(&Data::Transformation::transformation) .slice(&Data::Transformation::transformation)
.except(instanceData.transformationsToExclude)}, .exceptSuffix(instanceData.transformationsToExclude)},
Trade::SceneFieldData{Trade::SceneField::Mesh, Trade::SceneFieldData{Trade::SceneField::Mesh,
Containers::stridedArrayView(data->meshes) Containers::stridedArrayView(data->meshes)
.slice(&Data::Mesh::object) .slice(&Data::Mesh::object)
.suffix(instanceData.meshesToExclude), .exceptPrefix(instanceData.meshesToExclude),
Containers::stridedArrayView(data->meshes) Containers::stridedArrayView(data->meshes)
.slice(&Data::Mesh::mesh) .slice(&Data::Mesh::mesh)
.suffix(instanceData.meshesToExclude)}, .exceptPrefix(instanceData.meshesToExclude)},
Trade::SceneFieldData{Trade::SceneField::MeshMaterial, Trade::SceneFieldData{Trade::SceneField::MeshMaterial,
Containers::stridedArrayView(data->meshes) Containers::stridedArrayView(data->meshes)
.slice(&Data::Mesh::object) .slice(&Data::Mesh::object)
.suffix(instanceData.meshesToExclude), .exceptPrefix(instanceData.meshesToExclude),
Containers::stridedArrayView(data->meshes) Containers::stridedArrayView(data->meshes)
.slice(&Data::Mesh::meshMaterial) .slice(&Data::Mesh::meshMaterial)
.suffix(instanceData.meshesToExclude)}, .exceptPrefix(instanceData.meshesToExclude)},
}}; }};
Containers::Array<Containers::Triple<UnsignedInt, Int, Matrix4>> out; Containers::Array<Containers::Triple<UnsignedInt, Int, Matrix4>> out;

8
src/Magnum/ShaderTools/AbstractConverter.cpp

@ -425,7 +425,7 @@ Containers::Array<char> AbstractConverter::linkDataToData(const Containers::Arra
"ShaderTools::AbstractConverter::linkDataToData(): feature not supported", {}); "ShaderTools::AbstractConverter::linkDataToData(): feature not supported", {});
CORRADE_ASSERT(!(_flags & ConverterFlag::PreprocessOnly), CORRADE_ASSERT(!(_flags & ConverterFlag::PreprocessOnly),
"ShaderTools::AbstractConverter::linkDataToData(): PreprocessOnly is not allowed in combination with linking", {}); "ShaderTools::AbstractConverter::linkDataToData(): PreprocessOnly is not allowed in combination with linking", {});
CORRADE_ASSERT(!data.empty(), CORRADE_ASSERT(!data.isEmpty(),
"ShaderTools::AbstractConverter::linkDataToData(): no data passed", {}); "ShaderTools::AbstractConverter::linkDataToData(): no data passed", {});
/* Cast to a non-void type for more convenience */ /* Cast to a non-void type for more convenience */
@ -448,7 +448,7 @@ bool AbstractConverter::linkDataToFile(const Containers::ArrayView<const std::pa
"ShaderTools::AbstractConverter::linkDataToFile(): feature not supported", {}); "ShaderTools::AbstractConverter::linkDataToFile(): feature not supported", {});
CORRADE_ASSERT(!(_flags & ConverterFlag::PreprocessOnly), CORRADE_ASSERT(!(_flags & ConverterFlag::PreprocessOnly),
"ShaderTools::AbstractConverter::linkDataToFile(): PreprocessOnly is not allowed in combination with linking", {}); "ShaderTools::AbstractConverter::linkDataToFile(): PreprocessOnly is not allowed in combination with linking", {});
CORRADE_ASSERT(!data.empty(), CORRADE_ASSERT(!data.isEmpty(),
"ShaderTools::AbstractConverter::linkDataToFile(): no data passed", {}); "ShaderTools::AbstractConverter::linkDataToFile(): no data passed", {});
/** @todo this needs expansion once output callbacks are supported as well */ /** @todo this needs expansion once output callbacks are supported as well */
@ -509,7 +509,7 @@ bool AbstractConverter::linkFilesToFile(const Containers::ArrayView<const std::p
"ShaderTools::AbstractConverter::linkFilesToFile(): feature not supported", {}); "ShaderTools::AbstractConverter::linkFilesToFile(): feature not supported", {});
CORRADE_ASSERT(!(_flags & ConverterFlag::PreprocessOnly), CORRADE_ASSERT(!(_flags & ConverterFlag::PreprocessOnly),
"ShaderTools::AbstractConverter::linkFilesToFile(): PreprocessOnly is not allowed in combination with linking", {}); "ShaderTools::AbstractConverter::linkFilesToFile(): PreprocessOnly is not allowed in combination with linking", {});
CORRADE_ASSERT(!from.empty(), CORRADE_ASSERT(!from.isEmpty(),
"ShaderTools::AbstractConverter::linkFilesToFile(): no files passed", {}); "ShaderTools::AbstractConverter::linkFilesToFile(): no files passed", {});
/** @todo this needs expansion once output callbacks are supported as well */ /** @todo this needs expansion once output callbacks are supported as well */
@ -601,7 +601,7 @@ Containers::Array<char> AbstractConverter::linkFilesToData(const Containers::Arr
"ShaderTools::AbstractConverter::linkFilesToData(): feature not supported", {}); "ShaderTools::AbstractConverter::linkFilesToData(): feature not supported", {});
CORRADE_ASSERT(!(_flags & ConverterFlag::PreprocessOnly), CORRADE_ASSERT(!(_flags & ConverterFlag::PreprocessOnly),
"ShaderTools::AbstractConverter::linkFilesToData(): PreprocessOnly is not allowed in combination with linking", {}); "ShaderTools::AbstractConverter::linkFilesToData(): PreprocessOnly is not allowed in combination with linking", {});
CORRADE_ASSERT(!filenames.empty(), CORRADE_ASSERT(!filenames.isEmpty(),
"ShaderTools::AbstractConverter::linkFilesToData(): no files passed", {}); "ShaderTools::AbstractConverter::linkFilesToData(): no files passed", {});
Containers::Array<char> out; Containers::Array<char> out;

10
src/Magnum/ShaderTools/Implementation/spirv.h

@ -51,7 +51,7 @@ Containers::ArrayView<const UnsignedInt> spirvData(const void* code, UnsignedInt
const UnsignedInt* const spirv = static_cast<const UnsignedInt*>(code); const UnsignedInt* const spirv = static_cast<const UnsignedInt*>(code);
/* Not >= 5*4 because just the header alone is useless also */ /* Not >= 5*4 because just the header alone is useless also */
return size % 4 == 0 && size > 5*4 && spirv[0] == SpvMagicNumber ? return size % 4 == 0 && size > 5*4 && spirv[0] == SpvMagicNumber ?
Containers::ArrayView<const UnsignedInt>{spirv, size/4}.suffix(5) : nullptr; Containers::ArrayView<const UnsignedInt>{spirv, size/4}.exceptPrefix(5) : nullptr;
} }
/* When an instruction is found, the `data` is advanced after it in order to /* When an instruction is found, the `data` is advanced after it in order to
@ -61,7 +61,7 @@ Containers::ArrayView<const UnsignedInt> spirvFindInstruction(Containers::ArrayV
/* Copy the view and iterate that. If we find the instruction, update the /* Copy the view and iterate that. If we find the instruction, update the
passed `data` reference, if not, keep it as it was -- that way, if the passed `data` reference, if not, keep it as it was -- that way, if the
find fails, `data` won't become empty and can be used further */ find fails, `data` won't become empty and can be used further */
for(Containers::ArrayView<const UnsignedInt> dataIteration = data; !dataIteration.empty(); ) { for(Containers::ArrayView<const UnsignedInt> dataIteration = data; !dataIteration.isEmpty(); ) {
const UnsignedInt instructionSize = dataIteration[0] >> 16; const UnsignedInt instructionSize = dataIteration[0] >> 16;
const UnsignedInt instructionOp = dataIteration[0] & 0xffff; const UnsignedInt instructionOp = dataIteration[0] & 0xffff;
@ -75,12 +75,12 @@ Containers::ArrayView<const UnsignedInt> spirvFindInstruction(Containers::ArrayV
/* This is the instruction we're looking for, return it and update the /* This is the instruction we're looking for, return it and update the
view to point after it. */ view to point after it. */
if(instructionOp == op) { if(instructionOp == op) {
data = dataIteration.suffix(instructionSize); data = dataIteration.exceptPrefix(instructionSize);
return dataIteration.prefix(instructionSize); return dataIteration.prefix(instructionSize);
} }
/* Otherwise advance the view for next round */ /* Otherwise advance the view for next round */
dataIteration = dataIteration.suffix(instructionSize); dataIteration = dataIteration.exceptPrefix(instructionSize);
} }
/* Nothing found. Leave the input data as-is. */ /* Nothing found. Leave the input data as-is. */
@ -112,7 +112,7 @@ Containers::Optional<SpirvEntrypoint> spirvNextEntrypoint(Containers::ArrayView<
Containers::ArrayView<const UnsignedInt> interfaces; Containers::ArrayView<const UnsignedInt> interfaces;
for(std::size_t i = 3; i != entryPoint.size(); ++i) { for(std::size_t i = 3; i != entryPoint.size(); ++i) {
if(entryPoint[i] >> 24 == 0) { if(entryPoint[i] >> 24 == 0) {
interfaces = entryPoint.suffix(i + 1); interfaces = entryPoint.exceptPrefix(i + 1);
break; break;
} }
} }

4
src/Magnum/ShaderTools/Test/SpirvTest.cpp

@ -73,7 +73,7 @@ const struct {
/* GCC 4.8 needs the ArrayView conversion explicit */ /* GCC 4.8 needs the ArrayView conversion explicit */
{"just the header", Containers::arrayView(JustHeader)}, {"just the header", Containers::arrayView(JustHeader)},
{"invalid magic", Containers::arrayView(InvalidMagic)}, {"invalid magic", Containers::arrayView(InvalidMagic)},
{"size not divisible by four", Containers::arrayCast<const char>(Data).except(1)} {"size not divisible by four", Containers::arrayCast<const char>(Data).exceptSuffix(1)}
}; };
SpirvTest::SpirvTest() { SpirvTest::SpirvTest() {
@ -254,7 +254,7 @@ void SpirvTest::entrypointInterfaceNothing() {
Containers::Optional<Implementation::SpirvEntrypoint> comp = Implementation::spirvNextEntrypoint(view); Containers::Optional<Implementation::SpirvEntrypoint> comp = Implementation::spirvNextEntrypoint(view);
CORRADE_VERIFY(comp); CORRADE_VERIFY(comp);
CORRADE_VERIFY(comp->interfaces.empty()); CORRADE_VERIFY(comp->interfaces.isEmpty());
Implementation::spirvEntrypointInterface(view, *comp, {}); Implementation::spirvEntrypointInterface(view, *comp, {});

8
src/Magnum/Shaders/DistanceFieldVectorGL.cpp

@ -126,8 +126,8 @@ template<UnsignedInt dimensions> DistanceFieldVectorGL<dimensions>::DistanceFiel
vert.addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : ""); vert.addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : "");
} }
#endif #endif
vert.addSource(rs.get("generic.glsl")) vert.addSource(rs.getString("generic.glsl"))
.addSource(rs.get("Vector.vert")); .addSource(rs.getString("Vector.vert"));
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
if(flags >= Flag::UniformBuffers) { if(flags >= Flag::UniformBuffers) {
frag.addSource(Utility::formatString( frag.addSource(Utility::formatString(
@ -139,8 +139,8 @@ template<UnsignedInt dimensions> DistanceFieldVectorGL<dimensions>::DistanceFiel
frag.addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : ""); frag.addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : "");
} }
#endif #endif
frag.addSource(rs.get("generic.glsl")) frag.addSource(rs.getString("generic.glsl"))
.addSource(rs.get("DistanceFieldVector.frag")); .addSource(rs.getString("DistanceFieldVector.frag"));
CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag})); CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag}));

8
src/Magnum/Shaders/FlatGL.cpp

@ -167,8 +167,8 @@ template<UnsignedInt dimensions> FlatGL<dimensions>::FlatGL(const Flags flags
vert.addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : ""); vert.addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : "");
} }
#endif #endif
vert.addSource(rs.get("generic.glsl")) vert.addSource(rs.getString("generic.glsl"))
.addSource(rs.get("Flat.vert")); .addSource(rs.getString("Flat.vert"));
frag.addSource(flags & Flag::Textured ? "#define TEXTURED\n" : "") frag.addSource(flags & Flag::Textured ? "#define TEXTURED\n" : "")
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
.addSource(flags & Flag::TextureArrays ? "#define TEXTURE_ARRAYS\n" : "") .addSource(flags & Flag::TextureArrays ? "#define TEXTURE_ARRAYS\n" : "")
@ -192,8 +192,8 @@ template<UnsignedInt dimensions> FlatGL<dimensions>::FlatGL(const Flags flags
frag.addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : ""); frag.addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : "");
} }
#endif #endif
frag.addSource(rs.get("generic.glsl")) frag.addSource(rs.getString("generic.glsl"))
.addSource(rs.get("Flat.frag")); .addSource(rs.getString("Flat.frag"));
CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag})); CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag}));

4
src/Magnum/Shaders/Implementation/CreateCompatibilityShader.h

@ -25,6 +25,8 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#include <Corrade/Containers/StringStl.h> /** @todo remove when Shader is <string>-free */
#include <Corrade/Containers/StringView.h>
#include <Corrade/Utility/Resource.h> #include <Corrade/Utility/Resource.h>
#include "Magnum/GL/Context.h" #include "Magnum/GL/Context.h"
@ -65,7 +67,7 @@ inline GL::Shader createCompatibilityShader(const Utility::Resource& rs, GL::Ver
shader.addSource("#ifndef GL_ES\n#define GL_ES 1\n#endif\n"); shader.addSource("#ifndef GL_ES\n#define GL_ES 1\n#endif\n");
#endif #endif
shader.addSource(rs.get("compatibility.glsl")); shader.addSource(rs.getString("compatibility.glsl"));
return shader; return shader;
} }

20
src/Magnum/Shaders/MeshVisualizerGL.cpp

@ -424,8 +424,8 @@ MeshVisualizerGL2D::MeshVisualizerGL2D(const Flags flags
the shader code */ the shader code */
.addSource((flags & Flag::NoGeometryShader) || !(flags & Flag::Wireframe) ? .addSource((flags & Flag::NoGeometryShader) || !(flags & Flag::Wireframe) ?
"#define NO_GEOMETRY_SHADER\n" : "") "#define NO_GEOMETRY_SHADER\n" : "")
.addSource(rs.get("generic.glsl")) .addSource(rs.getString("generic.glsl"))
.addSource(rs.get("MeshVisualizer.vert")); .addSource(rs.getString("MeshVisualizer.vert"));
frag frag
/* Pass NO_GEOMETRY_SHADER not only when NoGeometryShader but also when /* Pass NO_GEOMETRY_SHADER not only when NoGeometryShader but also when
nothing actually needs it, as that makes checks much simpler in nothing actually needs it, as that makes checks much simpler in
@ -436,8 +436,8 @@ MeshVisualizerGL2D::MeshVisualizerGL2D(const Flags flags
if(flags >= Flag::UniformBuffers) if(flags >= Flag::UniformBuffers)
frag.addSource("#define TWO_DIMENSIONS\n"); frag.addSource("#define TWO_DIMENSIONS\n");
#endif #endif
frag.addSource(rs.get("generic.glsl")) frag.addSource(rs.getString("generic.glsl"))
.addSource(rs.get("MeshVisualizer.frag")); .addSource(rs.getString("MeshVisualizer.frag"));
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Containers::Optional<GL::Shader> geom; Containers::Optional<GL::Shader> geom;
@ -466,7 +466,7 @@ MeshVisualizerGL2D::MeshVisualizerGL2D(const Flags flags
geom->addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : ""); geom->addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : "");
} }
#endif #endif
geom->addSource(rs.get("MeshVisualizer.geom")); geom->addSource(rs.getString("MeshVisualizer.geom"));
} }
#else #else
static_cast<void>(version); static_cast<void>(version);
@ -745,8 +745,8 @@ MeshVisualizerGL3D::MeshVisualizerGL3D(const Flags flags
.addSource(flags & Flag::NormalDirection ? "#define NORMAL_DIRECTION\n" : "") .addSource(flags & Flag::NormalDirection ? "#define NORMAL_DIRECTION\n" : "")
#endif #endif
; ;
vert.addSource(rs.get("generic.glsl")) vert.addSource(rs.getString("generic.glsl"))
.addSource(rs.get("MeshVisualizer.vert")); .addSource(rs.getString("MeshVisualizer.vert"));
frag frag
/* Pass NO_GEOMETRY_SHADER not only when NoGeometryShader but also when /* Pass NO_GEOMETRY_SHADER not only when NoGeometryShader but also when
nothing actually needs it, as that makes checks much simpler in nothing actually needs it, as that makes checks much simpler in
@ -764,8 +764,8 @@ MeshVisualizerGL3D::MeshVisualizerGL3D(const Flags flags
if(flags >= Flag::UniformBuffers) if(flags >= Flag::UniformBuffers)
frag.addSource("#define THREE_DIMENSIONS\n"); frag.addSource("#define THREE_DIMENSIONS\n");
#endif #endif
frag.addSource(rs.get("generic.glsl")) frag.addSource(rs.getString("generic.glsl"))
.addSource(rs.get("MeshVisualizer.frag")); .addSource(rs.getString("MeshVisualizer.frag"));
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Containers::Optional<GL::Shader> geom; Containers::Optional<GL::Shader> geom;
@ -805,7 +805,7 @@ MeshVisualizerGL3D::MeshVisualizerGL3D(const Flags flags
geom->addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : ""); geom->addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : "");
} }
#endif #endif
geom->addSource(rs.get("MeshVisualizer.geom")); geom->addSource(rs.getString("MeshVisualizer.geom"));
} }
#else #else
static_cast<void>(version); static_cast<void>(version);

8
src/Magnum/Shaders/PhongGL.cpp

@ -243,8 +243,8 @@ PhongGL::PhongGL(const Flags flags, const UnsignedInt lightCount
vert.addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : ""); vert.addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : "");
} }
#endif #endif
vert.addSource(rs.get("generic.glsl")) vert.addSource(rs.getString("generic.glsl"))
.addSource(rs.get("Phong.vert")); .addSource(rs.getString("Phong.vert"));
frag.addSource(flags & Flag::AmbientTexture ? "#define AMBIENT_TEXTURE\n" : "") frag.addSource(flags & Flag::AmbientTexture ? "#define AMBIENT_TEXTURE\n" : "")
.addSource(flags & Flag::DiffuseTexture ? "#define DIFFUSE_TEXTURE\n" : "") .addSource(flags & Flag::DiffuseTexture ? "#define DIFFUSE_TEXTURE\n" : "")
.addSource(flags & Flag::SpecularTexture ? "#define SPECULAR_TEXTURE\n" : "") .addSource(flags & Flag::SpecularTexture ? "#define SPECULAR_TEXTURE\n" : "")
@ -291,8 +291,8 @@ PhongGL::PhongGL(const Flags flags, const UnsignedInt lightCount
if(!(flags >= Flag::UniformBuffers) && lightCount) if(!(flags >= Flag::UniformBuffers) && lightCount)
frag.addSource(std::move(lightInitializer)); frag.addSource(std::move(lightInitializer));
#endif #endif
frag.addSource(rs.get("generic.glsl")) frag.addSource(rs.getString("generic.glsl"))
.addSource(rs.get("Phong.frag")); .addSource(rs.getString("Phong.frag"));
CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag})); CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag}));

8
src/Magnum/Shaders/VectorGL.cpp

@ -125,8 +125,8 @@ template<UnsignedInt dimensions> VectorGL<dimensions>::VectorGL(const Flags flag
vert.addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : ""); vert.addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : "");
} }
#endif #endif
vert.addSource(rs.get("generic.glsl")) vert.addSource(rs.getString("generic.glsl"))
.addSource(rs.get("Vector.vert")); .addSource(rs.getString("Vector.vert"));
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
if(flags >= Flag::UniformBuffers) { if(flags >= Flag::UniformBuffers) {
frag.addSource(Utility::formatString( frag.addSource(Utility::formatString(
@ -138,8 +138,8 @@ template<UnsignedInt dimensions> VectorGL<dimensions>::VectorGL(const Flags flag
frag.addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : ""); frag.addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : "");
} }
#endif #endif
frag.addSource(rs.get("generic.glsl")) frag.addSource(rs.getString("generic.glsl"))
.addSource(rs.get("Vector.frag")); .addSource(rs.getString("Vector.frag"));
CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag})); CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag}));

8
src/Magnum/Shaders/VertexColorGL.cpp

@ -116,10 +116,10 @@ template<UnsignedInt dimensions> VertexColorGL<dimensions>::VertexColorGL(const
vert.addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : ""); vert.addSource(flags >= Flag::MultiDraw ? "#define MULTI_DRAW\n" : "");
} }
#endif #endif
vert.addSource(rs.get("generic.glsl")) vert.addSource(rs.getString("generic.glsl"))
.addSource(rs.get("VertexColor.vert")); .addSource(rs.getString("VertexColor.vert"));
frag.addSource(rs.get("generic.glsl")) frag.addSource(rs.getString("generic.glsl"))
.addSource(rs.get("VertexColor.frag")); .addSource(rs.getString("VertexColor.frag"));
CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag})); CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag}));

6
src/Magnum/TextureTools/DistanceField.cpp

@ -99,10 +99,10 @@ DistanceFieldShader::DistanceFieldShader(const UnsignedInt radius) {
GL::Shader vert = Shaders::Implementation::createCompatibilityShader(rs, v, GL::Shader::Type::Vertex); GL::Shader vert = Shaders::Implementation::createCompatibilityShader(rs, v, GL::Shader::Type::Vertex);
GL::Shader frag = Shaders::Implementation::createCompatibilityShader(rs, v, GL::Shader::Type::Fragment); GL::Shader frag = Shaders::Implementation::createCompatibilityShader(rs, v, GL::Shader::Type::Fragment);
vert.addSource(rs.get("FullScreenTriangle.glsl")) vert.addSource(rs.getString("FullScreenTriangle.glsl"))
.addSource(rs.get("DistanceFieldShader.vert")); .addSource(rs.getString("DistanceFieldShader.vert"));
frag.addSource(Utility::formatString("#define RADIUS {}\n", radius)) frag.addSource(Utility::formatString("#define RADIUS {}\n", radius))
.addSource(rs.get("DistanceFieldShader.frag")); .addSource(rs.getString("DistanceFieldShader.frag"));
CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag})); CORRADE_INTERNAL_ASSERT_OUTPUT(GL::Shader::compile({vert, frag}));

4
src/Magnum/Trade/AbstractImageConverter.cpp

@ -439,7 +439,7 @@ Containers::Array<char> AbstractImageConverter::convertToData(const ImageData3D&
namespace { namespace {
template<UnsignedInt dimensions> bool checkImageValidity(const char* const messagePrefix, const Containers::ArrayView<const BasicImageView<dimensions>> imageLevels) { template<UnsignedInt dimensions> bool checkImageValidity(const char* const messagePrefix, const Containers::ArrayView<const BasicImageView<dimensions>> imageLevels) {
CORRADE_ASSERT(!imageLevels.empty(), CORRADE_ASSERT(!imageLevels.isEmpty(),
messagePrefix << "at least one image has to be specified", false); messagePrefix << "at least one image has to be specified", false);
const PixelFormat format = imageLevels[0].format(); const PixelFormat format = imageLevels[0].format();
@ -462,7 +462,7 @@ template<UnsignedInt dimensions> bool checkImageValidity(const char* const messa
} }
template<UnsignedInt dimensions> bool checkImageValidity(const char* const messagePrefix, const Containers::ArrayView<const BasicCompressedImageView<dimensions>> imageLevels) { template<UnsignedInt dimensions> bool checkImageValidity(const char* const messagePrefix, const Containers::ArrayView<const BasicCompressedImageView<dimensions>> imageLevels) {
CORRADE_ASSERT(!imageLevels.empty(), CORRADE_ASSERT(!imageLevels.isEmpty(),
messagePrefix << "at least one image has to be specified", false); messagePrefix << "at least one image has to be specified", false);
const CompressedPixelFormat format = imageLevels[0].format(); const CompressedPixelFormat format = imageLevels[0].format();

10
src/Magnum/Trade/AbstractImporter.cpp

@ -562,7 +562,7 @@ void AbstractImporter::populateCachedScenes() {
Not ideal, especially regarding the 3D assumption, but better than Not ideal, especially regarding the 3D assumption, but better than
nothing. */ nothing. */
if(!_cachedScenes->scenes.empty() && !_cachedScenes->object2DCount && !_cachedScenes->object3DCount) if(!_cachedScenes->scenes.isEmpty() && !_cachedScenes->object2DCount && !_cachedScenes->object3DCount)
_cachedScenes->object3DCount = objectCount(); _cachedScenes->object3DCount = objectCount();
} }
@ -698,12 +698,12 @@ Containers::Pointer<ObjectData2D> AbstractImporter::doObject2D(const UnsignedInt
in which order we decide on the legacy object type. */ in which order we decide on the legacy object type. */
CORRADE_INTERNAL_ASSERT(camera.size() + mesh.size() <= 1); CORRADE_INTERNAL_ASSERT(camera.size() + mesh.size() <= 1);
if(!mesh.empty()) { if(!mesh.isEmpty()) {
return Containers::pointer(flags & ObjectFlag2D::HasTranslationRotationScaling ? return Containers::pointer(flags & ObjectFlag2D::HasTranslationRotationScaling ?
new MeshObjectData2D{std::move(children), new MeshObjectData2D{std::move(children),
trs->first(), trs->second(), trs->third(), trs->first(), trs->second(), trs->third(),
mesh.front().first(), mesh.front().second(), mesh.front().first(), mesh.front().second(),
skin.empty() ? -1 : Int(skin.front()), skin.isEmpty() ? -1 : Int(skin.front()),
importerState ? *importerState : nullptr} : importerState ? *importerState : nullptr} :
new MeshObjectData2D{std::move(children), new MeshObjectData2D{std::move(children),
*transformation, *transformation,
@ -877,12 +877,12 @@ Containers::Pointer<ObjectData3D> AbstractImporter::doObject3D(const UnsignedInt
doesn't matter in which order we decide on the legacy object type. */ doesn't matter in which order we decide on the legacy object type. */
CORRADE_INTERNAL_ASSERT(camera.size() + light.size() + mesh.size() <= 1); CORRADE_INTERNAL_ASSERT(camera.size() + light.size() + mesh.size() <= 1);
if(!mesh.empty()) { if(!mesh.isEmpty()) {
return Containers::pointer(flags & ObjectFlag3D::HasTranslationRotationScaling ? return Containers::pointer(flags & ObjectFlag3D::HasTranslationRotationScaling ?
new MeshObjectData3D{std::move(children), new MeshObjectData3D{std::move(children),
trs->first(), trs->second(), trs->third(), trs->first(), trs->second(), trs->third(),
mesh.front().first(), mesh.front().second(), mesh.front().first(), mesh.front().second(),
skin.empty() ? -1 : Int(skin.front()), skin.isEmpty() ? -1 : Int(skin.front()),
importerState ? *importerState : nullptr} : importerState ? *importerState : nullptr} :
new MeshObjectData3D{std::move(children), new MeshObjectData3D{std::move(children),
*transformation, *transformation,

2
src/Magnum/Trade/AnimationData.cpp

@ -46,7 +46,7 @@ AnimationData::AnimationData(const DataFlags dataFlags, const Containers::ArrayV
AnimationData::AnimationData(const DataFlags dataFlags, const Containers::ArrayView<const void> data, std::initializer_list<AnimationTrackData> tracks, const Range1D& duration, const void* importerState): AnimationData{dataFlags, data, Implementation::initializerListToArrayWithDefaultDeleter(tracks), duration, importerState} {} AnimationData::AnimationData(const DataFlags dataFlags, const Containers::ArrayView<const void> data, std::initializer_list<AnimationTrackData> tracks, const Range1D& duration, const void* importerState): AnimationData{dataFlags, data, Implementation::initializerListToArrayWithDefaultDeleter(tracks), duration, importerState} {}
AnimationData::AnimationData(Containers::Array<char>&& data, Containers::Array<AnimationTrackData>&& tracks, const void* importerState) noexcept: _dataFlags{DataFlag::Owned|DataFlag::Mutable}, _data{std::move(data)}, _tracks{std::move(tracks)}, _importerState{importerState} { AnimationData::AnimationData(Containers::Array<char>&& data, Containers::Array<AnimationTrackData>&& tracks, const void* importerState) noexcept: _dataFlags{DataFlag::Owned|DataFlag::Mutable}, _data{std::move(data)}, _tracks{std::move(tracks)}, _importerState{importerState} {
if(!_tracks.empty()) { if(!_tracks.isEmpty()) {
/* Reset duration to duration of the first track so it properly support /* Reset duration to duration of the first track so it properly support
cases where tracks don't start at 0 */ cases where tracks don't start at 0 */
_duration = _tracks.front()._view.duration(); _duration = _tracks.front()._view.duration();

2
src/Magnum/Trade/MaterialData.cpp

@ -958,7 +958,7 @@ Debug& operator<<(Debug& debug, const MaterialAttribute value) {
/* LayerName is prefixed with a single space, drop that */ /* LayerName is prefixed with a single space, drop that */
Containers::StringView string = AttributeMap[UnsignedInt(value) - 1].name; Containers::StringView string = AttributeMap[UnsignedInt(value) - 1].name;
if(string[0] == ' ') string = string.suffix(1); if(string[0] == ' ') string = string.exceptPrefix(1);
return debug << "::" << Debug::nospace << string; return debug << "::" << Debug::nospace << string;
} }

2
src/Magnum/Trade/MaterialData.h

@ -1886,7 +1886,7 @@ class MAGNUM_TRADE_EXPORT MaterialData {
* at least @cpp 1 @ce. * at least @cpp 1 @ce.
*/ */
UnsignedInt layerCount() const { UnsignedInt layerCount() const {
return _layerOffsets.empty() ? 1 : _layerOffsets.size(); return _layerOffsets.isEmpty() ? 1 : _layerOffsets.size();
} }
/** /**

14
src/Magnum/Trade/MeshData.cpp

@ -69,9 +69,9 @@ MeshAttributeData::MeshAttributeData(const MeshAttribute name, const VertexForma
because I feel that makes more sense than duplicating the full assert because I feel that makes more sense than duplicating the full assert
logic */ logic */
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT
if(arraySize) CORRADE_ASSERT(data.empty()[0] || isVertexFormatImplementationSpecific(format) || data.size()[1] == vertexFormatSize(format)*arraySize, if(arraySize) CORRADE_ASSERT(data.isEmpty()[0] || isVertexFormatImplementationSpecific(format) || data.size()[1] == vertexFormatSize(format)*arraySize,
"Trade::MeshAttributeData: second view dimension size" << data.size()[1] << "doesn't match" << format << "and array size" << arraySize, ); "Trade::MeshAttributeData: second view dimension size" << data.size()[1] << "doesn't match" << format << "and array size" << arraySize, );
else CORRADE_ASSERT(data.empty()[0] || isVertexFormatImplementationSpecific(format) || data.size()[1] == vertexFormatSize(format), else CORRADE_ASSERT(data.isEmpty()[0] || isVertexFormatImplementationSpecific(format) || data.size()[1] == vertexFormatSize(format),
"Trade::MeshAttributeData: second view dimension size" << data.size()[1] << "doesn't match" << format, ); "Trade::MeshAttributeData: second view dimension size" << data.size()[1] << "doesn't match" << format, );
#endif #endif
CORRADE_ASSERT(data.isContiguous<1>(), CORRADE_ASSERT(data.isContiguous<1>(),
@ -106,7 +106,7 @@ MeshData::MeshData(const MeshPrimitive primitive, Containers::Array<char>&& inde
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT
UnsignedInt expectedAttributeVertexCount; UnsignedInt expectedAttributeVertexCount;
#endif #endif
if(_attributes.empty()) { if(_attributes.isEmpty()) {
CORRADE_ASSERT(vertexCount != ImplicitVertexCount, CORRADE_ASSERT(vertexCount != ImplicitVertexCount,
"Trade::MeshData: vertex count can't be implicit if there are no attributes", ); "Trade::MeshData: vertex count can't be implicit if there are no attributes", );
_vertexCount = vertexCount; _vertexCount = vertexCount;
@ -131,7 +131,7 @@ MeshData::MeshData(const MeshPrimitive primitive, Containers::Array<char>&& inde
} }
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT
CORRADE_ASSERT(_indexCount || _indexData.empty(), CORRADE_ASSERT(_indexCount || _indexData.isEmpty(),
"Trade::MeshData: indexData passed for a non-indexed mesh", ); "Trade::MeshData: indexData passed for a non-indexed mesh", );
if(_indexCount) { if(_indexCount) {
const UnsignedInt typeSize = const UnsignedInt typeSize =
@ -687,11 +687,11 @@ void MeshData::bitangentSignsInto(const Containers::StridedArrayView1D<Float>& d
if(attribute._format == VertexFormat::Vector4) if(attribute._format == VertexFormat::Vector4)
Utility::copy(Containers::arrayCast<2, const Float>(attributeData, 4).transposed<0, 1>()[3], destination); Utility::copy(Containers::arrayCast<2, const Float>(attributeData, 4).transposed<0, 1>()[3], destination);
else if(attribute._format == VertexFormat::Vector4h) else if(attribute._format == VertexFormat::Vector4h)
Math::unpackHalfInto(Containers::arrayCast<2, const UnsignedShort>(attributeData, 4).suffix({0, 3}), destination1f); Math::unpackHalfInto(Containers::arrayCast<2, const UnsignedShort>(attributeData, 4).exceptPrefix({0, 3}), destination1f);
else if(attribute._format == VertexFormat::Vector4bNormalized) else if(attribute._format == VertexFormat::Vector4bNormalized)
Math::unpackInto(Containers::arrayCast<2, const Byte>(attributeData, 4).suffix({0, 3}), destination1f); Math::unpackInto(Containers::arrayCast<2, const Byte>(attributeData, 4).exceptPrefix({0, 3}), destination1f);
else if(attribute._format == VertexFormat::Vector4sNormalized) else if(attribute._format == VertexFormat::Vector4sNormalized)
Math::unpackInto(Containers::arrayCast<2, const Short>(attributeData, 4).suffix({0, 3}), destination1f); Math::unpackInto(Containers::arrayCast<2, const Short>(attributeData, 4).exceptPrefix({0, 3}), destination1f);
else CORRADE_ASSERT_UNREACHABLE("Trade::MeshData::bitangentSignsInto(): expected four-component tangents, but got" << attribute._format, ); else CORRADE_ASSERT_UNREACHABLE("Trade::MeshData::bitangentSignsInto(): expected four-component tangents, but got" << attribute._format, );
} }

6
src/Magnum/Trade/SceneData.cpp

@ -506,9 +506,9 @@ SceneFieldData::SceneFieldData(const SceneField name, const Containers::StridedA
because I feel that makes more sense than duplicating the full assert because I feel that makes more sense than duplicating the full assert
logic */ logic */
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT
if(fieldArraySize) CORRADE_ASSERT(fieldData.empty()[0] || fieldData.size()[1] == sceneFieldTypeSize(fieldType)*fieldArraySize, if(fieldArraySize) CORRADE_ASSERT(fieldData.isEmpty()[0] || fieldData.size()[1] == sceneFieldTypeSize(fieldType)*fieldArraySize,
"Trade::SceneFieldData: second field view dimension size" << fieldData.size()[1] << "doesn't match" << fieldType << "and field array size" << fieldArraySize, ); "Trade::SceneFieldData: second field view dimension size" << fieldData.size()[1] << "doesn't match" << fieldType << "and field array size" << fieldArraySize, );
else CORRADE_ASSERT(fieldData.empty()[0] || fieldData.size()[1] == sceneFieldTypeSize(fieldType), else CORRADE_ASSERT(fieldData.isEmpty()[0] || fieldData.size()[1] == sceneFieldTypeSize(fieldType),
"Trade::SceneFieldData: second field view dimension size" << fieldData.size()[1] << "doesn't match" << fieldType, ); "Trade::SceneFieldData: second field view dimension size" << fieldData.size()[1] << "doesn't match" << fieldType, );
#endif #endif
@ -779,7 +779,7 @@ SceneData::SceneData(std::vector<UnsignedInt> children2D, std::vector<UnsignedIn
doesn't take any nested object into account but SceneData created this doesn't take any nested object into account but SceneData created this
way is expected to be used only through the deprecated APIs anyway, way is expected to be used only through the deprecated APIs anyway,
which don't care about this value. */ which don't care about this value. */
_mappingBound = children.empty() ? 0 : Math::max(children) + 1; _mappingBound = children.isEmpty() ? 0 : Math::max(children) + 1;
/* Convert the vector with top-level object IDs to the parent field, where /* Convert the vector with top-level object IDs to the parent field, where
all have -1 as a parent. This way the (also deprecated) children2D() / all have -1 as a parent. This way the (also deprecated) children2D() /

10
src/Magnum/Trade/Test/MaterialDataTest.cpp

@ -570,7 +570,7 @@ void MaterialDataTest::constructAttributeMutablePointer() {
void MaterialDataTest::constructAttributeStringNameStringValue() { void MaterialDataTest::constructAttributeStringNameStringValue() {
/* Explicitly using a non-null-terminated view on input to check the null /* Explicitly using a non-null-terminated view on input to check the null
byte isn't read by accident*/ byte isn't read by accident*/
MaterialAttributeData attribute{"name that's long", "and a value\0that's also long but still fits!!"_s.except(1)}; MaterialAttributeData attribute{"name that's long", "and a value\0that's also long but still fits!!"_s.exceptSuffix(1)};
CORRADE_COMPARE(attribute.name(), "name that's long"); CORRADE_COMPARE(attribute.name(), "name that's long");
CORRADE_COMPARE(attribute.name().flags(), Containers::StringViewFlag::NullTerminated); CORRADE_COMPARE(attribute.name().flags(), Containers::StringViewFlag::NullTerminated);
CORRADE_COMPARE(attribute.name()[attribute.name().size()], '\0'); CORRADE_COMPARE(attribute.name()[attribute.name().size()], '\0');
@ -581,7 +581,7 @@ void MaterialDataTest::constructAttributeStringNameStringValue() {
CORRADE_COMPARE(attribute.value<Containers::StringView>().flags(), Containers::StringViewFlag::NullTerminated); CORRADE_COMPARE(attribute.value<Containers::StringView>().flags(), Containers::StringViewFlag::NullTerminated);
CORRADE_COMPARE(attribute.value<Containers::StringView>()[attribute.value<Containers::StringView>().size()], '\0'); CORRADE_COMPARE(attribute.value<Containers::StringView>()[attribute.value<Containers::StringView>().size()], '\0');
constexpr MaterialAttributeData cattribute{"name that's long"_s, "and a value\0that's also long but still fits!!"_s.except(1)}; constexpr MaterialAttributeData cattribute{"name that's long"_s, "and a value\0that's also long but still fits!!"_s.exceptSuffix(1)};
CORRADE_COMPARE(cattribute.name(), "name that's long"); CORRADE_COMPARE(cattribute.name(), "name that's long");
CORRADE_COMPARE(cattribute.name().flags(), Containers::StringViewFlag::NullTerminated); CORRADE_COMPARE(cattribute.name().flags(), Containers::StringViewFlag::NullTerminated);
CORRADE_COMPARE(cattribute.name()[cattribute.name().size()], '\0'); CORRADE_COMPARE(cattribute.name()[cattribute.name().size()], '\0');
@ -591,7 +591,7 @@ void MaterialDataTest::constructAttributeStringNameStringValue() {
CORRADE_COMPARE(cattribute.value<Containers::StringView>()[cattribute.value<Containers::StringView>().size()], '\0'); CORRADE_COMPARE(cattribute.value<Containers::StringView>()[cattribute.value<Containers::StringView>().size()], '\0');
/* Type-erased variant */ /* Type-erased variant */
const Containers::StringView value = "and a value\0that's also long but still fits!!"_s.except(1); const Containers::StringView value = "and a value\0that's also long but still fits!!"_s.exceptSuffix(1);
MaterialAttributeData typeErased{"name that's long", MaterialAttributeType::String, &value}; MaterialAttributeData typeErased{"name that's long", MaterialAttributeType::String, &value};
CORRADE_COMPARE(typeErased.name(), "name that's long"); CORRADE_COMPARE(typeErased.name(), "name that's long");
CORRADE_COMPARE(typeErased.name().flags(), Containers::StringViewFlag::NullTerminated); CORRADE_COMPARE(typeErased.name().flags(), Containers::StringViewFlag::NullTerminated);
@ -606,7 +606,7 @@ void MaterialDataTest::constructAttributeNameStringValue() {
/* Explicitly using a non-null-terminated view on input to check the null /* Explicitly using a non-null-terminated view on input to check the null
byte isn't read by accident*/ byte isn't read by accident*/
MaterialAttributeData attribute{MaterialAttribute::LayerName, "a value\0that's long but still fits!!"_s.except(1)}; MaterialAttributeData attribute{MaterialAttribute::LayerName, "a value\0that's long but still fits!!"_s.exceptSuffix(1)};
CORRADE_COMPARE(attribute.name(), " LayerName"); CORRADE_COMPARE(attribute.name(), " LayerName");
CORRADE_COMPARE(attribute.name().flags(), Containers::StringViewFlag::NullTerminated); CORRADE_COMPARE(attribute.name().flags(), Containers::StringViewFlag::NullTerminated);
CORRADE_COMPARE(attribute.name()[attribute.name().size()], '\0'); CORRADE_COMPARE(attribute.name()[attribute.name().size()], '\0');
@ -618,7 +618,7 @@ void MaterialDataTest::constructAttributeNameStringValue() {
CORRADE_COMPARE(attribute.value<Containers::StringView>()[attribute.value<Containers::StringView>().size()], '\0'); CORRADE_COMPARE(attribute.value<Containers::StringView>()[attribute.value<Containers::StringView>().size()], '\0');
/* Type-erased variant */ /* Type-erased variant */
const Containers::StringView value = "a value\0that's long but still fits!!"_s.except(1); const Containers::StringView value = "a value\0that's long but still fits!!"_s.exceptSuffix(1);
MaterialAttributeData typeErased{MaterialAttribute::LayerName, MaterialAttributeType::String, &value}; MaterialAttributeData typeErased{MaterialAttribute::LayerName, MaterialAttributeType::String, &value};
CORRADE_COMPARE(typeErased.name(), " LayerName"); CORRADE_COMPARE(typeErased.name(), " LayerName");
CORRADE_COMPARE(typeErased.name().flags(), Containers::StringViewFlag::NullTerminated); CORRADE_COMPARE(typeErased.name().flags(), Containers::StringViewFlag::NullTerminated);

6
src/Magnum/Trade/Test/MeshDataTest.cpp

@ -1255,7 +1255,7 @@ void MeshDataTest::construct() {
CORRADE_COMPARE(data.indexDataFlags(), DataFlag::Owned|DataFlag::Mutable); CORRADE_COMPARE(data.indexDataFlags(), DataFlag::Owned|DataFlag::Mutable);
CORRADE_COMPARE(data.vertexDataFlags(), DataFlag::Owned|DataFlag::Mutable); CORRADE_COMPARE(data.vertexDataFlags(), DataFlag::Owned|DataFlag::Mutable);
CORRADE_COMPARE(data.primitive(), MeshPrimitive::Triangles); CORRADE_COMPARE(data.primitive(), MeshPrimitive::Triangles);
CORRADE_VERIFY(!data.attributeData().empty()); CORRADE_VERIFY(!data.attributeData().isEmpty());
CORRADE_COMPARE(static_cast<const void*>(data.indexData() + 2), indexView.data()); CORRADE_COMPARE(static_cast<const void*>(data.indexData() + 2), indexView.data());
CORRADE_COMPARE(static_cast<const void*>(data.vertexData()), vertexView.data()); CORRADE_COMPARE(static_cast<const void*>(data.vertexData()), vertexView.data());
CORRADE_COMPARE(static_cast<void*>(data.mutableIndexData() + 2), indexView.data()); CORRADE_COMPARE(static_cast<void*>(data.mutableIndexData() + 2), indexView.data());
@ -2112,7 +2112,7 @@ void MeshDataTest::constructSpecialAttributeStrides() {
MeshData mesh{MeshPrimitive::Points, std::move(vertexData), { MeshData mesh{MeshPrimitive::Points, std::move(vertexData), {
MeshAttributeData{MeshAttribute::ObjectId, vertices.prefix(1).broadcasted<0>(4)}, MeshAttributeData{MeshAttribute::ObjectId, vertices.prefix(1).broadcasted<0>(4)},
MeshAttributeData{MeshAttribute::ObjectId, vertices.suffix(1).flipped<0>()}, MeshAttributeData{MeshAttribute::ObjectId, vertices.exceptPrefix(1).flipped<0>()},
}}; }};
CORRADE_COMPARE(mesh.attributeStride(0), 0); CORRADE_COMPARE(mesh.attributeStride(0), 0);
@ -2168,7 +2168,7 @@ void MeshDataTest::constructSpecialAttributeStridesImplementationSpecificVertexF
MeshData mesh{MeshPrimitive::Points, std::move(vertexData), { MeshData mesh{MeshPrimitive::Points, std::move(vertexData), {
MeshAttributeData{MeshAttribute::ObjectId, vertexFormatWrap(0xdead), vertices.prefix(1).broadcasted<0>(4)}, MeshAttributeData{MeshAttribute::ObjectId, vertexFormatWrap(0xdead), vertices.prefix(1).broadcasted<0>(4)},
MeshAttributeData{MeshAttribute::ObjectId, vertexFormatWrap(0xdead), vertices.suffix(1).flipped<0>()} MeshAttributeData{MeshAttribute::ObjectId, vertexFormatWrap(0xdead), vertices.exceptPrefix(1).flipped<0>()}
}}; }};
CORRADE_COMPARE(mesh.attributeStride(0), 0); CORRADE_COMPARE(mesh.attributeStride(0), 0);

12
src/Magnum/Trade/Test/SceneDataTest.cpp

@ -1348,7 +1348,7 @@ void SceneDataTest::construct() {
/* Basics */ /* Basics */
CORRADE_COMPARE(scene.dataFlags(), DataFlag::Owned|DataFlag::Mutable); CORRADE_COMPARE(scene.dataFlags(), DataFlag::Owned|DataFlag::Mutable);
CORRADE_VERIFY(!scene.fieldData().empty()); CORRADE_VERIFY(!scene.fieldData().isEmpty());
CORRADE_COMPARE(static_cast<const void*>(scene.data()), transformsParentFieldMappingData.data()); CORRADE_COMPARE(static_cast<const void*>(scene.data()), transformsParentFieldMappingData.data());
CORRADE_COMPARE(static_cast<void*>(scene.mutableData()), transformsParentFieldMappingData.data()); CORRADE_COMPARE(static_cast<void*>(scene.mutableData()), transformsParentFieldMappingData.data());
CORRADE_COMPARE(scene.mappingBound(), 8); CORRADE_COMPARE(scene.mappingBound(), 8);
@ -1588,7 +1588,7 @@ void SceneDataTest::constructZeroFields() {
int importerState{}; int importerState{};
SceneData scene{SceneMappingType::UnsignedShort, 37563, nullptr, {}, &importerState}; SceneData scene{SceneMappingType::UnsignedShort, 37563, nullptr, {}, &importerState};
CORRADE_COMPARE(scene.dataFlags(), DataFlag::Owned|DataFlag::Mutable); CORRADE_COMPARE(scene.dataFlags(), DataFlag::Owned|DataFlag::Mutable);
CORRADE_VERIFY(scene.fieldData().empty()); CORRADE_VERIFY(scene.fieldData().isEmpty());
CORRADE_COMPARE(static_cast<const void*>(scene.data()), nullptr); CORRADE_COMPARE(static_cast<const void*>(scene.data()), nullptr);
CORRADE_COMPARE(static_cast<void*>(scene.mutableData()), nullptr); CORRADE_COMPARE(static_cast<void*>(scene.mutableData()), nullptr);
CORRADE_COMPARE(scene.importerState(), &importerState); CORRADE_COMPARE(scene.importerState(), &importerState);
@ -1606,7 +1606,7 @@ void SceneDataTest::constructZeroObjects() {
SceneFieldData materials{SceneField::MeshMaterial, SceneMappingType::UnsignedInt, nullptr, SceneFieldType::Int, nullptr}; SceneFieldData materials{SceneField::MeshMaterial, SceneMappingType::UnsignedInt, nullptr, SceneFieldType::Int, nullptr};
SceneData scene{SceneMappingType::UnsignedInt, 0, nullptr, {meshes, materials}, &importerState}; SceneData scene{SceneMappingType::UnsignedInt, 0, nullptr, {meshes, materials}, &importerState};
CORRADE_COMPARE(scene.dataFlags(), DataFlag::Owned|DataFlag::Mutable); CORRADE_COMPARE(scene.dataFlags(), DataFlag::Owned|DataFlag::Mutable);
CORRADE_VERIFY(!scene.fieldData().empty()); CORRADE_VERIFY(!scene.fieldData().isEmpty());
CORRADE_COMPARE(static_cast<const void*>(scene.data()), nullptr); CORRADE_COMPARE(static_cast<const void*>(scene.data()), nullptr);
CORRADE_COMPARE(static_cast<void*>(scene.mutableData()), nullptr); CORRADE_COMPARE(static_cast<void*>(scene.mutableData()), nullptr);
CORRADE_COMPARE(scene.importerState(), &importerState); CORRADE_COMPARE(scene.importerState(), &importerState);
@ -1996,8 +1996,8 @@ void SceneDataTest::constructMismatchedTRSViews() {
SceneFieldData translations{SceneField::Translation, translationMappingData, translationFieldData}; SceneFieldData translations{SceneField::Translation, translationMappingData, translationFieldData};
SceneFieldData rotationsDifferent{SceneField::Rotation, rotationMappingData, rotationFieldData}; SceneFieldData rotationsDifferent{SceneField::Rotation, rotationMappingData, rotationFieldData};
SceneFieldData scalingsDifferent{SceneField::Scaling, scalingMappingData, scalingFieldData}; SceneFieldData scalingsDifferent{SceneField::Scaling, scalingMappingData, scalingFieldData};
SceneFieldData rotationsSameButLess{SceneField::Rotation, translationMappingData.except(1), rotationFieldData.except(1)}; SceneFieldData rotationsSameButLess{SceneField::Rotation, translationMappingData.exceptSuffix(1), rotationFieldData.exceptSuffix(1)};
SceneFieldData scalingsSameButLess{SceneField::Scaling, translationMappingData.except(2), scalingFieldData.except(2)}; SceneFieldData scalingsSameButLess{SceneField::Scaling, translationMappingData.exceptSuffix(2), scalingFieldData.exceptSuffix(2)};
/* Test that all pairs get checked */ /* Test that all pairs get checked */
std::ostringstream out; std::ostringstream out;
@ -2162,7 +2162,7 @@ void SceneDataTest::constructMismatchedMeshMaterialView() {
SceneFieldData meshes{SceneField::Mesh, meshMappingData, meshFieldData}; SceneFieldData meshes{SceneField::Mesh, meshMappingData, meshFieldData};
SceneFieldData meshMaterialsDifferent{SceneField::MeshMaterial, meshMaterialMappingData, meshMaterialFieldData}; SceneFieldData meshMaterialsDifferent{SceneField::MeshMaterial, meshMaterialMappingData, meshMaterialFieldData};
SceneFieldData meshMaterialsSameButLess{SceneField::MeshMaterial, meshMappingData.except(1), meshMaterialFieldData.except(1)}; SceneFieldData meshMaterialsSameButLess{SceneField::MeshMaterial, meshMappingData.exceptSuffix(1), meshMaterialFieldData.exceptSuffix(1)};
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};

6
src/Magnum/Trade/imageconverter.cpp

@ -199,7 +199,7 @@ using namespace Magnum;
namespace { namespace {
template<UnsignedInt dimensions> bool checkCommonFormat(const Utility::Arguments& args, const Containers::Array<Trade::ImageData<dimensions>>& images) { template<UnsignedInt dimensions> bool checkCommonFormat(const Utility::Arguments& args, const Containers::Array<Trade::ImageData<dimensions>>& images) {
CORRADE_INTERNAL_ASSERT(!images.empty()); CORRADE_INTERNAL_ASSERT(!images.isEmpty());
const bool compressed = images.front().isCompressed(); const bool compressed = images.front().isCompressed();
PixelFormat format{}; PixelFormat format{};
CompressedPixelFormat compressedFormat{}; CompressedPixelFormat compressedFormat{};
@ -231,7 +231,7 @@ template<UnsignedInt dimensions> bool checkCommonFormat(const Utility::Arguments
template<UnsignedInt dimensions> bool checkCommonFormatAndSize(const Utility::Arguments& args, const Containers::Array<Trade::ImageData<dimensions>>& images) { template<UnsignedInt dimensions> bool checkCommonFormatAndSize(const Utility::Arguments& args, const Containers::Array<Trade::ImageData<dimensions>>& images) {
if(!checkCommonFormat(args, images)) return false; if(!checkCommonFormat(args, images)) return false;
CORRADE_INTERNAL_ASSERT(!images.empty()); CORRADE_INTERNAL_ASSERT(!images.isEmpty());
Math::Vector<dimensions, Int> size = images.front().size(); Math::Vector<dimensions, Int> size = images.front().size();
for(std::size_t i = 1; i != images.size(); ++i) { for(std::size_t i = 1; i != images.size(); ++i) {
if(images[i].size() != size) { if(images[i].size() != size) {
@ -258,7 +258,7 @@ template<UnsignedInt dimensions> bool convertOneOrMoreImages(Trade::AbstractImag
if(outputImages.size() == 1) if(outputImages.size() == 1)
return converter.convertToFile(outputImages.front(), output); return converter.convertToFile(outputImages.front(), output);
CORRADE_INTERNAL_ASSERT(!outputImages.empty()); CORRADE_INTERNAL_ASSERT(!outputImages.isEmpty());
if(outputImages.front().isCompressed()) if(outputImages.front().isCompressed())
return convertOneOrMoreImages<CompressedImageView, dimensions>(converter, outputImages, output); return convertOneOrMoreImages<CompressedImageView, dimensions>(converter, outputImages, output);
else else

2
src/Magnum/Vk/DescriptorPool.cpp

@ -43,7 +43,7 @@ DescriptorPoolCreateInfo::DescriptorPoolCreateInfo(const UnsignedInt maxSets, co
/* On certain compilers, {} (empty initializer list) gets converted to an /* On certain compilers, {} (empty initializer list) gets converted to an
arrayview that's not null, interesting. Explicitly using .empty() to arrayview that's not null, interesting. Explicitly using .empty() to
ensure the assert gets properly fired. */ ensure the assert gets properly fired. */
CORRADE_ASSERT(!poolSizes.empty(), CORRADE_ASSERT(!poolSizes.isEmpty(),
"Vk::DescriptorPoolCreateInfo: there has to be at least one pool", ); "Vk::DescriptorPoolCreateInfo: there has to be at least one pool", );
Containers::ArrayView<VkDescriptorPoolSize> poolSizesCopy; Containers::ArrayView<VkDescriptorPoolSize> poolSizesCopy;

8
src/Magnum/Vk/Device.cpp

@ -290,7 +290,7 @@ DeviceCreateInfo& DeviceCreateInfo::operator=(DeviceCreateInfo&& other) noexcept
} }
DeviceCreateInfo& DeviceCreateInfo::addEnabledExtensions(const Containers::ArrayView<const Containers::StringView> extensions) & { DeviceCreateInfo& DeviceCreateInfo::addEnabledExtensions(const Containers::ArrayView<const Containers::StringView> extensions) & {
if(extensions.empty()) return *this; if(extensions.isEmpty()) return *this;
/* This can happen in case we used the NoInit or VkDeviceCreateInfo /* This can happen in case we used the NoInit or VkDeviceCreateInfo
constructor */ constructor */
if(!_state) _state.emplace(); if(!_state) _state.emplace();
@ -334,7 +334,7 @@ DeviceCreateInfo&& DeviceCreateInfo::addEnabledExtensions(const std::initializer
} }
DeviceCreateInfo& DeviceCreateInfo::addEnabledExtensions(const Containers::ArrayView<const Extension> extensions) & { DeviceCreateInfo& DeviceCreateInfo::addEnabledExtensions(const Containers::ArrayView<const Extension> extensions) & {
if(extensions.empty()) return *this; if(extensions.isEmpty()) return *this;
/* This can happen in case we used the NoInit or VkDeviceCreateInfo /* This can happen in case we used the NoInit or VkDeviceCreateInfo
constructor */ constructor */
if(!_state) _state.emplace(); if(!_state) _state.emplace();
@ -575,7 +575,7 @@ DeviceCreateInfo&& DeviceCreateInfo::setEnabledFeatures(const DeviceFeatures& fe
} }
DeviceCreateInfo& DeviceCreateInfo::addQueues(const UnsignedInt family, const Containers::ArrayView<const Float> priorities, const Containers::ArrayView<const Containers::Reference<Queue>> output) & { DeviceCreateInfo& DeviceCreateInfo::addQueues(const UnsignedInt family, const Containers::ArrayView<const Float> priorities, const Containers::ArrayView<const Containers::Reference<Queue>> output) & {
CORRADE_ASSERT(!priorities.empty(), "Vk::DeviceCreateInfo::addQueues(): at least one queue priority has to be specified", *this); CORRADE_ASSERT(!priorities.isEmpty(), "Vk::DeviceCreateInfo::addQueues(): at least one queue priority has to be specified", *this);
CORRADE_ASSERT(output.size() == priorities.size(), "Vk::DeviceCreateInfo::addQueues(): expected" << priorities.size() << "outuput queue references but got" << output.size(), *this); CORRADE_ASSERT(output.size() == priorities.size(), "Vk::DeviceCreateInfo::addQueues(): expected" << priorities.size() << "outuput queue references but got" << output.size(), *this);
/* This can happen in case we used the NoInit or VkDeviceCreateInfo /* This can happen in case we used the NoInit or VkDeviceCreateInfo
@ -594,7 +594,7 @@ DeviceCreateInfo& DeviceCreateInfo::addQueues(const UnsignedInt family, const Co
this grows too big as all pointers would need to be patched, so there's this grows too big as all pointers would need to be patched, so there's
a static limit. */ a static limit. */
CORRADE_INTERNAL_ASSERT(_state->nextQueuePriority + priorities.size() <= _state->queuePriorities.size()); CORRADE_INTERNAL_ASSERT(_state->nextQueuePriority + priorities.size() <= _state->queuePriorities.size());
Utility::copy(priorities, _state->queuePriorities.suffix(_state->nextQueuePriority).prefix(priorities.size())); Utility::copy(priorities, _state->queuePriorities.exceptPrefix(_state->nextQueuePriority).prefix(priorities.size()));
for(std::size_t i = 0; i != priorities.size(); ++i) for(std::size_t i = 0; i != priorities.size(); ++i)
_state->queueOutput[_state->nextQueuePriority + i] = &*output[i]; _state->queueOutput[_state->nextQueuePriority + i] = &*output[i];
_state->nextQueuePriority += priorities.size(); _state->nextQueuePriority += priorities.size();

2
src/Magnum/Vk/DeviceProperties.cpp

@ -375,7 +375,7 @@ Containers::ArrayView<const VkQueueFamilyProperties2> DeviceProperties::queueFam
if(!_state) _state.emplace(*_instance, _handle); if(!_state) _state.emplace(*_instance, _handle);
/* Fetch if not already */ /* Fetch if not already */
if(_state->queueFamilyProperties.empty()) { if(_state->queueFamilyProperties.isEmpty()) {
UnsignedInt count; UnsignedInt count;
_state->getQueueFamilyPropertiesImplementation(*this, count, nullptr); _state->getQueueFamilyPropertiesImplementation(*this, count, nullptr);

6
src/Magnum/Vk/Instance.cpp

@ -174,7 +174,7 @@ InstanceCreateInfo& InstanceCreateInfo::setApplicationInfo(const Containers::Str
} }
InstanceCreateInfo& InstanceCreateInfo::addEnabledLayers(const Containers::ArrayView<const Containers::StringView> layers) { InstanceCreateInfo& InstanceCreateInfo::addEnabledLayers(const Containers::ArrayView<const Containers::StringView> layers) {
if(layers.empty()) return *this; if(layers.isEmpty()) return *this;
if(!_state) _state.emplace(); if(!_state) _state.emplace();
/* Add null-terminated strings to the layer array */ /* Add null-terminated strings to the layer array */
@ -208,7 +208,7 @@ InstanceCreateInfo& InstanceCreateInfo::addEnabledLayers(const std::initializer_
} }
InstanceCreateInfo& InstanceCreateInfo::addEnabledExtensions(const Containers::ArrayView<const Containers::StringView> extensions) { InstanceCreateInfo& InstanceCreateInfo::addEnabledExtensions(const Containers::ArrayView<const Containers::StringView> extensions) {
if(extensions.empty()) return *this; if(extensions.isEmpty()) return *this;
if(!_state) _state.emplace(); if(!_state) _state.emplace();
/* Add null-terminated strings to the extension array */ /* Add null-terminated strings to the extension array */
@ -242,7 +242,7 @@ InstanceCreateInfo& InstanceCreateInfo::addEnabledExtensions(const std::initiali
} }
InstanceCreateInfo& InstanceCreateInfo::addEnabledExtensions(const Containers::ArrayView<const InstanceExtension> extensions) { InstanceCreateInfo& InstanceCreateInfo::addEnabledExtensions(const Containers::ArrayView<const InstanceExtension> extensions) {
if(extensions.empty()) return *this; if(extensions.isEmpty()) return *this;
if(!_state) _state.emplace(); if(!_state) _state.emplace();
arrayReserve(_state->extensions, _state->extensions.size() + extensions.size()); arrayReserve(_state->extensions, _state->extensions.size() + extensions.size());

6
src/Magnum/Vk/MeshLayout.cpp

@ -177,7 +177,7 @@ MeshLayout& MeshLayout::addBinding(const UnsignedInt binding, const UnsignedInt
if(!_state) _state.emplace(); if(!_state) _state.emplace();
/* Ensure order for efficient comparisons */ /* Ensure order for efficient comparisons */
CORRADE_ASSERT(_state->bindings.empty() || _state->bindings.back().binding < binding, CORRADE_ASSERT(_state->bindings.isEmpty() || _state->bindings.back().binding < binding,
"Vk::MeshLayout::addBinding(): binding" << binding << "can't be ordered after" << _state->bindings.back().binding, *this); "Vk::MeshLayout::addBinding(): binding" << binding << "can't be ordered after" << _state->bindings.back().binding, *this);
VkVertexInputBindingDescription description{}; VkVertexInputBindingDescription description{};
@ -199,7 +199,7 @@ MeshLayout& MeshLayout::addInstancedBinding(const UnsignedInt binding, const Uns
if(!_state) _state.emplace(); if(!_state) _state.emplace();
/* Ensure order for efficient comparisons */ /* Ensure order for efficient comparisons */
CORRADE_ASSERT(_state->bindings.empty() || _state->bindings.back().binding < binding, CORRADE_ASSERT(_state->bindings.isEmpty() || _state->bindings.back().binding < binding,
"Vk::MeshLayout::addInstancedBinding(): binding" << binding << "can't be ordered after" << _state->bindings.back().binding, *this); "Vk::MeshLayout::addInstancedBinding(): binding" << binding << "can't be ordered after" << _state->bindings.back().binding, *this);
VkVertexInputBindingDescription description{}; VkVertexInputBindingDescription description{};
@ -234,7 +234,7 @@ MeshLayout& MeshLayout::addAttribute(const UnsignedInt location, const UnsignedI
if(!_state) _state.emplace(); if(!_state) _state.emplace();
/* Ensure order for efficient comparisons */ /* Ensure order for efficient comparisons */
CORRADE_ASSERT(_state->attributes.empty() || _state->attributes.back().location < location, CORRADE_ASSERT(_state->attributes.isEmpty() || _state->attributes.back().location < location,
"Vk::MeshLayout::addAttribute(): location" << location << "can't be ordered after" << _state->attributes.back().location, *this); "Vk::MeshLayout::addAttribute(): location" << location << "can't be ordered after" << _state->attributes.back().location, *this);
VkVertexInputAttributeDescription description{}; VkVertexInputAttributeDescription description{};

6
src/Magnum/Vk/RenderPass.cpp

@ -306,7 +306,7 @@ template<class T> void SubpassDescription::setColorAttachmentsInternal(Container
new(vkAttachments2 + i) VkAttachmentReference2(*wrappers[i]); new(vkAttachments2 + i) VkAttachmentReference2(*wrappers[i]);
} }
if(!resolveAttachments.empty()) for(std::size_t i = 0; i != attachments.size(); ++i) { if(!resolveAttachments.isEmpty()) for(std::size_t i = 0; i != attachments.size(); ++i) {
new(resolveWrappers + i) AttachmentReference{resolveAttachments[i]}; new(resolveWrappers + i) AttachmentReference{resolveAttachments[i]};
/* Can't use {} with GCC 4.8 here because it tries to initialize the /* Can't use {} with GCC 4.8 here because it tries to initialize the
first member instead of doing a copy */ first member instead of doing a copy */
@ -315,7 +315,7 @@ template<class T> void SubpassDescription::setColorAttachmentsInternal(Container
_description.colorAttachmentCount = attachments.size(); _description.colorAttachmentCount = attachments.size();
_description.pColorAttachments = vkAttachments2; _description.pColorAttachments = vkAttachments2;
_description.pResolveAttachments = resolveAttachments.empty() ? _description.pResolveAttachments = resolveAttachments.isEmpty() ?
nullptr : vkResolveAttachments2; nullptr : vkResolveAttachments2;
} }
@ -455,7 +455,7 @@ Containers::Array<VkSubpassDescription> SubpassDescription::vkSubpassDescription
/* Fill it with data and return, faking a size of 1 and with a custom /* Fill it with data and return, faking a size of 1 and with a custom
deleter that correctly deletes as a char array again */ deleter that correctly deletes as a char array again */
std::pair<VkSubpassDescription, std::size_t> out = vkSubpassDescriptionExtrasInto(_description, storage.suffix(sizeof(VkSubpassDescription))); std::pair<VkSubpassDescription, std::size_t> out = vkSubpassDescriptionExtrasInto(_description, storage.exceptPrefix(sizeof(VkSubpassDescription)));
CORRADE_INTERNAL_ASSERT(out.second == extrasSize); CORRADE_INTERNAL_ASSERT(out.second == extrasSize);
*reinterpret_cast<VkSubpassDescription*>(storage.data()) = out.first; *reinterpret_cast<VkSubpassDescription*>(storage.data()) = out.first;
return Containers::Array<VkSubpassDescription>{ return Containers::Array<VkSubpassDescription>{

2
src/Magnum/Vk/ShaderSet.cpp

@ -87,7 +87,7 @@ ShaderSet& ShaderSet::addShader(const ShaderStage stage, const VkShaderModule sh
/* Specialization, also only if there are any to avoid allocating the state /* Specialization, also only if there are any to avoid allocating the state
struct when not necessary */ struct when not necessary */
if(!specializations.empty()) { if(!specializations.isEmpty()) {
if(!_state) _state.emplace(); if(!_state) _state.emplace();
/* Remember the original base data pointers so we can reroute the /* Remember the original base data pointers so we can reroute the

40
src/Magnum/Vk/Test/DevicePropertiesVkTest.cpp

@ -155,7 +155,7 @@ DevicePropertiesVkTest::DevicePropertiesVkTest(): VulkanTester{NoCreate} {
void DevicePropertiesVkTest::enumerate() { void DevicePropertiesVkTest::enumerate() {
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
Debug{} << "Found" << devices.size() << "devices"; Debug{} << "Found" << devices.size() << "devices";
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
for(DeviceProperties& device: devices) { for(DeviceProperties& device: devices) {
CORRADE_ITERATION(device.name()); CORRADE_ITERATION(device.name());
@ -177,7 +177,7 @@ void DevicePropertiesVkTest::enumerate() {
void DevicePropertiesVkTest::constructMove() { void DevicePropertiesVkTest::constructMove() {
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
VkPhysicalDevice handle = devices[0].handle(); VkPhysicalDevice handle = devices[0].handle();
Containers::StringView name = devices[0].name(); Containers::StringView name = devices[0].name();
@ -322,7 +322,7 @@ void DevicePropertiesVkTest::featureExpectedUnsupported() {
void DevicePropertiesVkTest::enumerateExtensions() { void DevicePropertiesVkTest::enumerateExtensions() {
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
ExtensionProperties properties = devices[0].enumerateExtensionProperties(); ExtensionProperties properties = devices[0].enumerateExtensionProperties();
Debug{} << "Available device extension count:" << properties.names().size(); Debug{} << "Available device extension count:" << properties.names().size();
@ -343,7 +343,7 @@ void DevicePropertiesVkTest::enumerateExtensionsWithKhronosValidationLayer() {
CORRADE_SKIP("VK_LAYER_KHRONOS_validation not supported, can't test"); CORRADE_SKIP("VK_LAYER_KHRONOS_validation not supported, can't test");
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
/* There should be more extensions with this layer enabled */ /* There should be more extensions with this layer enabled */
ExtensionProperties global = devices[0].enumerateExtensionProperties(); ExtensionProperties global = devices[0].enumerateExtensionProperties();
@ -368,7 +368,7 @@ void DevicePropertiesVkTest::enumerateExtensionsNonexistentLayer() {
void DevicePropertiesVkTest::extensionConstructMove() { void DevicePropertiesVkTest::extensionConstructMove() {
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
ExtensionProperties a = devices[0].enumerateExtensionProperties(); ExtensionProperties a = devices[0].enumerateExtensionProperties();
const UnsignedInt count = a.count(); const UnsignedInt count = a.count();
@ -387,7 +387,7 @@ void DevicePropertiesVkTest::extensionConstructMove() {
void DevicePropertiesVkTest::extensionIsSupported() { void DevicePropertiesVkTest::extensionIsSupported() {
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
ExtensionProperties properties = devices[0].enumerateExtensionProperties(); ExtensionProperties properties = devices[0].enumerateExtensionProperties();
@ -402,7 +402,7 @@ void DevicePropertiesVkTest::extensionIsSupported() {
void DevicePropertiesVkTest::extensionIsSupportedRevision() { void DevicePropertiesVkTest::extensionIsSupportedRevision() {
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
ExtensionProperties properties = devices[0].enumerateExtensionProperties(); ExtensionProperties properties = devices[0].enumerateExtensionProperties();
@ -422,7 +422,7 @@ void DevicePropertiesVkTest::extensionIsSupportedRevision() {
void DevicePropertiesVkTest::extensionNamedRevision() { void DevicePropertiesVkTest::extensionNamedRevision() {
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
ExtensionProperties properties = devices[0].enumerateExtensionProperties(); ExtensionProperties properties = devices[0].enumerateExtensionProperties();
@ -440,7 +440,7 @@ void DevicePropertiesVkTest::extensionNamedRevision() {
void DevicePropertiesVkTest::queueFamilies() { void DevicePropertiesVkTest::queueFamilies() {
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
Debug{} << "Available queue family count:" << devices[0].queueFamilyCount(); Debug{} << "Available queue family count:" << devices[0].queueFamilyCount();
@ -462,7 +462,7 @@ void DevicePropertiesVkTest::queueFamilies() {
void DevicePropertiesVkTest::queueFamiliesOutOfRange() { void DevicePropertiesVkTest::queueFamiliesOutOfRange() {
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
const UnsignedInt count = devices[0].queueFamilyCount(); const UnsignedInt count = devices[0].queueFamilyCount();
@ -477,7 +477,7 @@ void DevicePropertiesVkTest::queueFamiliesOutOfRange() {
void DevicePropertiesVkTest::queueFamiliesPick() { void DevicePropertiesVkTest::queueFamiliesPick() {
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
Containers::Optional<UnsignedInt> id = devices[0].tryPickQueueFamily(QueueFlag::Compute|QueueFlag::Graphics); Containers::Optional<UnsignedInt> id = devices[0].tryPickQueueFamily(QueueFlag::Compute|QueueFlag::Graphics);
CORRADE_VERIFY(id); CORRADE_VERIFY(id);
@ -492,7 +492,7 @@ void DevicePropertiesVkTest::queueFamiliesPick() {
void DevicePropertiesVkTest::queueFamiliesPickFailed() { void DevicePropertiesVkTest::queueFamiliesPickFailed() {
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
@ -503,7 +503,7 @@ void DevicePropertiesVkTest::queueFamiliesPickFailed() {
void DevicePropertiesVkTest::memoryHeaps() { void DevicePropertiesVkTest::memoryHeaps() {
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
Debug{} << "Available memory heap count:" << devices[0].memoryHeapCount(); Debug{} << "Available memory heap count:" << devices[0].memoryHeapCount();
@ -533,7 +533,7 @@ void DevicePropertiesVkTest::memoryHeapOutOfRange() {
#endif #endif
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
const UnsignedInt count = devices[0].memoryHeapCount(); const UnsignedInt count = devices[0].memoryHeapCount();
@ -548,7 +548,7 @@ void DevicePropertiesVkTest::memoryHeapOutOfRange() {
void DevicePropertiesVkTest::memoryTypes() { void DevicePropertiesVkTest::memoryTypes() {
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
Debug{} << "Available memory type count:" << devices[0].memoryCount(); Debug{} << "Available memory type count:" << devices[0].memoryCount();
@ -577,7 +577,7 @@ void DevicePropertiesVkTest::memoryTypeOutOfRange() {
#endif #endif
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
const UnsignedInt count = devices[0].memoryCount(); const UnsignedInt count = devices[0].memoryCount();
@ -592,7 +592,7 @@ void DevicePropertiesVkTest::memoryTypeOutOfRange() {
void DevicePropertiesVkTest::memoryTypesPick() { void DevicePropertiesVkTest::memoryTypesPick() {
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
Containers::Optional<UnsignedInt> id = devices[0].tryPickMemory(MemoryFlag::HostVisible|MemoryFlag::HostCoherent); Containers::Optional<UnsignedInt> id = devices[0].tryPickMemory(MemoryFlag::HostVisible|MemoryFlag::HostCoherent);
CORRADE_VERIFY(id); CORRADE_VERIFY(id);
@ -614,7 +614,7 @@ void DevicePropertiesVkTest::memoryTypesPick() {
void DevicePropertiesVkTest::memoryTypesPickIgnoreSomePreferred() { void DevicePropertiesVkTest::memoryTypesPickIgnoreSomePreferred() {
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
Containers::Optional<UnsignedInt> id = devices[0].tryPickMemory({}, MemoryFlag::HostVisible|MemoryFlag::HostCoherent|MemoryFlag(0xcafe0000u)); Containers::Optional<UnsignedInt> id = devices[0].tryPickMemory({}, MemoryFlag::HostVisible|MemoryFlag::HostCoherent|MemoryFlag(0xcafe0000u));
CORRADE_VERIFY(id); CORRADE_VERIFY(id);
@ -635,7 +635,7 @@ void DevicePropertiesVkTest::memoryTypesPickFailed() {
#endif #endif
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
@ -656,7 +656,7 @@ void DevicePropertiesVkTest::pickDevice() {
void DevicePropertiesVkTest::pickDeviceIndex() { void DevicePropertiesVkTest::pickDeviceIndex() {
Containers::Array<DeviceProperties> devices = enumerateDevices(instance()); Containers::Array<DeviceProperties> devices = enumerateDevices(instance());
CORRADE_VERIFY(!devices.empty()); CORRADE_VERIFY(!devices.isEmpty());
/* Pick the last one */ /* Pick the last one */
CORRADE_COMPARE_AS(devices.size(), 10, TestSuite::Compare::Less); CORRADE_COMPARE_AS(devices.size(), 10, TestSuite::Compare::Less);

2
src/Magnum/Vk/Test/DeviceVkTest.cpp

@ -289,7 +289,7 @@ void DeviceVkTest::createInfoExtensionsCopiedStrings() {
if(std::getenv("MAGNUM_DISABLE_EXTENSIONS")) if(std::getenv("MAGNUM_DISABLE_EXTENSIONS"))
CORRADE_SKIP("Can't test with the MAGNUM_DISABLE_EXTENSIONS environment variable set"); CORRADE_SKIP("Can't test with the MAGNUM_DISABLE_EXTENSIONS environment variable set");
Containers::StringView globalButNotNullTerminated = "VK_KHR_maintenance25"_s.except(1); Containers::StringView globalButNotNullTerminated = "VK_KHR_maintenance25"_s.exceptSuffix(1);
Containers::String localButNullTerminated = Extensions::KHR::draw_indirect_count::string(); Containers::String localButNullTerminated = Extensions::KHR::draw_indirect_count::string();
DeviceCreateInfo info{pickDevice(instance()), DeviceCreateInfo::Flag::NoImplicitExtensions}; DeviceCreateInfo info{pickDevice(instance()), DeviceCreateInfo::Flag::NoImplicitExtensions};

2
src/Magnum/Vk/Test/InstanceVkTest.cpp

@ -290,7 +290,7 @@ void InstanceVkTest::createInfoExtensions() {
} }
void InstanceVkTest::createInfoCopiedStrings() { void InstanceVkTest::createInfoCopiedStrings() {
Containers::StringView globalButNotNullTerminated = "VK_LAYER_KHRONOS_validation3"_s.except(1); Containers::StringView globalButNotNullTerminated = "VK_LAYER_KHRONOS_validation3"_s.exceptSuffix(1);
Containers::String localButNullTerminated = Extensions::KHR::external_memory_capabilities::string(); Containers::String localButNullTerminated = Extensions::KHR::external_memory_capabilities::string();
InstanceCreateInfo info{InstanceCreateInfo::Flag::NoImplicitExtensions}; InstanceCreateInfo info{InstanceCreateInfo::Flag::NoImplicitExtensions};

6
src/Magnum/Vk/Test/MeshTest.cpp

@ -129,9 +129,9 @@ void MeshTest::construct() {
CORRADE_COMPARE(mesh.indexOffset(), 0); CORRADE_COMPARE(mesh.indexOffset(), 0);
CORRADE_COMPARE(mesh.instanceCount(), 1); CORRADE_COMPARE(mesh.instanceCount(), 1);
CORRADE_COMPARE(mesh.instanceOffset(), 0); CORRADE_COMPARE(mesh.instanceOffset(), 0);
CORRADE_VERIFY(mesh.vertexBuffers().empty()); CORRADE_VERIFY(mesh.vertexBuffers().isEmpty());
CORRADE_VERIFY(mesh.vertexBufferOffsets().empty()); CORRADE_VERIFY(mesh.vertexBufferOffsets().isEmpty());
CORRADE_VERIFY(mesh.vertexBufferStrides().empty()); CORRADE_VERIFY(mesh.vertexBufferStrides().isEmpty());
CORRADE_VERIFY(!mesh.isIndexed()); CORRADE_VERIFY(!mesh.isIndexed());
} }

2
src/Magnum/Vk/Test/MeshVkTest.cpp

@ -330,7 +330,7 @@ void MeshVkTest::cmdDrawIndexed() {
Utility::copy(Containers::stridedArrayView(QuadData).slice(&Quad::position), Utility::copy(Containers::stridedArrayView(QuadData).slice(&Quad::position),
Containers::arrayCast<Vector3>(data.slice(32, 32 + 12*4))); Containers::arrayCast<Vector3>(data.slice(32, 32 + 12*4)));
Utility::copy(Containers::arrayCast<const char>(QuadIndexData), Utility::copy(Containers::arrayCast<const char>(QuadIndexData),
Containers::stridedArrayView(data).suffix(32 + 12*4)); Containers::stridedArrayView(data).exceptPrefix(32 + 12*4));
mesh.addVertexBuffer(0, buffer, 32) mesh.addVertexBuffer(0, buffer, 32)
.setIndexBuffer(std::move(buffer), 32 + 12*4, MeshIndexType::UnsignedShort) .setIndexBuffer(std::move(buffer), 32 + 12*4, MeshIndexType::UnsignedShort)
.setCount(6); .setCount(6);

2
src/Magnum/Vk/Test/PipelineTest.cpp

@ -556,7 +556,7 @@ void PipelineTest::computeCreateInfoConstruct() {
void PipelineTest::computeCreateInfoConstructOwnedEntrypoint() { void PipelineTest::computeCreateInfoConstructOwnedEntrypoint() {
ShaderSet shaderSet; ShaderSet shaderSet;
shaderSet.addShader({}, {}, "dead!"_s.except(1)); shaderSet.addShader({}, {}, "dead!"_s.exceptSuffix(1));
ComputePipelineCreateInfo info{shaderSet, {}}; ComputePipelineCreateInfo info{shaderSet, {}};
CORRADE_COMPARE(info->stage.pName, "dead"_s); CORRADE_COMPARE(info->stage.pName, "dead"_s);

12
src/Magnum/Vk/Test/ShaderSetTest.cpp

@ -96,7 +96,7 @@ void ShaderSetTest::specializationConstructBool() {
void ShaderSetTest::construct() { void ShaderSetTest::construct() {
ShaderSet set; ShaderSet set;
CORRADE_VERIFY(set.stages().empty()); CORRADE_VERIFY(set.stages().isEmpty());
/* The actually meaningful test done in addShader() and friends */ /* The actually meaningful test done in addShader() and friends */
} }
@ -114,7 +114,7 @@ void ShaderSetTest::constructMove() {
/* The double reinterpret_cast is needed because the handle is an /* The double reinterpret_cast is needed because the handle is an
uint64_t instead of a pointer on 32-bit builds and only this works uint64_t instead of a pointer on 32-bit builds and only this works
on both */ on both */
a.addShader(ShaderStage::Geometry, reinterpret_cast<VkShaderModule>(reinterpret_cast<void*>(0xdeadbeef)), "main!"_s.except(1), { a.addShader(ShaderStage::Geometry, reinterpret_cast<VkShaderModule>(reinterpret_cast<void*>(0xdeadbeef)), "main!"_s.exceptSuffix(1), {
{42, 1.15f} {42, 1.15f}
}); });
CORRADE_COMPARE(a.stages().size(), 1); CORRADE_COMPARE(a.stages().size(), 1);
@ -127,7 +127,7 @@ void ShaderSetTest::constructMove() {
CORRADE_COMPARE(*reinterpret_cast<const Float*>(a.stages()[0].pSpecializationInfo->pData), 1.15f); CORRADE_COMPARE(*reinterpret_cast<const Float*>(a.stages()[0].pSpecializationInfo->pData), 1.15f);
ShaderSet b = std::move(a); ShaderSet b = std::move(a);
CORRADE_VERIFY(a.stages().empty()); CORRADE_VERIFY(a.stages().isEmpty());
CORRADE_COMPARE(b.stages().size(), 1); CORRADE_COMPARE(b.stages().size(), 1);
CORRADE_COMPARE(b.stages()[0].pName, "main"_s); CORRADE_COMPARE(b.stages()[0].pName, "main"_s);
CORRADE_VERIFY(b.stages()[0].pSpecializationInfo); CORRADE_VERIFY(b.stages()[0].pSpecializationInfo);
@ -138,7 +138,7 @@ void ShaderSetTest::constructMove() {
CORRADE_COMPARE(*reinterpret_cast<const Float*>(b.stages()[0].pSpecializationInfo->pData), 1.15f); CORRADE_COMPARE(*reinterpret_cast<const Float*>(b.stages()[0].pSpecializationInfo->pData), 1.15f);
c = std::move(b); c = std::move(b);
CORRADE_VERIFY(b.stages().empty()); CORRADE_VERIFY(b.stages().isEmpty());
} }
/* Doing this in outer scope to verify that the internal state pointer got /* Doing this in outer scope to verify that the internal state pointer got
@ -170,7 +170,7 @@ void ShaderSetTest::addShader() {
void ShaderSetTest::addShaderEntrypointCopy() { void ShaderSetTest::addShaderEntrypointCopy() {
ShaderSet set; ShaderSet set;
Containers::StringView entrypoint = "enterHere!"_s; Containers::StringView entrypoint = "enterHere!"_s;
set.addShader(ShaderStage{}, {}, entrypoint.except(1)); set.addShader(ShaderStage{}, {}, entrypoint.exceptSuffix(1));
CORRADE_COMPARE(set.stages().size(), 1); CORRADE_COMPARE(set.stages().size(), 1);
CORRADE_VERIFY(set.stages()[0].pName != entrypoint.data()); CORRADE_VERIFY(set.stages()[0].pName != entrypoint.data());
CORRADE_COMPARE(set.stages()[0].pName, "enterHere"_s); CORRADE_COMPARE(set.stages()[0].pName, "enterHere"_s);
@ -179,7 +179,7 @@ void ShaderSetTest::addShaderEntrypointCopy() {
void ShaderSetTest::addShaderEntrypointCopyReallocation() { void ShaderSetTest::addShaderEntrypointCopyReallocation() {
ShaderSet set; ShaderSet set;
Containers::StringView entrypoint = "enterHere!"_s; Containers::StringView entrypoint = "enterHere!"_s;
set.addShader(ShaderStage{}, {}, entrypoint.except(1)); set.addShader(ShaderStage{}, {}, entrypoint.exceptSuffix(1));
CORRADE_COMPARE(set.stages().size(), 1); CORRADE_COMPARE(set.stages().size(), 1);
CORRADE_VERIFY(set.stages()[0].pName != entrypoint.data()); CORRADE_VERIFY(set.stages()[0].pName != entrypoint.data());
CORRADE_COMPARE(set.stages()[0].pName, "enterHere"_s); CORRADE_COMPARE(set.stages()[0].pName, "enterHere"_s);

6
src/Magnum/Vk/vk-info.cpp

@ -333,7 +333,7 @@ int main(int argc, char** argv) {
} else for(std::size_t i = instanceFuture; i != Containers::arraySize(versions); ++i) { } else for(std::size_t i = instanceFuture; i != Containers::arraySize(versions); ++i) {
Containers::ArrayView<const Vk::InstanceExtension> extensions = Vk::InstanceExtension::extensions(versions[i]); Containers::ArrayView<const Vk::InstanceExtension> extensions = Vk::InstanceExtension::extensions(versions[i]);
if(extensions.empty()) continue; if(extensions.isEmpty()) continue;
if(versions[i] != Vk::Version::None) if(versions[i] != Vk::Version::None)
Debug{} << versions[i] << "instance extension support:"; Debug{} << versions[i] << "instance extension support:";
@ -366,7 +366,7 @@ int main(int argc, char** argv) {
<< Debug::packed << device.driverVersion(); << Debug::packed << device.driverVersion();
} }
if(devices.empty()) return 0; if(devices.isEmpty()) return 0;
} }
Debug{} << ""; Debug{} << "";
@ -412,7 +412,7 @@ int main(int argc, char** argv) {
} else for(std::size_t i = deviceFuture; i != Containers::arraySize(versions); ++i) { } else for(std::size_t i = deviceFuture; i != Containers::arraySize(versions); ++i) {
Containers::ArrayView<const Vk::Extension> extensions = Vk::Extension::extensions(versions[i]); Containers::ArrayView<const Vk::Extension> extensions = Vk::Extension::extensions(versions[i]);
if(extensions.empty()) continue; if(extensions.isEmpty()) continue;
if(versions[i] != Vk::Version::None) if(versions[i] != Vk::Version::None)
Debug{} << versions[i] << "extension support:"; Debug{} << versions[i] << "extension support:";

20
src/MagnumPlugins/AnyShaderConverter/AnyConverter.cpp

@ -212,7 +212,7 @@ std::pair<bool, Containers::String> AnyConverter::doValidateFile(const Stage sta
} }
/* Check that it can preprocess, in case we were asked to preprocess */ /* Check that it can preprocess, in case we were asked to preprocess */
if((!_state->definitionViews.empty() || (flags() & ConverterFlag::PreprocessOnly)) && !(converter->features() & ConverterFeature::Preprocess)) { if((!_state->definitionViews.isEmpty() || (flags() & ConverterFlag::PreprocessOnly)) && !(converter->features() & ConverterFeature::Preprocess)) {
Error{} << "ShaderTools::AnyConverter::validateFile():" << metadata->name() << "does not support preprocessing"; Error{} << "ShaderTools::AnyConverter::validateFile():" << metadata->name() << "does not support preprocessing";
return {}; return {};
} }
@ -223,7 +223,7 @@ std::pair<bool, Containers::String> AnyConverter::doValidateFile(const Stage sta
converter->setOutputFormat(_state->outputFormat, _state->outputVersion); converter->setOutputFormat(_state->outputFormat, _state->outputVersion);
/* Propagate definitions, if any */ /* Propagate definitions, if any */
if(!_state->definitionViews.empty()) if(!_state->definitionViews.isEmpty())
converter->setDefinitions(_state->definitionViews); converter->setDefinitions(_state->definitionViews);
/* Propagate configuration */ /* Propagate configuration */
@ -269,7 +269,7 @@ std::pair<bool, Containers::String> AnyConverter::doValidateData(const Stage sta
} }
/* Check that it can preprocess, in case we were asked to preprocess */ /* Check that it can preprocess, in case we were asked to preprocess */
if((!_state->definitionViews.empty() || (flags() & ConverterFlag::PreprocessOnly)) && !(converter->features() & ConverterFeature::Preprocess)) { if((!_state->definitionViews.isEmpty() || (flags() & ConverterFlag::PreprocessOnly)) && !(converter->features() & ConverterFeature::Preprocess)) {
Error{} << "ShaderTools::AnyConverter::validateData():" << metadata->name() << "does not support preprocessing"; Error{} << "ShaderTools::AnyConverter::validateData():" << metadata->name() << "does not support preprocessing";
return {}; return {};
} }
@ -280,7 +280,7 @@ std::pair<bool, Containers::String> AnyConverter::doValidateData(const Stage sta
converter->setOutputFormat(_state->outputFormat, _state->outputVersion); converter->setOutputFormat(_state->outputFormat, _state->outputVersion);
/* Propagate definitions, if any */ /* Propagate definitions, if any */
if(!_state->definitionViews.empty()) if(!_state->definitionViews.isEmpty())
converter->setDefinitions(_state->definitionViews); converter->setDefinitions(_state->definitionViews);
/* Propagate configuration */ /* Propagate configuration */
@ -337,7 +337,7 @@ bool AnyConverter::doConvertFileToFile(const Stage stage, const Containers::Stri
} }
/* Check that it can preprocess, in case we were asked to preprocess */ /* Check that it can preprocess, in case we were asked to preprocess */
if((!_state->definitionViews.empty() || (flags() & ConverterFlag::PreprocessOnly)) && !(converter->features() & ConverterFeature::Preprocess)) { if((!_state->definitionViews.isEmpty() || (flags() & ConverterFlag::PreprocessOnly)) && !(converter->features() & ConverterFeature::Preprocess)) {
Error{} << "ShaderTools::AnyConverter::convertFileToFile():" << metadata->name() << "does not support preprocessing"; Error{} << "ShaderTools::AnyConverter::convertFileToFile():" << metadata->name() << "does not support preprocessing";
return {}; return {};
} }
@ -360,7 +360,7 @@ bool AnyConverter::doConvertFileToFile(const Stage stage, const Containers::Stri
converter->setOutputFormat(_state->outputFormat, _state->outputVersion); converter->setOutputFormat(_state->outputFormat, _state->outputVersion);
/* Propagate definitions and debug info, if any */ /* Propagate definitions and debug info, if any */
if(!_state->definitionViews.empty()) if(!_state->definitionViews.isEmpty())
converter->setDefinitions(_state->definitionViews); converter->setDefinitions(_state->definitionViews);
if(!_state->debugInfoLevel.isEmpty()) if(!_state->debugInfoLevel.isEmpty())
converter->setDebugInfoLevel(_state->debugInfoLevel); converter->setDebugInfoLevel(_state->debugInfoLevel);
@ -422,7 +422,7 @@ Containers::Array<char> AnyConverter::doConvertFileToData(const Stage stage, con
} }
/* Check that it can preprocess, in case we were asked to preprocess */ /* Check that it can preprocess, in case we were asked to preprocess */
if((!_state->definitionViews.empty() || (flags() & ConverterFlag::PreprocessOnly)) && !(converter->features() & ConverterFeature::Preprocess)) { if((!_state->definitionViews.isEmpty() || (flags() & ConverterFlag::PreprocessOnly)) && !(converter->features() & ConverterFeature::Preprocess)) {
Error{} << "ShaderTools::AnyConverter::convertFileToData():" << metadata->name() << "does not support preprocessing"; Error{} << "ShaderTools::AnyConverter::convertFileToData():" << metadata->name() << "does not support preprocessing";
return {}; return {};
} }
@ -445,7 +445,7 @@ Containers::Array<char> AnyConverter::doConvertFileToData(const Stage stage, con
converter->setOutputFormat(_state->outputFormat, _state->outputVersion); converter->setOutputFormat(_state->outputFormat, _state->outputVersion);
/* Propagate definitions and debug info, if any */ /* Propagate definitions and debug info, if any */
if(!_state->definitionViews.empty()) if(!_state->definitionViews.isEmpty())
converter->setDefinitions(_state->definitionViews); converter->setDefinitions(_state->definitionViews);
if(!_state->debugInfoLevel.isEmpty()) if(!_state->debugInfoLevel.isEmpty())
converter->setDebugInfoLevel(_state->debugInfoLevel); converter->setDebugInfoLevel(_state->debugInfoLevel);
@ -505,7 +505,7 @@ Containers::Array<char> AnyConverter::doConvertDataToData(const Stage stage, con
} }
/* Check that it can preprocess, in case we were asked to preprocess */ /* Check that it can preprocess, in case we were asked to preprocess */
if((!_state->definitionViews.empty() || (flags() & ConverterFlag::PreprocessOnly)) && !(converter->features() & ConverterFeature::Preprocess)) { if((!_state->definitionViews.isEmpty() || (flags() & ConverterFlag::PreprocessOnly)) && !(converter->features() & ConverterFeature::Preprocess)) {
Error{} << "ShaderTools::AnyConverter::convertDataToData():" << metadata->name() << "does not support preprocessing"; Error{} << "ShaderTools::AnyConverter::convertDataToData():" << metadata->name() << "does not support preprocessing";
return {}; return {};
} }
@ -528,7 +528,7 @@ Containers::Array<char> AnyConverter::doConvertDataToData(const Stage stage, con
converter->setOutputFormat(_state->outputFormat, _state->outputVersion); converter->setOutputFormat(_state->outputFormat, _state->outputVersion);
/* Propagate definitions and debug info, if any */ /* Propagate definitions and debug info, if any */
if(!_state->definitionViews.empty()) if(!_state->definitionViews.isEmpty())
converter->setDefinitions(_state->definitionViews); converter->setDefinitions(_state->definitionViews);
if(!_state->debugInfoLevel.isEmpty()) if(!_state->debugInfoLevel.isEmpty())
converter->setDebugInfoLevel(_state->debugInfoLevel); converter->setDebugInfoLevel(_state->debugInfoLevel);

6
src/MagnumPlugins/ObjImporter/ObjImporter.cpp

@ -401,17 +401,17 @@ Containers::Optional<MeshData> ObjImporter::doMesh(UnsignedInt id, UnsignedInt)
} }
/* There should be at least indexed position data */ /* There should be at least indexed position data */
if(positions.empty() || indices.empty()) { if(positions.isEmpty() || indices.isEmpty()) {
Error() << "Trade::ObjImporter::mesh(): incomplete position data"; Error() << "Trade::ObjImporter::mesh(): incomplete position data";
return Containers::NullOpt; return Containers::NullOpt;
} }
/* If there are index data, there should be also vertex data (and also the other way) */ /* If there are index data, there should be also vertex data (and also the other way) */
if(normals.empty() != (normalIndexCount == 0)) { if(normals.isEmpty() != (normalIndexCount == 0)) {
Error() << "Trade::ObjImporter::mesh(): incomplete normal data"; Error() << "Trade::ObjImporter::mesh(): incomplete normal data";
return Containers::NullOpt; return Containers::NullOpt;
} }
if(textureCoordinates.empty() != (textureCoordinateIndexCount == 0)) { if(textureCoordinates.isEmpty() != (textureCoordinateIndexCount == 0)) {
Error() << "Trade::ObjImporter::mesh(): incomplete texture coordinate data"; Error() << "Trade::ObjImporter::mesh(): incomplete texture coordinate data";
return Containers::NullOpt; return Containers::NullOpt;
} }

2
src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp

@ -69,7 +69,7 @@ Containers::Array<char> TgaImageConverter::doConvertToData(const ImageView2D& im
header->height = UnsignedShort(Utility::Endianness::littleEndian(image.size().y())); header->height = UnsignedShort(Utility::Endianness::littleEndian(image.size().y()));
/* Copy the pixels into output, dropping padding (if any) */ /* Copy the pixels into output, dropping padding (if any) */
const Containers::ArrayView<char> pixels = data.suffix(sizeof(Implementation::TgaHeader)); const Containers::ArrayView<char> pixels = data.exceptPrefix(sizeof(Implementation::TgaHeader));
Utility::copy(image.pixels(), Containers::StridedArrayView3D<char>{pixels, Utility::copy(image.pixels(), Containers::StridedArrayView3D<char>{pixels,
{std::size_t(image.size().y()), std::size_t(image.size().x()), pixelSize}}); {std::size_t(image.size().y()), std::size_t(image.size().x()), pixelSize}});

6
src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp

@ -119,11 +119,11 @@ const struct {
} ShortData[] { } ShortData[] {
{"short header", Containers::arrayView(Color24).prefix(17), {"short header", Containers::arrayView(Color24).prefix(17),
"file too short, expected at least 18 bytes but got 17"}, "file too short, expected at least 18 bytes but got 17"},
{"short data", Containers::arrayView(Color24).except(1), {"short data", Containers::arrayView(Color24).exceptSuffix(1),
"file too short, expected 36 bytes but got 35"}, "file too short, expected 36 bytes but got 35"},
{"short RLE data", Containers::arrayView(Color24Rle).except(1), {"short RLE data", Containers::arrayView(Color24Rle).exceptSuffix(1),
"RLE file too short at pixel 3"}, "RLE file too short at pixel 3"},
{"short RLE raw data", Containers::arrayView(Color24Rle).except(5), {"short RLE raw data", Containers::arrayView(Color24Rle).exceptSuffix(5),
"RLE file too short at pixel 0"} "RLE file too short at pixel 0"}
}; };

10
src/MagnumPlugins/TgaImporter/TgaImporter.cpp

@ -58,7 +58,7 @@ void TgaImporter::doOpenData(Containers::Array<char>&& data, const DataFlags dat
can't do the full import here because then doImage2D() would need to can't do the full import here because then doImage2D() would need to
copy the imported data instead anyway. This way it'll also work nicely copy the imported data instead anyway. This way it'll also work nicely
with a future openMemory(). */ with a future openMemory(). */
if(data.empty()) { if(data.isEmpty()) {
Error{} << "Trade::TgaImporter::openData(): the file is empty"; Error{} << "Trade::TgaImporter::openData(): the file is empty";
return; return;
} }
@ -134,7 +134,7 @@ Containers::Optional<ImageData2D> TgaImporter::doImage2D(UnsignedInt, UnsignedIn
/* Copy data directly if not RLE */ /* Copy data directly if not RLE */
Containers::Array<char> data{outputSize}; Containers::Array<char> data{outputSize};
Containers::ArrayView<const char> srcPixels = _in.suffix(sizeof(Implementation::TgaHeader)); Containers::ArrayView<const char> srcPixels = _in.exceptPrefix(sizeof(Implementation::TgaHeader));
if(!rle) { if(!rle) {
/* Files that are larger are allowed in this case (but not for RLE) */ /* Files that are larger are allowed in this case (but not for RLE) */
if(srcPixels.size() < outputSize) { if(srcPixels.size() < outputSize) {
@ -147,7 +147,7 @@ Containers::Optional<ImageData2D> TgaImporter::doImage2D(UnsignedInt, UnsignedIn
/* Otherwise decode */ /* Otherwise decode */
} else { } else {
Containers::ArrayView<char> dstPixels = data; Containers::ArrayView<char> dstPixels = data;
while(!srcPixels.empty()) { while(!srcPixels.isEmpty()) {
/* Reference: http://www.paulbourke.net/dataformats/tga/ */ /* Reference: http://www.paulbourke.net/dataformats/tga/ */
/* 8-bit RLE header. First bit denotes the operation, last 7 bits /* 8-bit RLE header. First bit denotes the operation, last 7 bits
@ -181,8 +181,8 @@ Containers::Optional<ImageData2D> TgaImporter::doImage2D(UnsignedInt, UnsignedIn
Utility::copy(src, dst); Utility::copy(src, dst);
/* Update views for the next round */ /* Update views for the next round */
srcPixels = srcPixels.suffix(1 + dataSize); srcPixels = srcPixels.exceptPrefix(1 + dataSize);
dstPixels = dstPixels.suffix(count*pixelSize); dstPixels = dstPixels.exceptPrefix(count*pixelSize);
} }
} }

2
src/MagnumPlugins/WavAudioImporter/Test/WavImporterTest.cpp

@ -215,7 +215,7 @@ void WavImporterTest::zeroSamples() {
CORRADE_VERIFY(importer->openFile(Utility::Path::join(WAVAUDIOIMPORTER_TEST_DIR, "zeroSamples.wav"))); CORRADE_VERIFY(importer->openFile(Utility::Path::join(WAVAUDIOIMPORTER_TEST_DIR, "zeroSamples.wav")));
CORRADE_COMPARE(importer->format(), BufferFormat::Mono16); CORRADE_COMPARE(importer->format(), BufferFormat::Mono16);
CORRADE_COMPARE(importer->frequency(), 22050); CORRADE_COMPARE(importer->frequency(), 22050);
CORRADE_VERIFY(importer->data().empty()); CORRADE_VERIFY(importer->data().isEmpty());
} }
void WavImporterTest::mono4() { void WavImporterTest::mono4() {

Loading…
Cancel
Save