Browse Source

Shaders: use `.slice(&Color4ub::rgb)` instead of `arrayCast<Color3ub>()`.

Less error-prone because of full type safety and much nicer overall. The
test code originates from a time before slice-to-a-member-function was a
thing and then it got just copied everywhere without much thought.
pull/674/head
Vladimír Vondruš 1 year ago
parent
commit
f92e16e7e0
  1. 2
      src/Magnum/GL/Test/RendererGLTest.cpp
  2. 14
      src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp
  3. 48
      src/Magnum/Shaders/Test/FlatGLTest.cpp
  4. 26
      src/Magnum/Shaders/Test/LineGLTest.cpp
  5. 62
      src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp
  6. 46
      src/Magnum/Shaders/Test/PhongGLTest.cpp
  7. 12
      src/Magnum/Shaders/Test/VectorGLTest.cpp
  8. 12
      src/Magnum/Shaders/Test/VertexColorGLTest.cpp

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

@ -246,7 +246,7 @@ void RendererGLTest::pointCoord() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {Magnum::PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {Magnum::PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "pointcoord.tga"), Utility::Path::join(_testDir, "pointcoord.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }

14
src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp

@ -1022,7 +1022,7 @@ template<DistanceFieldVectorGL2D::Flag flag> void DistanceFieldVectorGLTest::ren
sharp default shininess it can't be exact */ sharp default shininess it can't be exact */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "VectorTestFiles/defaults.tga"), Utility::Path::join(_testDir, "VectorTestFiles/defaults.tga"),
(DebugTools::CompareImageToFile{_manager, 131.0f, 1.83f})); (DebugTools::CompareImageToFile{_manager, 131.0f, 1.83f}));
@ -1036,7 +1036,7 @@ template<DistanceFieldVectorGL2D::Flag flag> void DistanceFieldVectorGLTest::ren
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "VectorTestFiles/defaults-distancefield.tga"), Utility::Path::join(_testDir, "VectorTestFiles/defaults-distancefield.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -1132,7 +1132,7 @@ template<DistanceFieldVectorGL3D::Flag flag> void DistanceFieldVectorGLTest::ren
sharp default shininess it can't be exact */ sharp default shininess it can't be exact */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "VectorTestFiles/defaults.tga"), Utility::Path::join(_testDir, "VectorTestFiles/defaults.tga"),
(DebugTools::CompareImageToFile{_manager, 131.0f, 1.83f})); (DebugTools::CompareImageToFile{_manager, 131.0f, 1.83f}));
@ -1146,7 +1146,7 @@ template<DistanceFieldVectorGL3D::Flag flag> void DistanceFieldVectorGLTest::ren
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "VectorTestFiles/defaults-distancefield.tga"), Utility::Path::join(_testDir, "VectorTestFiles/defaults-distancefield.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -1320,7 +1320,7 @@ template<DistanceFieldVectorGL2D::Flag flag> void DistanceFieldVectorGLTest::ren
Image2D rendered = _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}); Image2D rendered = _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm});
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::StridedArrayView2D<Color3ub> pixels = Containers::StridedArrayView2D<Color3ub> pixels =
Containers::arrayCast<Color3ub>(rendered.pixels<Color4ub>()); rendered.pixels<Color4ub>().slice(&Color4ub::rgb);
if(data.flip) pixels = pixels.flipped<0>().flipped<1>(); if(data.flip) pixels = pixels.flipped<0>().flipped<1>();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL)) #if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
@ -1819,7 +1819,7 @@ void DistanceFieldVectorGLTest::renderMulti2D() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "VectorTestFiles", data.expected2D}), Utility::Path::join({_testDir, "VectorTestFiles", data.expected2D}),
(DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold}));
} }
@ -2124,7 +2124,7 @@ void DistanceFieldVectorGLTest::renderMulti3D() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "VectorTestFiles", data.expected3D}), Utility::Path::join({_testDir, "VectorTestFiles", data.expected3D}),
(DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold}));
} }

48
src/Magnum/Shaders/Test/FlatGLTest.cpp

@ -1889,7 +1889,7 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderDefaults2D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "FlatTestFiles/defaults.tga"), Utility::Path::join(_testDir, "FlatTestFiles/defaults.tga"),
/* SwiftShader has 8 different pixels on the edges */ /* SwiftShader has 8 different pixels on the edges */
(DebugTools::CompareImageToFile{_manager, 238.0f, 0.2975f})); (DebugTools::CompareImageToFile{_manager, 238.0f, 0.2975f}));
@ -1965,7 +1965,7 @@ template<FlatGL3D::Flag flag> void FlatGLTest::renderDefaults3D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "FlatTestFiles/defaults.tga"), Utility::Path::join(_testDir, "FlatTestFiles/defaults.tga"),
/* SwiftShader has 8 different pixels on the edges */ /* SwiftShader has 8 different pixels on the edges */
(DebugTools::CompareImageToFile{_manager, 238.0f, 0.2975f})); (DebugTools::CompareImageToFile{_manager, 238.0f, 0.2975f}));
@ -2052,7 +2052,7 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderColored2D() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "FlatTestFiles/colored2D.tga"), Utility::Path::join(_testDir, "FlatTestFiles/colored2D.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -2148,7 +2148,7 @@ template<FlatGL3D::Flag flag> void FlatGLTest::renderColored3D() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "FlatTestFiles/colored3D.tga"), Utility::Path::join(_testDir, "FlatTestFiles/colored3D.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -2298,7 +2298,7 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderSinglePixelTextured2D() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "FlatTestFiles/colored2D.tga"), Utility::Path::join(_testDir, "FlatTestFiles/colored2D.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -2443,7 +2443,7 @@ template<FlatGL3D::Flag flag> void FlatGLTest::renderSinglePixelTextured3D() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "FlatTestFiles/colored3D.tga"), Utility::Path::join(_testDir, "FlatTestFiles/colored3D.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -2582,7 +2582,7 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderTextured2D() {
Image2D rendered = _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}); Image2D rendered = _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm});
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::StridedArrayView2D<Color3ub> pixels = Containers::StridedArrayView2D<Color3ub> pixels =
Containers::arrayCast<Color3ub>(rendered.pixels<Color4ub>()); rendered.pixels<Color4ub>().slice(&Color4ub::rgb);
if(data.flip) pixels = pixels.flipped<0>().flipped<1>(); if(data.flip) pixels = pixels.flipped<0>().flipped<1>();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL)) #if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
@ -2741,7 +2741,7 @@ template<FlatGL3D::Flag flag> void FlatGLTest::renderTextured3D() {
Image2D rendered = _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}); Image2D rendered = _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm});
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::StridedArrayView2D<Color3ub> pixels = Containers::StridedArrayView2D<Color3ub> pixels =
Containers::arrayCast<Color3ub>(rendered.pixels<Color4ub>()); rendered.pixels<Color4ub>().slice(&Color4ub::rgb);
if(data.flip) pixels = pixels.flipped<0>().flipped<1>(); if(data.flip) pixels = pixels.flipped<0>().flipped<1>();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL)) #if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
@ -2863,7 +2863,7 @@ template<class T, FlatGL2D::Flag flag> void FlatGLTest::renderVertexColor2D() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "FlatTestFiles/vertexColor2D.tga"), Utility::Path::join(_testDir, "FlatTestFiles/vertexColor2D.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -2984,7 +2984,7 @@ template<class T, FlatGL2D::Flag flag> void FlatGLTest::renderVertexColor3D() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "FlatTestFiles/vertexColor3D.tga"), Utility::Path::join(_testDir, "FlatTestFiles/vertexColor3D.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -3107,7 +3107,7 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderAlpha2D() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, data.expected2D), Utility::Path::join(_testDir, data.expected2D),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -3237,7 +3237,7 @@ template<FlatGL3D::Flag flag> void FlatGLTest::renderAlpha3D() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, data.expected3D}), Utility::Path::join({_testDir, data.expected3D}),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -3387,7 +3387,7 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderObjectId2D() {
const Float maxThreshold = 0.0f, meanThreshold = 0.0f; const Float maxThreshold = 0.0f, meanThreshold = 0.0f;
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "FlatTestFiles/colored2D.tga"), Utility::Path::join(_testDir, "FlatTestFiles/colored2D.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
@ -3569,7 +3569,7 @@ template<FlatGL3D::Flag flag> void FlatGLTest::renderObjectId3D() {
CORRADE_COMPARE(_framebuffer.checkStatus(GL::FramebufferTarget::Read), GL::Framebuffer::Status::Complete); CORRADE_COMPARE(_framebuffer.checkStatus(GL::FramebufferTarget::Read), GL::Framebuffer::Status::Complete);
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "FlatTestFiles/colored3D.tga"), Utility::Path::join(_testDir, "FlatTestFiles/colored3D.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
@ -3743,7 +3743,7 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderSkinning2D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "TestFiles", data.expected}), Utility::Path::join({_testDir, "TestFiles", data.expected}),
(DebugTools::CompareImageToFile{_manager})); (DebugTools::CompareImageToFile{_manager}));
} }
@ -3896,7 +3896,7 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderSkinning3D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "TestFiles", data.expected}), Utility::Path::join({_testDir, "TestFiles", data.expected}),
(DebugTools::CompareImageToFile{_manager})); (DebugTools::CompareImageToFile{_manager}));
} }
@ -4222,7 +4222,7 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderInstanced2D() {
*/ */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "FlatTestFiles", data.expected2D}), Utility::Path::join({_testDir, "FlatTestFiles", data.expected2D}),
(DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold}));
@ -4573,7 +4573,7 @@ template<FlatGL3D::Flag flag> void FlatGLTest::renderInstanced3D() {
*/ */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "FlatTestFiles", data.expected3D}), Utility::Path::join({_testDir, "FlatTestFiles", data.expected3D}),
(DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold}));
@ -4741,7 +4741,7 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderInstancedSkinning2D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "TestFiles/skinning-instanced.tga"), Utility::Path::join(_testDir, "TestFiles/skinning-instanced.tga"),
(DebugTools::CompareImageToFile{_manager})); (DebugTools::CompareImageToFile{_manager}));
} }
@ -4890,7 +4890,7 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderInstancedSkinning3D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "TestFiles/skinning-instanced.tga"), Utility::Path::join(_testDir, "TestFiles/skinning-instanced.tga"),
(DebugTools::CompareImageToFile{_manager})); (DebugTools::CompareImageToFile{_manager}));
} }
@ -5242,7 +5242,7 @@ void FlatGLTest::renderMulti2D() {
*/ */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "FlatTestFiles", data.expected2D}), Utility::Path::join({_testDir, "FlatTestFiles", data.expected2D}),
(DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold}));
@ -5614,7 +5614,7 @@ void FlatGLTest::renderMulti3D() {
*/ */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "FlatTestFiles", data.expected3D}), Utility::Path::join({_testDir, "FlatTestFiles", data.expected3D}),
(DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold}));
@ -5881,7 +5881,7 @@ void FlatGLTest::renderMultiSkinning2D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "TestFiles/skinning-multi.tga"), Utility::Path::join(_testDir, "TestFiles/skinning-multi.tga"),
(DebugTools::CompareImageToFile{_manager})); (DebugTools::CompareImageToFile{_manager}));
} }
@ -6133,7 +6133,7 @@ void FlatGLTest::renderMultiSkinning3D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "TestFiles/skinning-multi.tga"), Utility::Path::join(_testDir, "TestFiles/skinning-multi.tga"),
(DebugTools::CompareImageToFile{_manager})); (DebugTools::CompareImageToFile{_manager}));
} }

26
src/Magnum/Shaders/Test/LineGLTest.cpp

@ -1257,7 +1257,7 @@ template<LineGL2D::Flag flag> void LineGLTest::renderDefaults2D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/defaults.tga"), Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/defaults.tga"),
(DebugTools::CompareImageToFile{_manager})); (DebugTools::CompareImageToFile{_manager}));
} }
@ -1355,7 +1355,7 @@ template<LineGL3D::Flag flag> void LineGLTest::renderDefaults3D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/defaults.tga"), Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/defaults.tga"),
(DebugTools::CompareImageToFile{_manager})); (DebugTools::CompareImageToFile{_manager}));
} }
@ -1514,7 +1514,7 @@ template<LineGL2D::Flag flag> void LineGLTest::renderLineCapsJoins2D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(image.pixels<Color4ub>()), image.pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({SHADERS_TEST_DIR, "LineTestFiles", data.expected}), Utility::Path::join({SHADERS_TEST_DIR, "LineTestFiles", data.expected}),
/* Minor differences on NVidia vs Mesa Intel vs SwiftShader */ /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */
(DebugTools::CompareImageToFile{_manager, 119.0f, 0.111f})); (DebugTools::CompareImageToFile{_manager, 119.0f, 0.111f}));
@ -1578,7 +1578,7 @@ void LineGLTest::renderLineCapsJoins2DReversed() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({SHADERS_TEST_DIR, "LineTestFiles", data.expected}), Utility::Path::join({SHADERS_TEST_DIR, "LineTestFiles", data.expected}),
/* Minor differences on NVidia vs Mesa Intel vs SwiftShader */ /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */
/** @todo sync this with render2D() once the overlaps are fixed */ /** @todo sync this with render2D() once the overlaps are fixed */
@ -1638,7 +1638,7 @@ void LineGLTest::renderLineCapsJoins2DTransformed() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({SHADERS_TEST_DIR, "LineTestFiles", data.expected}), Utility::Path::join({SHADERS_TEST_DIR, "LineTestFiles", data.expected}),
/* Minor differences on NVidia vs Mesa Intel vs SwiftShader */ /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */
(DebugTools::CompareImageToFile{_manager, 119.0f, 0.112f})); (DebugTools::CompareImageToFile{_manager, 119.0f, 0.112f}));
@ -1841,7 +1841,7 @@ template<LineGL3D::Flag flag> void LineGLTest::renderCube3D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({SHADERS_TEST_DIR, "LineTestFiles", data.expected}), Utility::Path::join({SHADERS_TEST_DIR, "LineTestFiles", data.expected}),
/* Minor differences on NVidia vs Mesa Intel vs SwiftShader */ /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */
(DebugTools::CompareImageToFile{_manager, 119.0f, 0.102f})); (DebugTools::CompareImageToFile{_manager, 119.0f, 0.102f}));
@ -1876,7 +1876,7 @@ void LineGLTest::renderPerspective3D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/perspective3D.tga"), Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/perspective3D.tga"),
/* Minor differences on SwiftShader */ /* Minor differences on SwiftShader */
(DebugTools::CompareImageToFile{_manager, 6.0f, 0.025f})); (DebugTools::CompareImageToFile{_manager, 6.0f, 0.025f}));
@ -1987,7 +1987,7 @@ template<class T, LineGL2D::Flag flag> void LineGLTest::renderVertexColor2D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/vertex-color.tga"), Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/vertex-color.tga"),
/* Minor differences on NVidia vs Mesa Intel vs SwiftShader */ /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */
(DebugTools::CompareImageToFile{_manager, 1.34f, 0.028f})); (DebugTools::CompareImageToFile{_manager, 1.34f, 0.028f}));
@ -2101,7 +2101,7 @@ template<class T, LineGL3D::Flag flag> void LineGLTest::renderVertexColor3D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/vertex-color.tga"), Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/vertex-color.tga"),
/* Minor differences on NVidia vs Mesa Intel vs SwiftShader */ /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */
(DebugTools::CompareImageToFile{_manager, 1.34f, 0.028f})); (DebugTools::CompareImageToFile{_manager, 1.34f, 0.028f}));
@ -2455,7 +2455,7 @@ template<LineGL2D::Flag flag> void LineGLTest::renderInstanced2D() {
- Third up center, magenta with a yellow base color, so red */ - Third up center, magenta with a yellow base color, so red */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/instanced.tga"), Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/instanced.tga"),
/* Minor differences on NVidia vs Mesa Intel vs SwiftShader */ /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */
(DebugTools::CompareImageToFile{_manager, 17.0f, 0.107f})); (DebugTools::CompareImageToFile{_manager, 17.0f, 0.107f}));
@ -2611,7 +2611,7 @@ template<LineGL3D::Flag flag> void LineGLTest::renderInstanced3D() {
- Third up center, magenta with a yellow base color, so red */ - Third up center, magenta with a yellow base color, so red */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/instanced.tga"), Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/instanced.tga"),
/* Minor differences on NVidia vs Mesa Intel vs SwiftShader */ /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */
(DebugTools::CompareImageToFile{_manager, 17.0f, 0.107f})); (DebugTools::CompareImageToFile{_manager, 17.0f, 0.107f}));
@ -2845,7 +2845,7 @@ void LineGLTest::renderMulti2D() {
- Point up center, red */ - Point up center, red */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/multidraw.tga"), Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/multidraw.tga"),
/* Minor differences on NVidia vs Mesa Intel, also on ARM Mali */ /* Minor differences on NVidia vs Mesa Intel, also on ARM Mali */
(DebugTools::CompareImageToFile{_manager, 0.67f, 0.011f})); (DebugTools::CompareImageToFile{_manager, 0.67f, 0.011f}));
@ -3076,7 +3076,7 @@ void LineGLTest::renderMulti3D() {
- Point up center, red */ - Point up center, red */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/multidraw.tga"), Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/multidraw.tga"),
/* Minor differences on NVidia vs Mesa Intel, also on ARM Mali */ /* Minor differences on NVidia vs Mesa Intel, also on ARM Mali */
(DebugTools::CompareImageToFile{_manager, 0.67f, 0.011f})); (DebugTools::CompareImageToFile{_manager, 0.67f, 0.011f}));

62
src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp

@ -3266,7 +3266,7 @@ template<MeshVisualizerGL2D::Flag flag> void MeshVisualizerGLTest::renderDefault
CORRADE_EXPECT_FAIL("Defaults don't work for wireframe as line width is derived from viewport size."); CORRADE_EXPECT_FAIL("Defaults don't work for wireframe as line width is derived from viewport size.");
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-wireframe2D.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-wireframe2D.tga"),
(DebugTools::CompareImageToFile{_manager})); (DebugTools::CompareImageToFile{_manager}));
} }
@ -3302,7 +3302,7 @@ template<MeshVisualizerGL2D::Flag flag> void MeshVisualizerGLTest::renderDefault
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-wireframe2D.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-wireframe2D.tga"),
/* AMD has off-by-one errors on edges compared to Intel */ /* AMD has off-by-one errors on edges compared to Intel */
(DebugTools::CompareImageToFile{_manager, 1.0f, 0.082f})); (DebugTools::CompareImageToFile{_manager, 1.0f, 0.082f}));
@ -3388,7 +3388,7 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderDefault
CORRADE_EXPECT_FAIL("Defaults don't work for wireframe as line width is derived from viewport size."); CORRADE_EXPECT_FAIL("Defaults don't work for wireframe as line width is derived from viewport size.");
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-wireframe3D.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-wireframe3D.tga"),
(DebugTools::CompareImageToFile{_manager})); (DebugTools::CompareImageToFile{_manager}));
} }
@ -3428,7 +3428,7 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderDefault
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-wireframe3D.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-wireframe3D.tga"),
/* AMD has off-by-one errors on edges compared to Intel */ /* AMD has off-by-one errors on edges compared to Intel */
(DebugTools::CompareImageToFile{_manager, 1.0f, 0.06f})); (DebugTools::CompareImageToFile{_manager, 1.0f, 0.06f}));
@ -3506,7 +3506,7 @@ template<MeshVisualizerGL2D::Flag flag> void MeshVisualizerGLTest::renderDefault
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-objectid2D.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-objectid2D.tga"),
/* SwiftShader has a few rounding errors on edges */ /* SwiftShader has a few rounding errors on edges */
(DebugTools::CompareImageToFile{_manager, 24.67f, 0.11f})); (DebugTools::CompareImageToFile{_manager, 24.67f, 0.11f}));
@ -3586,7 +3586,7 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderDefault
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-objectid3D.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-objectid3D.tga"),
/* SwiftShader has a few rounding errors on edges and off-by-two /* SwiftShader has a few rounding errors on edges and off-by-two
pixels */ pixels */
@ -3686,7 +3686,7 @@ template<MeshVisualizerGL2D::Flag flag> void MeshVisualizerGLTest::renderDefault
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-instancedobjectid2D.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-instancedobjectid2D.tga"),
/* SwiftShader has a few rounding errors on edges */ /* SwiftShader has a few rounding errors on edges */
(DebugTools::CompareImageToFile{_manager, 150.67f, 0.45f})); (DebugTools::CompareImageToFile{_manager, 150.67f, 0.45f}));
@ -3789,7 +3789,7 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderDefault
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-instancedobjectid3D.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-instancedobjectid3D.tga"),
/* SwiftShader has a few rounding errors on edges */ /* SwiftShader has a few rounding errors on edges */
(DebugTools::CompareImageToFile{_manager, 150.67f, 0.165f})); (DebugTools::CompareImageToFile{_manager, 150.67f, 0.165f}));
@ -3864,7 +3864,7 @@ template<MeshVisualizerGL2D::Flag flag> void MeshVisualizerGLTest::renderDefault
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-vertexid2D.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-vertexid2D.tga"),
/* Minor differences on NVidia */ /* Minor differences on NVidia */
(DebugTools::CompareImageToFile{_manager, 1.0f, 0.022f})); (DebugTools::CompareImageToFile{_manager, 1.0f, 0.022f}));
@ -3943,7 +3943,7 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderDefault
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-vertexid3D.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-vertexid3D.tga"),
/* Minor differences on NVidia */ /* Minor differences on NVidia */
(DebugTools::CompareImageToFile{_manager, 1.0f, 0.018f})); (DebugTools::CompareImageToFile{_manager, 1.0f, 0.018f}));
@ -4047,7 +4047,7 @@ template<MeshVisualizerGL2D::Flag flag> void MeshVisualizerGLTest::renderDefault
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-primitiveid2D.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-primitiveid2D.tga"),
/* SwiftShader has a few rounding errors on edges */ /* SwiftShader has a few rounding errors on edges */
(DebugTools::CompareImageToFile{_manager, 76.67f, 0.23f})); (DebugTools::CompareImageToFile{_manager, 76.67f, 0.23f}));
@ -4155,7 +4155,7 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderDefault
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-primitiveid3D.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-primitiveid3D.tga"),
/* SwiftShader has a few rounding errors on edges */ /* SwiftShader has a few rounding errors on edges */
(DebugTools::CompareImageToFile{_manager, 88.34f, 0.071f})); (DebugTools::CompareImageToFile{_manager, 88.34f, 0.071f}));
@ -4237,7 +4237,7 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderDefault
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-tbn.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/defaults-tbn.tga"),
/* AMD has off-by-one errors on edges compared to Intel */ /* AMD has off-by-one errors on edges compared to Intel */
(DebugTools::CompareImageToFile{_manager, 1.0f, 0.06f})); (DebugTools::CompareImageToFile{_manager, 1.0f, 0.06f}));
@ -4376,7 +4376,7 @@ template<MeshVisualizerGL2D::Flag flag> void MeshVisualizerGLTest::renderWirefra
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.file}), Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.file}),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -4393,7 +4393,7 @@ template<MeshVisualizerGL2D::Flag flag> void MeshVisualizerGLTest::renderWirefra
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.fileXfail}), Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.fileXfail}),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -4547,7 +4547,7 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderWirefra
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.file}), Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.file}),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -4564,7 +4564,7 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderWirefra
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.fileXfail}), Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.fileXfail}),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -4780,7 +4780,7 @@ template<MeshVisualizerGL2D::Flag flag> void MeshVisualizerGLTest::renderObjectV
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.file2D}), Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.file2D}),
/* AMD has slight off-by-one errors compared to Intel, SwiftShader a /* AMD has slight off-by-one errors compared to Intel, SwiftShader a
bit more */ bit more */
@ -5015,7 +5015,7 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderObjectV
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.file3D}), Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.file3D}),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -5059,7 +5059,7 @@ void MeshVisualizerGLTest::renderWireframe3DPerspective() {
/* Slight rasterization differences on AMD. */ /* Slight rasterization differences on AMD. */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/wireframe-perspective.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/wireframe-perspective.tga"),
(DebugTools::CompareImageToFile{_manager, 0.667f, 0.002f})); (DebugTools::CompareImageToFile{_manager, 0.667f, 0.002f}));
} }
@ -5270,7 +5270,7 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderTangent
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.file}), Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.file}),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -5433,7 +5433,7 @@ template<MeshVisualizerGL2D::Flag flag> void MeshVisualizerGLTest::renderSkinnin
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.expected}), Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.expected}),
/* Minor differences on ARM Mali */ /* Minor differences on ARM Mali */
(DebugTools::CompareImageToFile{_manager, 1.0f, 0.012f})); (DebugTools::CompareImageToFile{_manager, 1.0f, 0.012f}));
@ -5599,7 +5599,7 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderSkinnin
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.expected}), Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.expected}),
/* Minor differences on ARM Mali */ /* Minor differences on ARM Mali */
(DebugTools::CompareImageToFile{_manager, 1.0f, 0.012f})); (DebugTools::CompareImageToFile{_manager, 1.0f, 0.012f}));
@ -5899,7 +5899,7 @@ template<MeshVisualizerGL2D::Flag flag> void MeshVisualizerGLTest::renderInstanc
*/ */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.expected}), Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.expected}),
(DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold}));
} }
@ -6226,7 +6226,7 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderInstanc
*/ */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.expected}), Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.expected}),
(DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold}));
} }
@ -6384,7 +6384,7 @@ template<MeshVisualizerGL2D::Flag flag> void MeshVisualizerGLTest::renderInstanc
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/skinning-instanced.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/skinning-instanced.tga"),
/* SwiftShader has minor differences in the output, ARM Mali too, /* SwiftShader has minor differences in the output, ARM Mali too,
NVidia as well */ NVidia as well */
@ -6546,7 +6546,7 @@ template<MeshVisualizerGL3D::Flag flag> void MeshVisualizerGLTest::renderInstanc
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/skinning-instanced.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/skinning-instanced.tga"),
/* SwiftShader has minor differences in the output, ARM Mali too, /* SwiftShader has minor differences in the output, ARM Mali too,
NVidia as well */ NVidia as well */
@ -6890,7 +6890,7 @@ void MeshVisualizerGLTest::renderMulti2D() {
*/ */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.expected}), Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.expected}),
(DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold}));
} }
@ -7241,7 +7241,7 @@ void MeshVisualizerGLTest::renderMulti3D() {
*/ */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.expected}), Utility::Path::join({_testDir, "MeshVisualizerTestFiles", data.expected}),
(DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold}));
} }
@ -7492,7 +7492,7 @@ void MeshVisualizerGLTest::renderMultiSkinningWireframe2D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/skinning-multi.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/skinning-multi.tga"),
(DebugTools::CompareImageToFile{_manager})); (DebugTools::CompareImageToFile{_manager}));
} }
@ -7745,7 +7745,7 @@ void MeshVisualizerGLTest::renderMultiSkinningWireframe3D() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "MeshVisualizerTestFiles/skinning-multi.tga"), Utility::Path::join(_testDir, "MeshVisualizerTestFiles/skinning-multi.tga"),
(DebugTools::CompareImageToFile{_manager})); (DebugTools::CompareImageToFile{_manager}));
} }

46
src/Magnum/Shaders/Test/PhongGLTest.cpp

@ -2386,7 +2386,7 @@ template<PhongGL::Flag flag> void PhongGLTest::renderDefaults() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "PhongTestFiles/defaults.tga"), Utility::Path::join(_testDir, "PhongTestFiles/defaults.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -2527,7 +2527,7 @@ template<PhongGL::Flag flag> void PhongGLTest::renderColored() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "PhongTestFiles/colored.tga"), Utility::Path::join(_testDir, "PhongTestFiles/colored.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -2750,7 +2750,7 @@ template<PhongGL::Flag flag> void PhongGLTest::renderSinglePixelTextured() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "PhongTestFiles/colored.tga"), Utility::Path::join(_testDir, "PhongTestFiles/colored.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -3013,7 +3013,7 @@ template<PhongGL::Flag flag> void PhongGLTest::renderTextured() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "PhongTestFiles", data.expected}), Utility::Path::join({_testDir, "PhongTestFiles", data.expected}),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -3213,7 +3213,7 @@ template<PhongGL::Flag flag> void PhongGLTest::renderTexturedNormal() {
Image2D actual = _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}); Image2D actual = _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm});
Containers::StridedArrayView2D<Color3ub> pixels = Containers::StridedArrayView2D<Color3ub> pixels =
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(actual.pixels<Color4ub>()); actual.pixels<Color4ub>().slice(&Color4ub::rgb);
/* Rotate pixels back to upright position so we can compare with the 0° /* Rotate pixels back to upright position so we can compare with the 0°
file and ensure the tangent calculation is transformation invariant */ file and ensure the tangent calculation is transformation invariant */
@ -3384,7 +3384,7 @@ template<class T, PhongGL::Flag flag> void PhongGLTest::renderVertexColor() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "PhongTestFiles/vertexColor.tga"), Utility::Path::join(_testDir, "PhongTestFiles/vertexColor.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -3521,7 +3521,7 @@ template<PhongGL::Flag flag> void PhongGLTest::renderShininess() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "PhongTestFiles", data.expected}), Utility::Path::join({_testDir, "PhongTestFiles", data.expected}),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -3543,7 +3543,7 @@ template<PhongGL::Flag flag> void PhongGLTest::renderShininess() {
) { ) {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "PhongTestFiles", "shininess0-overflow.tga"}), Utility::Path::join({_testDir, "PhongTestFiles", "shininess0-overflow.tga"}),
/* The threshold = 0.001 case has a slight reddish tone on /* The threshold = 0.001 case has a slight reddish tone on
SwiftShader; ARM Mali has one pixel off */ SwiftShader; ARM Mali has one pixel off */
@ -3735,7 +3735,7 @@ template<PhongGL::Flag flag> void PhongGLTest::renderAlpha() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, data.expected), Utility::Path::join(_testDir, data.expected),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -3914,7 +3914,7 @@ template<PhongGL::Flag flag> void PhongGLTest::renderObjectId() {
const Float maxThreshold = 12.67f, meanThreshold = 0.113f; const Float maxThreshold = 12.67f, meanThreshold = 0.113f;
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "PhongTestFiles/colored.tga"), Utility::Path::join(_testDir, "PhongTestFiles/colored.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
@ -4053,7 +4053,7 @@ template<PhongGL::Flag flag> void PhongGLTest::renderLights() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
const Image2D image = _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}); Image2D image = _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm});
/* Analytical output check. Comment this out when image comparison fails /* Analytical output check. Comment this out when image comparison fails
for easier debugging. */ for easier debugging. */
@ -4070,7 +4070,7 @@ template<PhongGL::Flag flag> void PhongGLTest::renderLights() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<const Color3ub>(image.pixels<Color4ub>()), image.pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "PhongTestFiles", data.file}), Utility::Path::join({_testDir, "PhongTestFiles", data.file}),
/* Minor differences on ES2 and on NVidia */ /* Minor differences on ES2 and on NVidia */
(DebugTools::CompareImageToFile{_manager, 3.0f, 0.27f})); (DebugTools::CompareImageToFile{_manager, 3.0f, 0.27f}));
@ -4117,7 +4117,7 @@ void PhongGLTest::renderLightsSetOneByOne() {
} }
#endif #endif
const Image2D image = _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}); Image2D image = _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm});
if(!(_manager.loadState("AnyImageImporter") & PluginManager::LoadState::Loaded) || if(!(_manager.loadState("AnyImageImporter") & PluginManager::LoadState::Loaded) ||
!(_manager.loadState("TgaImporter") & PluginManager::LoadState::Loaded)) !(_manager.loadState("TgaImporter") & PluginManager::LoadState::Loaded))
@ -4131,7 +4131,7 @@ void PhongGLTest::renderLightsSetOneByOne() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<const Color3ub>(image.pixels<Color4ub>()), image.pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "PhongTestFiles/light-point-range1.5.tga"}), Utility::Path::join({_testDir, "PhongTestFiles/light-point-range1.5.tga"}),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -4174,7 +4174,7 @@ void PhongGLTest::renderLowLightAngle() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "PhongTestFiles/low-light-angle.tga"), Utility::Path::join(_testDir, "PhongTestFiles/low-light-angle.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -4266,7 +4266,7 @@ void PhongGLTest::renderLightCulling() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "PhongTestFiles/colored.tga"), Utility::Path::join(_testDir, "PhongTestFiles/colored.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -4452,7 +4452,7 @@ template<PhongGL::Flag flag> void PhongGLTest::renderZeroLights() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
/* Should be equivalent to masked Flat3D */ /* Should be equivalent to masked Flat3D */
Utility::Path::join(_testDir, "FlatTestFiles/textured3D-alpha-mask0.5.tga"), Utility::Path::join(_testDir, "FlatTestFiles/textured3D-alpha-mask0.5.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
@ -4552,7 +4552,7 @@ void PhongGLTest::renderDoubleSided() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "PhongTestFiles/double-sided.tga"), Utility::Path::join(_testDir, "PhongTestFiles/double-sided.tga"),
(DebugTools::CompareImageToFile{_manager, 1.34f, 0.04f})); (DebugTools::CompareImageToFile{_manager, 1.34f, 0.04f}));
} }
@ -4715,7 +4715,7 @@ template<PhongGL::Flag flag> void PhongGLTest::renderSkinning() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "TestFiles", data.expected}), Utility::Path::join({_testDir, "TestFiles", data.expected}),
(DebugTools::CompareImageToFile{_manager})); (DebugTools::CompareImageToFile{_manager}));
} }
@ -5143,7 +5143,7 @@ template<PhongGL::Flag flag> void PhongGLTest::renderInstanced() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "PhongTestFiles", data.expected}), Utility::Path::join({_testDir, "PhongTestFiles", data.expected}),
(DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold}));
@ -5317,7 +5317,7 @@ template<PhongGL::Flag flag> void PhongGLTest::renderInstancedSkinning() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "TestFiles/skinning-instanced.tga"), Utility::Path::join(_testDir, "TestFiles/skinning-instanced.tga"),
(DebugTools::CompareImageToFile{_manager})); (DebugTools::CompareImageToFile{_manager}));
} }
@ -5724,7 +5724,7 @@ void PhongGLTest::renderMulti() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "PhongTestFiles", data.expected}), Utility::Path::join({_testDir, "PhongTestFiles", data.expected}),
(DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold}));
@ -5995,7 +5995,7 @@ void PhongGLTest::renderMultiSkinning() {
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "TestFiles/skinning-multi.tga"), Utility::Path::join(_testDir, "TestFiles/skinning-multi.tga"),
(DebugTools::CompareImageToFile{_manager})); (DebugTools::CompareImageToFile{_manager}));
} }

12
src/Magnum/Shaders/Test/VectorGLTest.cpp

@ -1015,7 +1015,7 @@ template<VectorGL2D::Flag flag> void VectorGLTest::renderDefaults2D() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "VectorTestFiles/defaults.tga"), Utility::Path::join(_testDir, "VectorTestFiles/defaults.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -1117,7 +1117,7 @@ template<VectorGL3D::Flag flag> void VectorGLTest::renderDefaults3D() {
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "VectorTestFiles/defaults.tga"), Utility::Path::join(_testDir, "VectorTestFiles/defaults.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -1291,7 +1291,7 @@ template<VectorGL2D::Flag flag> void VectorGLTest::render2D() {
Image2D rendered = _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}); Image2D rendered = _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm});
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::StridedArrayView2D<Color3ub> pixels = Containers::StridedArrayView2D<Color3ub> pixels =
Containers::arrayCast<Color3ub>(rendered.pixels<Color4ub>()); rendered.pixels<Color4ub>().slice(&Color4ub::rgb);
if(data.flip) pixels = pixels.flipped<0>().flipped<1>(); if(data.flip) pixels = pixels.flipped<0>().flipped<1>();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL)) #if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
@ -1477,7 +1477,7 @@ template<VectorGL3D::Flag flag> void VectorGLTest::render3D() {
Image2D rendered = _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}); Image2D rendered = _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm});
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::StridedArrayView2D<Color3ub> pixels = Containers::StridedArrayView2D<Color3ub> pixels =
Containers::arrayCast<Color3ub>(rendered.pixels<Color4ub>()); rendered.pixels<Color4ub>().slice(&Color4ub::rgb);
if(data.flip) pixels = pixels.flipped<0>().flipped<1>(); if(data.flip) pixels = pixels.flipped<0>().flipped<1>();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL)) #if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
@ -1784,7 +1784,7 @@ void VectorGLTest::renderMulti2D() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "VectorTestFiles", data.expected2D}), Utility::Path::join({_testDir, "VectorTestFiles", data.expected2D}),
(DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold}));
} }
@ -2089,7 +2089,7 @@ void VectorGLTest::renderMulti3D() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "VectorTestFiles", data.expected3D}), Utility::Path::join({_testDir, "VectorTestFiles", data.expected3D}),
(DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold}));
} }

12
src/Magnum/Shaders/Test/VertexColorGLTest.cpp

@ -712,7 +712,7 @@ template<class T, VertexColorGL2D::Flag flag> void VertexColorGLTest::renderDefa
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "FlatTestFiles/defaults.tga"), Utility::Path::join(_testDir, "FlatTestFiles/defaults.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -797,7 +797,7 @@ template<class T, VertexColorGL2D::Flag flag> void VertexColorGLTest::renderDefa
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "FlatTestFiles/defaults.tga"), Utility::Path::join(_testDir, "FlatTestFiles/defaults.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -887,7 +887,7 @@ template<class T, VertexColorGL2D::Flag flag> void VertexColorGLTest::render2D()
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "VertexColorTestFiles/vertexColor2D.tga"), Utility::Path::join(_testDir, "VertexColorTestFiles/vertexColor2D.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -986,7 +986,7 @@ template<class T, VertexColorGL3D::Flag flag> void VertexColorGLTest::render3D()
#endif #endif
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join(_testDir, "VertexColorTestFiles/vertexColor3D.tga"), Utility::Path::join(_testDir, "VertexColorTestFiles/vertexColor3D.tga"),
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); (DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold}));
} }
@ -1133,7 +1133,7 @@ void VertexColorGLTest::renderMulti2D() {
*/ */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "VertexColorTestFiles", data.expected2D}), Utility::Path::join({_testDir, "VertexColorTestFiles", data.expected2D}),
(DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold}));
} }
@ -1282,7 +1282,7 @@ void VertexColorGLTest::renderMulti3D() {
*/ */
CORRADE_COMPARE_WITH( CORRADE_COMPARE_WITH(
/* Dropping the alpha channel, as it's always 1.0 */ /* Dropping the alpha channel, as it's always 1.0 */
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), _framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>().slice(&Color4ub::rgb),
Utility::Path::join({_testDir, "VertexColorTestFiles", data.expected3D}), Utility::Path::join({_testDir, "VertexColorTestFiles", data.expected3D}),
(DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold})); (DebugTools::CompareImageToFile{_manager, data.maxThreshold, data.meanThreshold}));
} }

Loading…
Cancel
Save