From 98a2d34590365a0546543a22fe3a64aa5fc7ab60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 21 Jan 2022 22:48:17 +0100 Subject: [PATCH] Shaders: drop a bunch of redundant #ifdefs from tests. This is all code that already is excluded for ES2. --- src/Magnum/Shaders/Test/FlatGLTest.cpp | 16 +--------------- src/Magnum/Shaders/Test/PhongGLTest.cpp | 13 ------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/Magnum/Shaders/Test/FlatGLTest.cpp b/src/Magnum/Shaders/Test/FlatGLTest.cpp index bbf472b54..77e1e1700 100644 --- a/src/Magnum/Shaders/Test/FlatGLTest.cpp +++ b/src/Magnum/Shaders/Test/FlatGLTest.cpp @@ -2280,7 +2280,6 @@ void FlatGLTest::renderObjectIdTeardown() { } template void FlatGLTest::renderObjectId2D() { - #ifndef MAGNUM_TARGET_GLES2 if(flag == FlatGL2D::Flag::UniformBuffers) { setTestCaseTemplateName("Flag::UniformBuffers"); @@ -2289,7 +2288,6 @@ template void FlatGLTest::renderObjectId2D() { CORRADE_SKIP(GL::Extensions::ARB::uniform_buffer_object::string() << "is not supported."); #endif } - #endif #ifndef MAGNUM_TARGET_GLES if(!GL::Context::current().isExtensionSupported()) @@ -2333,12 +2331,7 @@ template void FlatGLTest::renderObjectId2D() { CORRADE_SKIP("AnyImageImporter / TgaImporter plugins not found."); /* Color output should have no difference -- same as in colored2D() */ - #if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL)) const Float maxThreshold = 0.0f, meanThreshold = 0.0f; - #else - /* WebGL 1 doesn't have 8bit renderbuffer storage, so it's way worse */ - const Float maxThreshold = 11.34f, meanThreshold = 0.51f; - #endif CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()), @@ -2360,7 +2353,6 @@ template void FlatGLTest::renderObjectId2D() { } template void FlatGLTest::renderObjectId3D() { - #ifndef MAGNUM_TARGET_GLES2 if(flag == FlatGL3D::Flag::UniformBuffers) { setTestCaseTemplateName("Flag::UniformBuffers"); @@ -2369,7 +2361,6 @@ template void FlatGLTest::renderObjectId3D() { CORRADE_SKIP(GL::Extensions::ARB::uniform_buffer_object::string() << "is not supported."); #endif } - #endif #ifndef MAGNUM_TARGET_GLES if(!GL::Context::current().isExtensionSupported()) @@ -3023,9 +3014,7 @@ void FlatGLTest::renderMulti2D() { FlatGL2D shader{FlatGL2D::Flag::UniformBuffers|FlatGL2D::Flag::ObjectId|data.flags, data.materialCount, data.drawCount}; GL::Texture2D texture{NoCreate}; - #ifndef MAGNUM_TARGET_GLES2 GL::Texture2DArray textureArray{NoCreate}; - #endif if(data.flags & FlatGL3D::Flag::Textured) { if(!(_manager.loadState("AnyImageImporter") & PluginManager::LoadState::Loaded) || !(_manager.loadState("TgaImporter") & PluginManager::LoadState::Loaded)) @@ -3037,7 +3026,6 @@ void FlatGLTest::renderMulti2D() { Containers::Optional image; CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); - #ifndef MAGNUM_TARGET_GLES2 /* For arrays we upload three slices of the original image to half-high slices */ if(data.flags & FlatGL2D::Flag::TextureArrays) { @@ -3071,9 +3059,7 @@ void FlatGLTest::renderMulti2D() { .setSubImage(0, {0, 0, 2}, third); shader.bindTexture(textureArray); - } else - #endif - { + } else { texture = GL::Texture2D{}; texture.setMinificationFilter(GL::SamplerFilter::Linear) .setMagnificationFilter(GL::SamplerFilter::Linear) diff --git a/src/Magnum/Shaders/Test/PhongGLTest.cpp b/src/Magnum/Shaders/Test/PhongGLTest.cpp index 5a4998dec..39134b3d7 100644 --- a/src/Magnum/Shaders/Test/PhongGLTest.cpp +++ b/src/Magnum/Shaders/Test/PhongGLTest.cpp @@ -705,14 +705,12 @@ constexpr struct { 2, 1, 1, 16, /* Minor differences on ARM Mali */ 4.67f, 0.02f}, - #ifndef MAGNUM_TARGET_GLES2 {"bind with offset, texture array", "multidraw-textured.tga", PhongGL::Flag::TextureTransformation|PhongGL::Flag::DiffuseTexture|PhongGL::Flag::TextureArrays, 2, 1, 1, 16, /* Some difference at the UV edge (texture is wrapping in the 2D case while the 2D array has a black area around) */ 50.34f, 0.131f}, - #endif {"draw offset, colored", "multidraw.tga", {}, 4, 2, 3, 1, @@ -723,14 +721,12 @@ constexpr struct { 4, 2, 3, 1, /* Minor differences on ARM Mali */ 4.67f, 0.02f}, - #ifndef MAGNUM_TARGET_GLES2 {"draw offset, texture array", "multidraw-textured.tga", PhongGL::Flag::TextureTransformation|PhongGL::Flag::DiffuseTexture|PhongGL::Flag::TextureArrays, 4, 2, 3, 1, /* Some difference at the UV edge (texture is wrapping in the 2D case while the 2D array has a black area around) */ 50.34f, 0.131f}, - #endif {"multidraw, colored", "multidraw.tga", PhongGL::Flag::MultiDraw, 4, 2, 3, 1, @@ -741,14 +737,12 @@ constexpr struct { 4, 2, 3, 1, /* Minor differences on ARM Mali */ 4.67f, 0.02f}, - #ifndef MAGNUM_TARGET_GLES2 {"multidraw, texture array", "multidraw-textured.tga", PhongGL::Flag::MultiDraw|PhongGL::Flag::TextureTransformation|PhongGL::Flag::DiffuseTexture|PhongGL::Flag::TextureArrays, 4, 2, 3, 1, /* Some difference at the UV edge (texture is wrapping in the 2D case while the 2D array has a black area around) */ 50.34f, 0.131f}, - #endif /** @todo test normal and per-draw scaling when there's usable texture */ }; #endif @@ -2785,7 +2779,6 @@ void PhongGLTest::renderObjectIdTeardown() { } template void PhongGLTest::renderObjectId() { - #ifndef MAGNUM_TARGET_GLES2 if(flag == PhongGL::Flag::UniformBuffers) { setTestCaseTemplateName("Flag::UniformBuffers"); @@ -2799,7 +2792,6 @@ template void PhongGLTest::renderObjectId() { CORRADE_SKIP("UBOs with dynamically indexed (light) arrays are a crashy dumpster fire on SwiftShader, can't test."); #endif } - #endif #ifndef MAGNUM_TARGET_GLES if(!GL::Context::current().isExtensionSupported()) @@ -2868,14 +2860,9 @@ template void PhongGLTest::renderObjectId() { CORRADE_SKIP("AnyImageImporter / TgaImporter plugins not found."); /* Color output should have no difference -- same as in colored() */ - #if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL)) /* SwiftShader has some minor rounding differences (max = 1). ARM Mali G71 and Apple A8 has bigger rounding differences. */ const Float maxThreshold = 8.34f, meanThreshold = 0.100f; - #else - /* WebGL 1 doesn't have 8bit renderbuffer storage, so it's way worse */ - const Float maxThreshold = 15.34f, meanThreshold = 3.33f; - #endif CORRADE_COMPARE_WITH( /* Dropping the alpha channel, as it's always 1.0 */ Containers::arrayCast(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels()),