|
|
|
@ -29,6 +29,7 @@ |
|
|
|
#include <Corrade/PluginManager/Manager.h> |
|
|
|
#include <Corrade/PluginManager/Manager.h> |
|
|
|
#include <Corrade/Utility/DebugStl.h> |
|
|
|
#include <Corrade/Utility/DebugStl.h> |
|
|
|
#include <Corrade/Utility/Format.h> |
|
|
|
#include <Corrade/Utility/Format.h> |
|
|
|
|
|
|
|
#include <Corrade/Utility/System.h> |
|
|
|
#include <Corrade/Utility/Path.h> |
|
|
|
#include <Corrade/Utility/Path.h> |
|
|
|
|
|
|
|
|
|
|
|
#ifdef CORRADE_TARGET_APPLE |
|
|
|
#ifdef CORRADE_TARGET_APPLE |
|
|
|
@ -74,8 +75,10 @@ struct VertexColorGLTest: GL::OpenGLTester { |
|
|
|
explicit VertexColorGLTest(); |
|
|
|
explicit VertexColorGLTest(); |
|
|
|
|
|
|
|
|
|
|
|
template<UnsignedInt dimensions> void construct(); |
|
|
|
template<UnsignedInt dimensions> void construct(); |
|
|
|
|
|
|
|
template<UnsignedInt dimensions> void constructAsync(); |
|
|
|
#ifndef MAGNUM_TARGET_GLES2 |
|
|
|
#ifndef MAGNUM_TARGET_GLES2 |
|
|
|
template<UnsignedInt dimensions> void constructUniformBuffers(); |
|
|
|
template<UnsignedInt dimensions> void constructUniformBuffers(); |
|
|
|
|
|
|
|
template<UnsignedInt dimensions> void constructUniformBuffersAsync(); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
template<UnsignedInt dimensions> void constructMove(); |
|
|
|
template<UnsignedInt dimensions> void constructMove(); |
|
|
|
@ -190,13 +193,19 @@ constexpr struct { |
|
|
|
VertexColorGLTest::VertexColorGLTest() { |
|
|
|
VertexColorGLTest::VertexColorGLTest() { |
|
|
|
addTests<VertexColorGLTest>({ |
|
|
|
addTests<VertexColorGLTest>({ |
|
|
|
&VertexColorGLTest::construct<2>, |
|
|
|
&VertexColorGLTest::construct<2>, |
|
|
|
&VertexColorGLTest::construct<3>}); |
|
|
|
&VertexColorGLTest::construct<3>, |
|
|
|
|
|
|
|
&VertexColorGLTest::constructAsync<2>, |
|
|
|
|
|
|
|
&VertexColorGLTest::constructAsync<3>}); |
|
|
|
|
|
|
|
|
|
|
|
#ifndef MAGNUM_TARGET_GLES2 |
|
|
|
#ifndef MAGNUM_TARGET_GLES2 |
|
|
|
addInstancedTests<VertexColorGLTest>({ |
|
|
|
addInstancedTests<VertexColorGLTest>({ |
|
|
|
&VertexColorGLTest::constructUniformBuffers<2>, |
|
|
|
&VertexColorGLTest::constructUniformBuffers<2>, |
|
|
|
&VertexColorGLTest::constructUniformBuffers<3>}, |
|
|
|
&VertexColorGLTest::constructUniformBuffers<3>}, |
|
|
|
Containers::arraySize(ConstructUniformBuffersData)); |
|
|
|
Containers::arraySize(ConstructUniformBuffersData)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addTests<VertexColorGLTest>({ |
|
|
|
|
|
|
|
&VertexColorGLTest::constructUniformBuffersAsync<2>, |
|
|
|
|
|
|
|
&VertexColorGLTest::constructUniformBuffersAsync<3>}); |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
addTests<VertexColorGLTest>({ |
|
|
|
addTests<VertexColorGLTest>({ |
|
|
|
@ -309,6 +318,28 @@ template<UnsignedInt dimensions> void VertexColorGLTest::construct() { |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<UnsignedInt dimensions> void VertexColorGLTest::constructAsync() { |
|
|
|
|
|
|
|
setTestCaseTemplateName(Utility::format("{}", dimensions)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto compileState = VertexColorGL<dimensions>::compile({}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(!compileState.isLinkFinished()) |
|
|
|
|
|
|
|
Utility::System::sleep(100); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VertexColorGL<dimensions> shader{std::move(compileState)}; |
|
|
|
|
|
|
|
CORRADE_VERIFY(shader.isLinkFinished()); |
|
|
|
|
|
|
|
CORRADE_VERIFY(shader.id()); |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
#if defined(CORRADE_TARGET_APPLE) && !defined(MAGNUM_TARGET_GLES) |
|
|
|
|
|
|
|
CORRADE_EXPECT_FAIL("macOS drivers need insane amount of state to validate properly."); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
CORRADE_VERIFY(shader.validate().first); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef MAGNUM_TARGET_GLES2 |
|
|
|
#ifndef MAGNUM_TARGET_GLES2 |
|
|
|
template<UnsignedInt dimensions> void VertexColorGLTest::constructUniformBuffers() { |
|
|
|
template<UnsignedInt dimensions> void VertexColorGLTest::constructUniformBuffers() { |
|
|
|
setTestCaseTemplateName(Utility::format("{}", dimensions)); |
|
|
|
setTestCaseTemplateName(Utility::format("{}", dimensions)); |
|
|
|
@ -347,6 +378,57 @@ template<UnsignedInt dimensions> void VertexColorGLTest::constructUniformBuffers |
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template<UnsignedInt dimensions> 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<dimensions>::Flag::UniformBuffers) && !GL::Context::current().isExtensionSupported<GL::Extensions::ARB::uniform_buffer_object>()) |
|
|
|
|
|
|
|
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<GL::Extensions::ARB::shader_draw_parameters>()) |
|
|
|
|
|
|
|
CORRADE_SKIP(GL::Extensions::ARB::shader_draw_parameters::string() << "is not supported."); |
|
|
|
|
|
|
|
#elif !defined(MAGNUM_TARGET_WEBGL) |
|
|
|
|
|
|
|
if(!GL::Context::current().isExtensionSupported<GL::Extensions::ANGLE::multi_draw>()) |
|
|
|
|
|
|
|
CORRADE_SKIP(GL::Extensions::ANGLE::multi_draw::string() << "is not supported."); |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
if(!GL::Context::current().isExtensionSupported<GL::Extensions::WEBGL::multi_draw>()) |
|
|
|
|
|
|
|
CORRADE_SKIP(GL::Extensions::WEBGL::multi_draw::string() << "is not supported."); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
auto compileState = VertexColorGL<dimensions>::compile(data.flags, data.drawCount); |
|
|
|
|
|
|
|
CORRADE_COMPARE(compileState.flags(), data.flags); |
|
|
|
|
|
|
|
CORRADE_COMPARE(compileState.drawCount(), data.drawCount); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(!compileState.isLinkFinished()) |
|
|
|
|
|
|
|
Utility::System::sleep(100); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VertexColorGL<dimensions> shader{std::move(compileState)}; |
|
|
|
|
|
|
|
CORRADE_COMPARE(shader.flags(), data.flags); |
|
|
|
|
|
|
|
CORRADE_COMPARE(shader.drawCount(), data.drawCount); |
|
|
|
|
|
|
|
CORRADE_VERIFY(shader.isLinkFinished()); |
|
|
|
|
|
|
|
CORRADE_VERIFY(shader.id()); |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
#if defined(CORRADE_TARGET_APPLE) && !defined(MAGNUM_TARGET_GLES) |
|
|
|
|
|
|
|
CORRADE_EXPECT_FAIL("macOS drivers need insane amount of state to validate properly."); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
CORRADE_VERIFY(shader.validate().first); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
template<UnsignedInt dimensions> void VertexColorGLTest::constructMove() { |
|
|
|
template<UnsignedInt dimensions> void VertexColorGLTest::constructMove() { |
|
|
|
|