diff --git a/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp b/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp index 167c2446d..e23db4a99 100644 --- a/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp +++ b/src/Magnum/Shaders/Test/DistanceFieldVectorGLTest.cpp @@ -388,22 +388,14 @@ template void DistanceFieldVectorGLTest::construct() { template void DistanceFieldVectorGLTest::constructAsync() { setTestCaseTemplateName(Utility::format("{}", dimensions)); - constexpr struct { - const char* name; - DistanceFieldVectorGL2D::Flags flags; - } data{ - "texture transformation", DistanceFieldVectorGL2D::Flag::TextureTransformation - }; - setTestCaseDescription(data.name); - - auto compileState = DistanceFieldVectorGL::compile(data.flags); - CORRADE_COMPARE(compileState.flags(), data.flags); + auto compileState = DistanceFieldVectorGL::compile(DistanceFieldVectorGL2D::Flag::TextureTransformation); + CORRADE_COMPARE(compileState.flags(), DistanceFieldVectorGL2D::Flag::TextureTransformation); while(!compileState.isLinkFinished()) Utility::System::sleep(100); DistanceFieldVectorGL shader{std::move(compileState)}; - CORRADE_COMPARE(shader.flags(), data.flags); + CORRADE_COMPARE(shader.flags(), DistanceFieldVectorGL2D::Flag::TextureTransformation); CORRADE_VERIFY(shader.isLinkFinished()); CORRADE_VERIFY(shader.id()); { @@ -459,44 +451,24 @@ template void DistanceFieldVectorGLTest::constructUnifor template void DistanceFieldVectorGLTest::constructUniformBuffersAsync() { setTestCaseTemplateName(Utility::format("{}", dimensions)); - constexpr struct { - const char* name; - DistanceFieldVectorGL2D::Flags flags; - UnsignedInt materialCount, drawCount; - } data { - "multidraw with all the things", DistanceFieldVectorGL2D::Flag::MultiDraw|DistanceFieldVectorGL2D::Flag::TextureTransformation, 16, 48 - }; - setTestCaseDescription(data.name); #ifndef MAGNUM_TARGET_GLES - if((data.flags & DistanceFieldVectorGL2D::Flag::UniformBuffers) && !GL::Context::current().isExtensionSupported()) + if(!GL::Context::current().isExtensionSupported()) CORRADE_SKIP(GL::Extensions::ARB::uniform_buffer_object::string() << "is not supported."); #endif - if(data.flags >= DistanceFieldVectorGL2D::Flag::MultiDraw) { - #ifndef MAGNUM_TARGET_GLES - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ARB::shader_draw_parameters::string() << "is not supported."); - #elif !defined(MAGNUM_TARGET_WEBGL) - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ANGLE::multi_draw::string() << "is not supported."); - #else - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::WEBGL::multi_draw::string() << "is not supported."); - #endif - } - auto compileState = DistanceFieldVectorGL::compile(data.flags, data.materialCount, data.drawCount); - CORRADE_COMPARE(compileState.flags(), data.flags); - CORRADE_COMPARE(compileState.materialCount(), data.materialCount); - CORRADE_COMPARE(compileState.drawCount(), data.drawCount); + auto compileState = DistanceFieldVectorGL::compile(DistanceFieldVectorGL2D::Flag::UniformBuffers, 16, 4); + CORRADE_COMPARE(compileState.flags(), DistanceFieldVectorGL2D::Flag::UniformBuffers); + CORRADE_COMPARE(compileState.materialCount(), 16); + CORRADE_COMPARE(compileState.drawCount(), 4); while(!compileState.isLinkFinished()) Utility::System::sleep(100); DistanceFieldVectorGL shader{std::move(compileState)}; - CORRADE_COMPARE(shader.flags(), data.flags); - CORRADE_COMPARE(shader.materialCount(), data.materialCount); - CORRADE_COMPARE(shader.drawCount(), data.drawCount); + CORRADE_COMPARE(shader.flags(), DistanceFieldVectorGL2D::Flag::UniformBuffers); + CORRADE_COMPARE(shader.materialCount(), 16); + CORRADE_COMPARE(shader.drawCount(), 4); CORRADE_VERIFY(shader.isLinkFinished()); CORRADE_VERIFY(shader.id()); { diff --git a/src/Magnum/Shaders/Test/FlatGLTest.cpp b/src/Magnum/Shaders/Test/FlatGLTest.cpp index 2828e2dbf..192c5fca2 100644 --- a/src/Magnum/Shaders/Test/FlatGLTest.cpp +++ b/src/Magnum/Shaders/Test/FlatGLTest.cpp @@ -866,32 +866,14 @@ template void FlatGLTest::construct() { template void FlatGLTest::constructAsync() { setTestCaseTemplateName(Utility::format("{}", dimensions)); - - constexpr struct { - const char* name; - FlatGL2D::Flags flags; - } data { - "textured + texture transformation", - FlatGL2D::Flag::Textured|FlatGL2D::Flag::TextureTransformation - }; - - setTestCaseDescription(data.name); - - #ifndef MAGNUM_TARGET_GLES - if((data.flags & FlatGL2D::Flag::ObjectId) && !GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::EXT::gpu_shader4::string() << "is not supported."); - if((data.flags & FlatGL2D::Flag::TextureArrays) && !GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::EXT::texture_array::string() << "is not supported."); - #endif - - auto compileState = FlatGL::compile(data.flags); - CORRADE_COMPARE(compileState.flags(), data.flags); + auto compileState = FlatGL::compile(FlatGL2D::Flag::Textured|FlatGL2D::Flag::TextureTransformation); + CORRADE_COMPARE(compileState.flags(), FlatGL2D::Flag::Textured|FlatGL2D::Flag::TextureTransformation); while(!compileState.isLinkFinished()) Utility::System::sleep(100); FlatGL shader{std::move(compileState)}; - CORRADE_COMPARE(shader.flags(), data.flags); + CORRADE_COMPARE(shader.flags(), FlatGL2D::Flag::Textured|FlatGL2D::Flag::TextureTransformation); CORRADE_VERIFY(shader.id()); { @@ -951,52 +933,23 @@ template void FlatGLTest::constructUniformBuffers() { template void FlatGLTest::constructUniformBuffersAsync() { setTestCaseTemplateName(Utility::format("{}", dimensions)); - constexpr struct { - const char* name; - FlatGL2D::Flags flags; - UnsignedInt materialCount, drawCount; - } data { - "alpha mask", - FlatGL2D::Flag::UniformBuffers|FlatGL2D::Flag::AlphaMask, - 1, 1 - }; - - setTestCaseDescription(data.name); - #ifndef MAGNUM_TARGET_GLES - if((data.flags & FlatGL2D::Flag::UniformBuffers) && !GL::Context::current().isExtensionSupported()) + if(!GL::Context::current().isExtensionSupported()) CORRADE_SKIP(GL::Extensions::ARB::uniform_buffer_object::string() << "is not supported."); - if((data.flags & FlatGL2D::Flag::ObjectId) && !GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::EXT::gpu_shader4::string() << "is not supported."); - if((data.flags & FlatGL2D::Flag::TextureArrays) && !GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::EXT::texture_array::string() << "is not supported."); #endif - if(data.flags >= FlatGL2D::Flag::MultiDraw) { - #ifndef MAGNUM_TARGET_GLES - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ARB::shader_draw_parameters::string() << "is not supported."); - #elif !defined(MAGNUM_TARGET_WEBGL) - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ANGLE::multi_draw::string() << "is not supported."); - #else - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::WEBGL::multi_draw::string() << "is not supported."); - #endif - } - - auto compileState = FlatGL::compile(data.flags, data.materialCount, data.drawCount); - CORRADE_COMPARE(compileState.flags(), data.flags); - CORRADE_COMPARE(compileState.materialCount(), data.materialCount); - CORRADE_COMPARE(compileState.drawCount(), data.drawCount); + auto compileState = FlatGL::compile(FlatGL2D::Flag::UniformBuffers|FlatGL2D::Flag::AlphaMask, 1, 1); + CORRADE_COMPARE(compileState.flags(), FlatGL2D::Flag::UniformBuffers|FlatGL2D::Flag::AlphaMask); + CORRADE_COMPARE(compileState.materialCount(), 1); + CORRADE_COMPARE(compileState.drawCount(), 1); while(!compileState.isLinkFinished()) Utility::System::sleep(100); FlatGL shader{std::move(compileState)}; - CORRADE_COMPARE(shader.flags(), data.flags); - CORRADE_COMPARE(shader.materialCount(), data.materialCount); - CORRADE_COMPARE(shader.drawCount(), data.drawCount); + CORRADE_COMPARE(shader.flags(), FlatGL2D::Flag::UniformBuffers|FlatGL2D::Flag::AlphaMask); + CORRADE_COMPARE(shader.materialCount(), 1); + CORRADE_COMPARE(shader.drawCount(), 1); CORRADE_VERIFY(shader.id()); { #if defined(CORRADE_TARGET_APPLE) && !defined(MAGNUM_TARGET_GLES) diff --git a/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp b/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp index 31319306e..f822d91ed 100644 --- a/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp +++ b/src/Magnum/Shaders/Test/MeshVisualizerGLTest.cpp @@ -1416,64 +1416,14 @@ void MeshVisualizerGLTest::construct2D() { void MeshVisualizerGLTest::construct2DAsync() { - constexpr struct { - const char* name; - MeshVisualizerGL2D::Flags flags; - } data { - "wireframe w/o GS", MeshVisualizerGL2D::Flag::Wireframe|MeshVisualizerGL2D::Flag::NoGeometryShader - }; - setTestCaseDescription(data.name); - - #ifndef MAGNUM_TARGET_GLES - if((data.flags & MeshVisualizerGL2D::Flag::InstancedObjectId) && !GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::EXT::gpu_shader4::string() << "is not supported."); - #endif - - #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - if(data.flags >= MeshVisualizerGL2D::Flag::PrimitiveIdFromVertexId && - #ifndef MAGNUM_TARGET_GLES - !GL::Context::current().isVersionSupported(GL::Version::GL300) - #else - !GL::Context::current().isVersionSupported(GL::Version::GLES300) - #endif - ) CORRADE_SKIP("gl_VertexID not supported."); - #endif - - #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - if(data.flags & MeshVisualizerGL2D::Flag::PrimitiveId && !(data.flags >= MeshVisualizerGL2D::Flag::PrimitiveIdFromVertexId) && - #ifndef MAGNUM_TARGET_GLES - !GL::Context::current().isVersionSupported(GL::Version::GL320) - #else - !GL::Context::current().isVersionSupported(GL::Version::GLES320) - #endif - ) CORRADE_SKIP("gl_PrimitiveID not supported."); - #endif - - #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - if((data.flags & MeshVisualizerGL2D::Flag::Wireframe) && !(data.flags & MeshVisualizerGL2D::Flag::NoGeometryShader)) { - #ifndef MAGNUM_TARGET_GLES - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ARB::geometry_shader4::string() << "is not supported."); - #else - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::EXT::geometry_shader::string() << "is not supported."); - #endif - - #ifdef MAGNUM_TARGET_GLES - if(GL::Context::current().isExtensionSupported()) - CORRADE_INFO("Using" << GL::Extensions::NV::shader_noperspective_interpolation::string()); - #endif - } - #endif - - auto compileState = MeshVisualizerGL2D::compile(data.flags); - CORRADE_COMPARE(compileState.flags(), data.flags); + auto compileState = MeshVisualizerGL2D::compile(MeshVisualizerGL2D::Flag::Wireframe|MeshVisualizerGL2D::Flag::NoGeometryShader); + CORRADE_COMPARE(compileState.flags(), MeshVisualizerGL2D::Flag::Wireframe|MeshVisualizerGL2D::Flag::NoGeometryShader); while(!compileState.isLinkFinished()) Utility::System::sleep(100); MeshVisualizerGL2D shader{std::move(compileState)}; - CORRADE_COMPARE(shader.flags(), data.flags); + CORRADE_COMPARE(shader.flags(), MeshVisualizerGL2D::Flag::Wireframe|MeshVisualizerGL2D::Flag::NoGeometryShader); CORRADE_VERIFY(shader.isLinkFinished()); CORRADE_VERIFY(shader.id()); { @@ -1566,85 +1516,23 @@ void MeshVisualizerGLTest::constructUniformBuffers2D() { void MeshVisualizerGLTest::constructUniformBuffers2DAsync() { - constexpr struct { - const char* name; - MeshVisualizerGL2D::Flags flags; - UnsignedInt materialCount, drawCount; - } data { - "multidraw with wireframe w/o GS and vertex ID", MeshVisualizerGL2D::Flag::MultiDraw|MeshVisualizerGL2D::Flag::Wireframe|MeshVisualizerGL2D::Flag::NoGeometryShader|MeshVisualizerGL2D::Flag::VertexId, 8, 55 - }; - setTestCaseDescription(data.name); - #ifndef MAGNUM_TARGET_GLES - if((data.flags & MeshVisualizerGL2D::Flag::InstancedObjectId) && !GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::EXT::gpu_shader4::string() << "is not supported."); - #endif - - #ifndef MAGNUM_TARGET_WEBGL - if(data.flags >= MeshVisualizerGL2D::Flag::PrimitiveIdFromVertexId && - #ifndef MAGNUM_TARGET_GLES - !GL::Context::current().isVersionSupported(GL::Version::GL300) - #else - !GL::Context::current().isVersionSupported(GL::Version::GLES300) - #endif - ) CORRADE_SKIP("gl_VertexID not supported."); - #endif - - #ifndef MAGNUM_TARGET_WEBGL - if(data.flags & MeshVisualizerGL2D::Flag::PrimitiveId && !(data.flags >= MeshVisualizerGL2D::Flag::PrimitiveIdFromVertexId) && - #ifndef MAGNUM_TARGET_GLES - !GL::Context::current().isVersionSupported(GL::Version::GL320) - #else - !GL::Context::current().isVersionSupported(GL::Version::GLES320) - #endif - ) CORRADE_SKIP("gl_PrimitiveID not supported."); - #endif - - #ifndef MAGNUM_TARGET_WEBGL - if((data.flags & MeshVisualizerGL2D::Flag::Wireframe) && !(data.flags & MeshVisualizerGL2D::Flag::NoGeometryShader)) { - #ifndef MAGNUM_TARGET_GLES - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ARB::geometry_shader4::string() << "is not supported."); - #else - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::EXT::geometry_shader::string() << "is not supported."); - #endif - - #ifdef MAGNUM_TARGET_GLES - if(GL::Context::current().isExtensionSupported()) - CORRADE_INFO("Using" << GL::Extensions::NV::shader_noperspective_interpolation::string()); - #endif - } - #endif - - #ifndef MAGNUM_TARGET_GLES - if(data.flags & MeshVisualizerGL2D::Flag::UniformBuffers && !GL::Context::current().isExtensionSupported()) + if(!GL::Context::current().isExtensionSupported()) CORRADE_SKIP(GL::Extensions::ARB::uniform_buffer_object::string() << "is not supported."); #endif - if(data.flags >= MeshVisualizerGL2D::Flag::MultiDraw) { - #ifndef MAGNUM_TARGET_GLES - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ARB::shader_draw_parameters::string() << "is not supported."); - #elif !defined(MAGNUM_TARGET_WEBGL) - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ANGLE::multi_draw::string() << "is not supported."); - #else - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::WEBGL::multi_draw::string() << "is not supported."); - #endif - } - - auto compileState = MeshVisualizerGL2D::compile(data.flags, data.materialCount, data.drawCount); - CORRADE_COMPARE(compileState.flags(), data.flags); - CORRADE_COMPARE(compileState.materialCount(), data.materialCount); - CORRADE_COMPARE(compileState.drawCount(), data.drawCount); + auto compileState = MeshVisualizerGL2D::compile( MeshVisualizerGL2D::Flag::UniformBuffers|MeshVisualizerGL2D::Flag::Wireframe|MeshVisualizerGL2D::Flag::NoGeometryShader, 8, 55); + CORRADE_COMPARE(compileState.flags(), MeshVisualizerGL2D::Flag::UniformBuffers|MeshVisualizerGL2D::Flag::Wireframe|MeshVisualizerGL2D::Flag::NoGeometryShader); + CORRADE_COMPARE(compileState.materialCount(), 8); + CORRADE_COMPARE(compileState.drawCount(), 55); while(!compileState.isLinkFinished()) Utility::System::sleep(100); MeshVisualizerGL2D shader{std::move(compileState)}; - CORRADE_COMPARE(shader.flags(), data.flags); + CORRADE_COMPARE(shader.flags(), MeshVisualizerGL2D::Flag::UniformBuffers|MeshVisualizerGL2D::Flag::Wireframe|MeshVisualizerGL2D::Flag::NoGeometryShader); + CORRADE_COMPARE(shader.materialCount(), 8); + CORRADE_COMPARE(shader.drawCount(), 55); CORRADE_VERIFY(shader.isLinkFinished()); CORRADE_VERIFY(shader.id()); { @@ -1718,64 +1606,15 @@ void MeshVisualizerGLTest::construct3D() { } void MeshVisualizerGLTest::construct3DAsync() { - constexpr struct { - const char* name; - MeshVisualizerGL3D::Flags flags; - } data { - "wireframe w/o GS", MeshVisualizerGL3D::Flag::Wireframe|MeshVisualizerGL3D::Flag::NoGeometryShader - }; - setTestCaseDescription(data.name); - - #ifndef MAGNUM_TARGET_GLES - if((data.flags & MeshVisualizerGL3D::Flag::InstancedObjectId) && !GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::EXT::gpu_shader4::string() << "is not supported."); - #endif - - #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - if(data.flags >= MeshVisualizerGL3D::Flag::PrimitiveIdFromVertexId && - #ifndef MAGNUM_TARGET_GLES - !GL::Context::current().isVersionSupported(GL::Version::GL300) - #else - !GL::Context::current().isVersionSupported(GL::Version::GLES300) - #endif - ) CORRADE_SKIP("gl_VertexID not supported."); - #endif - - #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - if(data.flags & MeshVisualizerGL3D::Flag::PrimitiveId && !(data.flags >= MeshVisualizerGL3D::Flag::PrimitiveIdFromVertexId) && - #ifndef MAGNUM_TARGET_GLES - !GL::Context::current().isVersionSupported(GL::Version::GL320) - #else - !GL::Context::current().isVersionSupported(GL::Version::GLES320) - #endif - ) CORRADE_SKIP("gl_PrimitiveID not supported."); - #endif - - #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) - if(((data.flags & MeshVisualizerGL3D::Flag::Wireframe) && !(data.flags & MeshVisualizerGL3D::Flag::NoGeometryShader)) || (data.flags & (MeshVisualizerGL3D::Flag::TangentDirection|MeshVisualizerGL3D::Flag::BitangentDirection|MeshVisualizerGL3D::Flag::BitangentFromTangentDirection|MeshVisualizerGL3D::Flag::NormalDirection))) { - #ifndef MAGNUM_TARGET_GLES - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ARB::geometry_shader4::string() << "is not supported."); - #else - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::EXT::geometry_shader::string() << "is not supported."); - #endif - - #ifdef MAGNUM_TARGET_GLES - if(GL::Context::current().isExtensionSupported()) - CORRADE_INFO("Using" << GL::Extensions::NV::shader_noperspective_interpolation::string()); - #endif - } - #endif - - auto compileState = MeshVisualizerGL3D::compile(data.flags); - CORRADE_COMPARE(compileState.flags(), data.flags); + auto compileState = MeshVisualizerGL3D::compile(MeshVisualizerGL3D::Flag::Wireframe|MeshVisualizerGL3D::Flag::NoGeometryShader); + CORRADE_COMPARE(compileState.flags(), MeshVisualizerGL3D::Flag::Wireframe|MeshVisualizerGL3D::Flag::NoGeometryShader); while(!compileState.isLinkFinished()) Utility::System::sleep(100); - MeshVisualizerGL3D shader{data.flags}; - CORRADE_COMPARE(shader.flags(), data.flags); + // TODO: FIXME MeshVisualizerGL3D shader{std::move(compileState)}; + MeshVisualizerGL3D shader{MeshVisualizerGL3D::Flag::Wireframe|MeshVisualizerGL3D::Flag::NoGeometryShader}; + CORRADE_COMPARE(shader.flags(), MeshVisualizerGL3D::Flag::Wireframe|MeshVisualizerGL3D::Flag::NoGeometryShader); CORRADE_VERIFY(compileState.isLinkFinished()); CORRADE_VERIFY(shader.id()); { @@ -1872,80 +1711,27 @@ void MeshVisualizerGLTest::constructUniformBuffers3DAsync() { MeshVisualizerGL3D::Flags flags; UnsignedInt materialCount, drawCount; } data { - "multidraw with wireframe w/o GS and vertex ID", MeshVisualizerGL3D::Flag::MultiDraw|MeshVisualizerGL3D::Flag::Wireframe|MeshVisualizerGL3D::Flag::NoGeometryShader|MeshVisualizerGL3D::Flag::VertexId, 6, 28 + "multiple materials, draws", MeshVisualizerGL3D::Flag::UniformBuffers|MeshVisualizerGL3D::Flag::Wireframe|MeshVisualizerGL3D::Flag::NoGeometryShader, 8, 55 }; setTestCaseDescription(data.name); #ifndef MAGNUM_TARGET_GLES - if((data.flags & MeshVisualizerGL3D::Flag::InstancedObjectId) && !GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::EXT::gpu_shader4::string() << "is not supported."); - #endif - - #ifndef MAGNUM_TARGET_WEBGL - if(data.flags >= MeshVisualizerGL3D::Flag::PrimitiveIdFromVertexId && - #ifndef MAGNUM_TARGET_GLES - !GL::Context::current().isVersionSupported(GL::Version::GL300) - #else - !GL::Context::current().isVersionSupported(GL::Version::GLES300) - #endif - ) CORRADE_SKIP("gl_VertexID not supported."); - #endif - - #ifndef MAGNUM_TARGET_WEBGL - if(data.flags & MeshVisualizerGL3D::Flag::PrimitiveId && !(data.flags >= MeshVisualizerGL3D::Flag::PrimitiveIdFromVertexId) && - #ifndef MAGNUM_TARGET_GLES - !GL::Context::current().isVersionSupported(GL::Version::GL320) - #else - !GL::Context::current().isVersionSupported(GL::Version::GLES320) - #endif - ) CORRADE_SKIP("gl_PrimitiveID not supported."); - #endif - - #ifndef MAGNUM_TARGET_WEBGL - if(((data.flags & MeshVisualizerGL3D::Flag::Wireframe) && !(data.flags & MeshVisualizerGL3D::Flag::NoGeometryShader)) || (data.flags & (MeshVisualizerGL3D::Flag::TangentDirection|MeshVisualizerGL3D::Flag::BitangentDirection|MeshVisualizerGL3D::Flag::BitangentFromTangentDirection|MeshVisualizerGL3D::Flag::NormalDirection))) { - #ifndef MAGNUM_TARGET_GLES - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ARB::geometry_shader4::string() << "is not supported."); - #else - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::EXT::geometry_shader::string() << "is not supported."); - #endif - - #ifdef MAGNUM_TARGET_GLES - if(GL::Context::current().isExtensionSupported()) - CORRADE_INFO("Using" << GL::Extensions::NV::shader_noperspective_interpolation::string()); - #endif - } - #endif - - #ifndef MAGNUM_TARGET_GLES - if(data.flags & MeshVisualizerGL3D::Flag::UniformBuffers && !GL::Context::current().isExtensionSupported()) + if(!GL::Context::current().isExtensionSupported()) CORRADE_SKIP(GL::Extensions::ARB::uniform_buffer_object::string() << "is not supported."); #endif - if(data.flags >= MeshVisualizerGL3D::Flag::MultiDraw) { - #ifndef MAGNUM_TARGET_GLES - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ARB::shader_draw_parameters::string() << "is not supported."); - #elif !defined(MAGNUM_TARGET_WEBGL) - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ANGLE::multi_draw::string() << "is not supported."); - #else - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::WEBGL::multi_draw::string() << "is not supported."); - #endif - } - - auto compileState = MeshVisualizerGL3D::compile(data.flags, data.materialCount, data.drawCount); - CORRADE_COMPARE(compileState.flags(), data.flags); - CORRADE_COMPARE(compileState.materialCount(), data.materialCount); - CORRADE_COMPARE(compileState.drawCount(), data.drawCount); + auto compileState = MeshVisualizerGL3D::compile(MeshVisualizerGL3D::Flag::UniformBuffers|MeshVisualizerGL3D::Flag::Wireframe|MeshVisualizerGL3D::Flag::NoGeometryShader, 8, 55); + CORRADE_COMPARE(compileState.flags(), MeshVisualizerGL3D::Flag::UniformBuffers|MeshVisualizerGL3D::Flag::Wireframe|MeshVisualizerGL3D::Flag::NoGeometryShader); + CORRADE_COMPARE(compileState.materialCount(), 8); + CORRADE_COMPARE(compileState.drawCount(), 55); while(!compileState.isLinkFinished()) Utility::System::sleep(100); MeshVisualizerGL3D shader{std::move(compileState)}; - CORRADE_COMPARE(shader.flags(), data.flags); + CORRADE_COMPARE(shader.flags(), MeshVisualizerGL3D::Flag::UniformBuffers|MeshVisualizerGL3D::Flag::Wireframe|MeshVisualizerGL3D::Flag::NoGeometryShader); + CORRADE_COMPARE(compileState.materialCount(), 8); + CORRADE_COMPARE(compileState.drawCount(), 55); CORRADE_VERIFY(shader.isLinkFinished()); CORRADE_VERIFY(shader.id()); { diff --git a/src/Magnum/Shaders/Test/PhongGLTest.cpp b/src/Magnum/Shaders/Test/PhongGLTest.cpp index 6057fd7fe..d0df58ec4 100644 --- a/src/Magnum/Shaders/Test/PhongGLTest.cpp +++ b/src/Magnum/Shaders/Test/PhongGLTest.cpp @@ -1199,32 +1199,16 @@ void PhongGLTest::construct() { } void PhongGLTest::constructAsync() { - constexpr struct { - const char* name; - PhongGL::Flags flags; - UnsignedInt lightCount; - } data { - "instanced specular texture offset", PhongGL::Flag::SpecularTexture|PhongGL::Flag::InstancedTextureOffset, 3 - }; - setTestCaseDescription(data.name); - - #ifndef MAGNUM_TARGET_GLES - if((data.flags & PhongGL::Flag::ObjectId) && !GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::EXT::gpu_shader4::string() << "is not supported."); - if((data.flags & PhongGL::Flag::TextureArrays) && !GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::EXT::texture_array::string() << "is not supported."); - #endif - - auto compileState = PhongGL::compile(data.flags, data.lightCount); - CORRADE_COMPARE(compileState.flags(), data.flags); - CORRADE_COMPARE(compileState.lightCount(), data.lightCount); + auto compileState = PhongGL::compile(PhongGL::Flag::SpecularTexture|PhongGL::Flag::InstancedTextureOffset, 3); + CORRADE_COMPARE(compileState.flags(), PhongGL::Flag::SpecularTexture|PhongGL::Flag::InstancedTextureOffset); + CORRADE_COMPARE(compileState.lightCount(), 3); while(!compileState.isLinkFinished()) Utility::System::sleep(100); PhongGL shader{std::move(compileState)}; - CORRADE_COMPARE(shader.flags(), data.flags); - CORRADE_COMPARE(shader.lightCount(), data.lightCount); + CORRADE_COMPARE(shader.flags(), PhongGL::Flag::SpecularTexture|PhongGL::Flag::InstancedTextureOffset); + CORRADE_COMPARE(shader.lightCount(), 3); CORRADE_VERIFY(shader.isLinkFinished()); CORRADE_VERIFY(shader.id()); { @@ -1281,51 +1265,25 @@ void PhongGLTest::constructUniformBuffers() { } void PhongGLTest::constructUniformBuffersAsync() { - constexpr struct { - const char* name; - PhongGL::Flags flags; - UnsignedInt lightCount, materialCount, drawCount; - } data { - "multiple lights, materials, draws + light culling", PhongGL::Flag::UniformBuffers|PhongGL::Flag::LightCulling, 8, 8, 24 - }; - setTestCaseDescription(data.name); - #ifndef MAGNUM_TARGET_GLES - if((data.flags & PhongGL::Flag::UniformBuffers) && !GL::Context::current().isExtensionSupported()) + if(!GL::Context::current().isExtensionSupported()) CORRADE_SKIP(GL::Extensions::ARB::uniform_buffer_object::string() << "is not supported."); - if((data.flags & PhongGL::Flag::ObjectId) && !GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::EXT::gpu_shader4::string() << "is not supported."); - if((data.flags & PhongGL::Flag::TextureArrays) && !GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::EXT::texture_array::string() << "is not supported."); #endif - if(data.flags >= PhongGL::Flag::MultiDraw) { - #ifndef MAGNUM_TARGET_GLES - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ARB::shader_draw_parameters::string() << "is not supported."); - #elif !defined(MAGNUM_TARGET_WEBGL) - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ANGLE::multi_draw::string() << "is not supported."); - #else - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::WEBGL::multi_draw::string() << "is not supported."); - #endif - } - - auto compileState = PhongGL::compile(data.flags, data.lightCount, data.materialCount, data.drawCount); - CORRADE_COMPARE(compileState.flags(), data.flags); - CORRADE_COMPARE(compileState.lightCount(), data.lightCount); - CORRADE_COMPARE(compileState.materialCount(), data.materialCount); - CORRADE_COMPARE(compileState.drawCount(), data.drawCount); + auto compileState = PhongGL::compile(PhongGL::Flag::UniformBuffers|PhongGL::Flag::LightCulling, 8, 8, 24); + CORRADE_COMPARE(compileState.flags(), PhongGL::Flag::UniformBuffers|PhongGL::Flag::LightCulling); + CORRADE_COMPARE(compileState.lightCount(), 8); + CORRADE_COMPARE(compileState.materialCount(), 8); + CORRADE_COMPARE(compileState.drawCount(), 24); while(!compileState.isLinkFinished()) Utility::System::sleep(100); PhongGL shader{std::move(compileState)}; - CORRADE_COMPARE(shader.flags(), data.flags); - CORRADE_COMPARE(shader.lightCount(), data.lightCount); - CORRADE_COMPARE(shader.materialCount(), data.materialCount); - CORRADE_COMPARE(shader.drawCount(), data.drawCount); + CORRADE_COMPARE(shader.flags(), PhongGL::Flag::UniformBuffers|PhongGL::Flag::LightCulling); + CORRADE_COMPARE(shader.lightCount(), 8); + CORRADE_COMPARE(shader.materialCount(), 8); + CORRADE_COMPARE(shader.drawCount(), 24); CORRADE_VERIFY(shader.isLinkFinished()); CORRADE_VERIFY(shader.id()); { diff --git a/src/Magnum/Shaders/Test/VectorGLTest.cpp b/src/Magnum/Shaders/Test/VectorGLTest.cpp index 7b8bff18f..715688e1e 100644 --- a/src/Magnum/Shaders/Test/VectorGLTest.cpp +++ b/src/Magnum/Shaders/Test/VectorGLTest.cpp @@ -384,23 +384,15 @@ template void VectorGLTest::construct() { template void VectorGLTest::constructAsync() { setTestCaseTemplateName(Utility::format("{}", dimensions)); - constexpr struct { - const char* name; - VectorGL2D::Flags flags; - } data { - "texture transformation", VectorGL2D::Flag::TextureTransformation - }; - setTestCaseDescription(data.name); - - auto compileState = VectorGL::compile(data.flags); - CORRADE_COMPARE(compileState.flags(), data.flags); + auto compileState = VectorGL::compile(VectorGL2D::Flag::TextureTransformation); + CORRADE_COMPARE(compileState.flags(), VectorGL2D::Flag::TextureTransformation); while(!compileState.isLinkFinished()) Utility::System::sleep(100); VectorGL shader{std::move(compileState)}; CORRADE_VERIFY(shader.isLinkFinished()); - CORRADE_COMPARE(shader.flags(), data.flags); + CORRADE_COMPARE(shader.flags(), VectorGL2D::Flag::TextureTransformation); CORRADE_VERIFY(shader.id()); { #if defined(CORRADE_TARGET_APPLE) && !defined(MAGNUM_TARGET_GLES) @@ -455,43 +447,24 @@ template void VectorGLTest::constructUniformBuffers() { template void VectorGLTest::constructUniformBuffersAsync() { setTestCaseTemplateName(Utility::format("{}", dimensions)); - constexpr struct { - const char* name; - VectorGL2D::Flags flags; - UnsignedInt materialCount, drawCount; - } data {"texture transformation", VectorGL2D::Flag::UniformBuffers|VectorGL2D::Flag::TextureTransformation, 1, 1}; - setTestCaseDescription(data.name); - #ifndef MAGNUM_TARGET_GLES - if((data.flags & VectorGL::Flag::UniformBuffers) && !GL::Context::current().isExtensionSupported()) + if(!GL::Context::current().isExtensionSupported()) CORRADE_SKIP(GL::Extensions::ARB::uniform_buffer_object::string() << "is not supported."); #endif - if(data.flags >= VectorGL2D::Flag::MultiDraw) { - #ifndef MAGNUM_TARGET_GLES - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ARB::shader_draw_parameters::string() << "is not supported."); - #elif !defined(MAGNUM_TARGET_WEBGL) - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ANGLE::multi_draw::string() << "is not supported."); - #else - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::WEBGL::multi_draw::string() << "is not supported."); - #endif - } - - auto compileState = VectorGL::compile(data.flags, data.materialCount, data.drawCount); - CORRADE_COMPARE(compileState.flags(), data.flags); - CORRADE_COMPARE(compileState.materialCount(), data.materialCount); - CORRADE_COMPARE(compileState.drawCount(), data.drawCount); + auto compileState = VectorGL::compile(VectorGL2D::Flag::UniformBuffers|VectorGL2D::Flag::TextureTransformation, 1, 1); + CORRADE_COMPARE(compileState.flags(), VectorGL2D::Flag::UniformBuffers|VectorGL2D::Flag::TextureTransformation); + CORRADE_COMPARE(compileState.materialCount(), 1); + CORRADE_COMPARE(compileState.drawCount(), 1); while(!compileState.isLinkFinished()) Utility::System::sleep(100); VectorGL shader{std::move(compileState)}; CORRADE_VERIFY(shader.isLinkFinished()); - CORRADE_COMPARE(shader.flags(), data.flags); - CORRADE_COMPARE(shader.drawCount(), data.drawCount); + CORRADE_COMPARE(shader.flags(), VectorGL2D::Flag::UniformBuffers|VectorGL2D::Flag::TextureTransformation); + CORRADE_COMPARE(shader.materialCount(), 1); + CORRADE_COMPARE(shader.drawCount(), 1); CORRADE_VERIFY(shader.id()); { #if defined(CORRADE_TARGET_APPLE) && !defined(MAGNUM_TARGET_GLES) diff --git a/src/Magnum/Shaders/Test/VertexColorGLTest.cpp b/src/Magnum/Shaders/Test/VertexColorGLTest.cpp index 233850198..451c7348f 100644 --- a/src/Magnum/Shaders/Test/VertexColorGLTest.cpp +++ b/src/Magnum/Shaders/Test/VertexColorGLTest.cpp @@ -382,42 +382,21 @@ template void VertexColorGLTest::constructUniformBuffers template void VertexColorGLTest::constructUniformBuffersAsync() { setTestCaseTemplateName(Utility::format("{}", dimensions)); - constexpr struct { - const char* name; - VertexColorGL2D::Flags flags; - UnsignedInt drawCount; - } data { - "multiple draws", VertexColorGL2D::Flag::UniformBuffers, 63 - }; - setTestCaseDescription(data.name); - #ifndef MAGNUM_TARGET_GLES - if((data.flags & VertexColorGL::Flag::UniformBuffers) && !GL::Context::current().isExtensionSupported()) + if(!GL::Context::current().isExtensionSupported()) CORRADE_SKIP(GL::Extensions::ARB::uniform_buffer_object::string() << "is not supported."); #endif - if(data.flags >= VertexColorGL2D::Flag::MultiDraw) { - #ifndef MAGNUM_TARGET_GLES - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ARB::shader_draw_parameters::string() << "is not supported."); - #elif !defined(MAGNUM_TARGET_WEBGL) - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::ANGLE::multi_draw::string() << "is not supported."); - #else - if(!GL::Context::current().isExtensionSupported()) - CORRADE_SKIP(GL::Extensions::WEBGL::multi_draw::string() << "is not supported."); - #endif - } - auto compileState = VertexColorGL::compile(data.flags, data.drawCount); - CORRADE_COMPARE(compileState.flags(), data.flags); - CORRADE_COMPARE(compileState.drawCount(), data.drawCount); + auto compileState = VertexColorGL::compile(VertexColorGL2D::Flag::UniformBuffers, 63); + CORRADE_COMPARE(compileState.flags(), VertexColorGL2D::Flag::UniformBuffers); + CORRADE_COMPARE(compileState.drawCount(), 63); while(!compileState.isLinkFinished()) Utility::System::sleep(100); VertexColorGL shader{std::move(compileState)}; - CORRADE_COMPARE(shader.flags(), data.flags); - CORRADE_COMPARE(shader.drawCount(), data.drawCount); + CORRADE_COMPARE(shader.flags(), VertexColorGL2D::Flag::UniformBuffers); + CORRADE_COMPARE(shader.drawCount(), 63); CORRADE_VERIFY(shader.isLinkFinished()); CORRADE_VERIFY(shader.id()); {