From f3cc5bd1c1bf897966b2b5e75917790640abbcc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 7 Mar 2023 13:36:08 +0100 Subject: [PATCH] Shaders,MeshTools: adapt image comparison thresholds to SwiftShader. --- .../MeshTools/Test/CompileLinesGLTest.cpp | 8 ++--- src/Magnum/Shaders/Test/LineGLTest.cpp | 35 ++++++++++--------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/Magnum/MeshTools/Test/CompileLinesGLTest.cpp b/src/Magnum/MeshTools/Test/CompileLinesGLTest.cpp index 99399c653..871ef2fcc 100644 --- a/src/Magnum/MeshTools/Test/CompileLinesGLTest.cpp +++ b/src/Magnum/MeshTools/Test/CompileLinesGLTest.cpp @@ -260,8 +260,8 @@ void CompileLinesGLTest::linePrimitiveCompatibility() { _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileLinesTestFiles/line-primitive.tga"), /* Two/three pixel difference on NVidia vs. Mesa Intel vs Mesa - llvmpipe */ - (DebugTools::CompareImageToFile{_manager, 36.0f, 0.105f})); + llvmpipe, some more on SwiftShader */ + (DebugTools::CompareImageToFile{_manager, 54.25f, 0.139f})); _framebuffer.clear(GL::FramebufferClear::Color); @@ -274,8 +274,8 @@ void CompileLinesGLTest::linePrimitiveCompatibility() { _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileLinesTestFiles/line-primitive.tga"), /* Two/three pixel difference on NVidia vs. Mesa Intel vs Mesa - llvmpipe */ - (DebugTools::CompareImageToFile{_manager, 36.0f, 0.07f})); + llvmpipe, some more on SwiftShader */ + (DebugTools::CompareImageToFile{_manager, 54.25f, 0.139f})); GL::Renderer::disable(GL::Renderer::Feature::Blending); } diff --git a/src/Magnum/Shaders/Test/LineGLTest.cpp b/src/Magnum/Shaders/Test/LineGLTest.cpp index 13b249384..9ff55ceb0 100644 --- a/src/Magnum/Shaders/Test/LineGLTest.cpp +++ b/src/Magnum/Shaders/Test/LineGLTest.cpp @@ -1360,8 +1360,8 @@ template void LineGLTest::renderLineCapsJoins2D() { /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(image.pixels()), Utility::Path::join({SHADERS_TEST_DIR, "LineTestFiles", data.expected}), - /* Minor differences on NVidia vs Mesa Intel */ - (DebugTools::CompareImageToFile{_manager, 1.0f, 0.0025f})); + /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */ + (DebugTools::CompareImageToFile{_manager, 119.0f, 0.111f})); { /** @todo drop this when fixed */ @@ -1426,9 +1426,9 @@ void LineGLTest::renderLineCapsJoins2DReversed() { /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(image.pixels()), Utility::Path::join({SHADERS_TEST_DIR, "LineTestFiles", data.expected}), - /* Minor differences on NVidia vs Mesa Intel */ + /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */ /** @todo sync this with render2D() once the overlaps are fixed */ - (DebugTools::CompareImageToFile{_manager, 1.0f, 0.0025f})); + (DebugTools::CompareImageToFile{_manager, 119.0f, 0.111f})); } void LineGLTest::renderLineCapsJoins2DTransformed() { @@ -1488,8 +1488,8 @@ void LineGLTest::renderLineCapsJoins2DTransformed() { /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(image.pixels()), Utility::Path::join({SHADERS_TEST_DIR, "LineTestFiles", data.expected}), - /* Minor differences on NVidia vs Mesa Intel */ - (DebugTools::CompareImageToFile{_manager, 1.0f, 0.0025f})); + /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */ + (DebugTools::CompareImageToFile{_manager, 119.0f, 0.112f})); } template void LineGLTest::renderCube3D() { @@ -1671,8 +1671,8 @@ template void LineGLTest::renderCube3D() { /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(image.pixels()), Utility::Path::join({SHADERS_TEST_DIR, "LineTestFiles", data.expected}), - /* Minor differences on NVidia vs Mesa Intel */ - (DebugTools::CompareImageToFile{_manager, 1.0f, 0.0031f})); + /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */ + (DebugTools::CompareImageToFile{_manager, 119.0f, 0.102f})); } void LineGLTest::renderPerspective3D() { @@ -1706,7 +1706,8 @@ void LineGLTest::renderPerspective3D() { /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/perspective3D.tga"), - (DebugTools::CompareImageToFile{_manager})); + /* Minor differences on SwiftShader */ + (DebugTools::CompareImageToFile{_manager, 6.0f, 0.025f})); } template void LineGLTest::renderVertexColor2D() { @@ -1794,8 +1795,8 @@ template void LineGLTest::renderVertexColor2D() { /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/vertex-color.tga"), - /* Minor differences on NVidia vs Mesa Intel */ - (DebugTools::CompareImageToFile{_manager, 0.34f, 0.0019f})); + /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */ + (DebugTools::CompareImageToFile{_manager, 1.34f, 0.028f})); } template void LineGLTest::renderVertexColor3D() { @@ -1886,8 +1887,8 @@ template void LineGLTest::renderVertexColor3D() { /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/vertex-color.tga"), - /* Minor differences on NVidia vs Mesa Intel */ - (DebugTools::CompareImageToFile{_manager, 0.34f, 0.0019f})); + /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */ + (DebugTools::CompareImageToFile{_manager, 1.34f, 0.028f})); } template void LineGLTest::renderObjectId2D() { @@ -2175,8 +2176,8 @@ template void LineGLTest::renderInstanced2D() { /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/instanced.tga"), - /* Minor differences on NVidia vs Mesa Intel */ - (DebugTools::CompareImageToFile{_manager, 0.67f, 0.001f})); + /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */ + (DebugTools::CompareImageToFile{_manager, 17.0f, 0.107f})); /* Object ID -- no need to verify the whole image, just check that pixels on known places have expected values. SwiftShader insists that the read @@ -2310,8 +2311,8 @@ template void LineGLTest::renderInstanced3D() { /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/instanced.tga"), - /* Minor differences on NVidia vs Mesa Intel */ - (DebugTools::CompareImageToFile{_manager, 0.67f, 0.001f})); + /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */ + (DebugTools::CompareImageToFile{_manager, 17.0f, 0.107f})); /* Object ID -- no need to verify the whole image, just check that pixels on known places have expected values. SwiftShader insists that the read