Browse Source

Shaders: drop a bunch of redundant #ifdefs from tests.

This is all code that already is excluded for ES2.
pull/547/head
Vladimír Vondruš 4 years ago
parent
commit
98a2d34590
  1. 16
      src/Magnum/Shaders/Test/FlatGLTest.cpp
  2. 13
      src/Magnum/Shaders/Test/PhongGLTest.cpp

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

@ -2280,7 +2280,6 @@ void FlatGLTest::renderObjectIdTeardown() {
}
template<FlatGL2D::Flag flag> void FlatGLTest::renderObjectId2D() {
#ifndef MAGNUM_TARGET_GLES2
if(flag == FlatGL2D::Flag::UniformBuffers) {
setTestCaseTemplateName("Flag::UniformBuffers");
@ -2289,7 +2288,6 @@ template<FlatGL2D::Flag flag> 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<GL::Extensions::EXT::gpu_shader4>())
@ -2333,12 +2331,7 @@ template<FlatGL2D::Flag flag> 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<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()),
@ -2360,7 +2353,6 @@ template<FlatGL2D::Flag flag> void FlatGLTest::renderObjectId2D() {
}
template<FlatGL3D::Flag flag> void FlatGLTest::renderObjectId3D() {
#ifndef MAGNUM_TARGET_GLES2
if(flag == FlatGL3D::Flag::UniformBuffers) {
setTestCaseTemplateName("Flag::UniformBuffers");
@ -2369,7 +2361,6 @@ template<FlatGL3D::Flag flag> 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<GL::Extensions::EXT::gpu_shader4>())
@ -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<Trade::ImageData2D> 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)

13
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<PhongGL::Flag flag> void PhongGLTest::renderObjectId() {
#ifndef MAGNUM_TARGET_GLES2
if(flag == PhongGL::Flag::UniformBuffers) {
setTestCaseTemplateName("Flag::UniformBuffers");
@ -2799,7 +2792,6 @@ template<PhongGL::Flag flag> 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<GL::Extensions::EXT::gpu_shader4>())
@ -2868,14 +2860,9 @@ template<PhongGL::Flag flag> 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<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()),

Loading…
Cancel
Save