Browse Source

Shaders,MeshTools: adapt image comparison thresholds to SwiftShader.

pull/601/head
Vladimír Vondruš 3 years ago
parent
commit
f3cc5bd1c1
  1. 8
      src/Magnum/MeshTools/Test/CompileLinesGLTest.cpp
  2. 35
      src/Magnum/Shaders/Test/LineGLTest.cpp

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

@ -260,8 +260,8 @@ void CompileLinesGLTest::linePrimitiveCompatibility() {
_framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}),
Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileLinesTestFiles/line-primitive.tga"), Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileLinesTestFiles/line-primitive.tga"),
/* Two/three pixel difference on NVidia vs. Mesa Intel vs Mesa /* Two/three pixel difference on NVidia vs. Mesa Intel vs Mesa
llvmpipe */ llvmpipe, some more on SwiftShader */
(DebugTools::CompareImageToFile{_manager, 36.0f, 0.105f})); (DebugTools::CompareImageToFile{_manager, 54.25f, 0.139f}));
_framebuffer.clear(GL::FramebufferClear::Color); _framebuffer.clear(GL::FramebufferClear::Color);
@ -274,8 +274,8 @@ void CompileLinesGLTest::linePrimitiveCompatibility() {
_framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}), _framebuffer.read({{}, {32, 32}}, {PixelFormat::RGBA8Unorm}),
Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileLinesTestFiles/line-primitive.tga"), Utility::Path::join(MESHTOOLS_TEST_DIR, "CompileLinesTestFiles/line-primitive.tga"),
/* Two/three pixel difference on NVidia vs. Mesa Intel vs Mesa /* Two/three pixel difference on NVidia vs. Mesa Intel vs Mesa
llvmpipe */ llvmpipe, some more on SwiftShader */
(DebugTools::CompareImageToFile{_manager, 36.0f, 0.07f})); (DebugTools::CompareImageToFile{_manager, 54.25f, 0.139f}));
GL::Renderer::disable(GL::Renderer::Feature::Blending); GL::Renderer::disable(GL::Renderer::Feature::Blending);
} }

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

@ -1360,8 +1360,8 @@ template<LineGL2D::Flag flag> void LineGLTest::renderLineCapsJoins2D() {
/* 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>()), Containers::arrayCast<Color3ub>(image.pixels<Color4ub>()),
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 */ /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */
(DebugTools::CompareImageToFile{_manager, 1.0f, 0.0025f})); (DebugTools::CompareImageToFile{_manager, 119.0f, 0.111f}));
{ {
/** @todo drop this when fixed */ /** @todo drop this when fixed */
@ -1426,9 +1426,9 @@ void LineGLTest::renderLineCapsJoins2DReversed() {
/* 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>()), Containers::arrayCast<Color3ub>(image.pixels<Color4ub>()),
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 */ /* 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 */
(DebugTools::CompareImageToFile{_manager, 1.0f, 0.0025f})); (DebugTools::CompareImageToFile{_manager, 119.0f, 0.111f}));
} }
void LineGLTest::renderLineCapsJoins2DTransformed() { void LineGLTest::renderLineCapsJoins2DTransformed() {
@ -1488,8 +1488,8 @@ void LineGLTest::renderLineCapsJoins2DTransformed() {
/* 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>()), Containers::arrayCast<Color3ub>(image.pixels<Color4ub>()),
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 */ /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */
(DebugTools::CompareImageToFile{_manager, 1.0f, 0.0025f})); (DebugTools::CompareImageToFile{_manager, 119.0f, 0.112f}));
} }
template<LineGL3D::Flag flag> void LineGLTest::renderCube3D() { template<LineGL3D::Flag flag> void LineGLTest::renderCube3D() {
@ -1671,8 +1671,8 @@ template<LineGL3D::Flag flag> void LineGLTest::renderCube3D() {
/* 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>()), Containers::arrayCast<Color3ub>(image.pixels<Color4ub>()),
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 */ /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */
(DebugTools::CompareImageToFile{_manager, 1.0f, 0.0031f})); (DebugTools::CompareImageToFile{_manager, 119.0f, 0.102f}));
} }
void LineGLTest::renderPerspective3D() { void LineGLTest::renderPerspective3D() {
@ -1706,7 +1706,8 @@ void LineGLTest::renderPerspective3D() {
/* 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>()), Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()),
Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/perspective3D.tga"), Utility::Path::join(SHADERS_TEST_DIR, "LineTestFiles/perspective3D.tga"),
(DebugTools::CompareImageToFile{_manager})); /* Minor differences on SwiftShader */
(DebugTools::CompareImageToFile{_manager, 6.0f, 0.025f}));
} }
template<class T, LineGL2D::Flag flag> void LineGLTest::renderVertexColor2D() { template<class T, LineGL2D::Flag flag> void LineGLTest::renderVertexColor2D() {
@ -1794,8 +1795,8 @@ template<class T, LineGL2D::Flag flag> void LineGLTest::renderVertexColor2D() {
/* 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>()), Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()),
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 */ /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */
(DebugTools::CompareImageToFile{_manager, 0.34f, 0.0019f})); (DebugTools::CompareImageToFile{_manager, 1.34f, 0.028f}));
} }
template<class T, LineGL3D::Flag flag> void LineGLTest::renderVertexColor3D() { template<class T, LineGL3D::Flag flag> void LineGLTest::renderVertexColor3D() {
@ -1886,8 +1887,8 @@ template<class T, LineGL3D::Flag flag> void LineGLTest::renderVertexColor3D() {
/* 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>()), Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()),
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 */ /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */
(DebugTools::CompareImageToFile{_manager, 0.34f, 0.0019f})); (DebugTools::CompareImageToFile{_manager, 1.34f, 0.028f}));
} }
template<LineGL2D::Flag flag> void LineGLTest::renderObjectId2D() { template<LineGL2D::Flag flag> void LineGLTest::renderObjectId2D() {
@ -2175,8 +2176,8 @@ template<LineGL2D::Flag flag> void LineGLTest::renderInstanced2D() {
/* 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>()), Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()),
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 */ /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */
(DebugTools::CompareImageToFile{_manager, 0.67f, 0.001f})); (DebugTools::CompareImageToFile{_manager, 17.0f, 0.107f}));
/* Object ID -- no need to verify the whole image, just check that pixels /* Object ID -- no need to verify the whole image, just check that pixels
on known places have expected values. SwiftShader insists that the read on known places have expected values. SwiftShader insists that the read
@ -2310,8 +2311,8 @@ template<LineGL3D::Flag flag> void LineGLTest::renderInstanced3D() {
/* 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>()), Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()),
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 */ /* Minor differences on NVidia vs Mesa Intel vs SwiftShader */
(DebugTools::CompareImageToFile{_manager, 0.67f, 0.001f})); (DebugTools::CompareImageToFile{_manager, 17.0f, 0.107f}));
/* Object ID -- no need to verify the whole image, just check that pixels /* Object ID -- no need to verify the whole image, just check that pixels
on known places have expected values. SwiftShader insists that the read on known places have expected values. SwiftShader insists that the read

Loading…
Cancel
Save