|
|
|
|
@ -102,6 +102,7 @@ struct FlatGLTest: GL::OpenGLTester {
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
|
PluginManager::Manager<Trade::AbstractImporter> _manager{"nonexistent"}; |
|
|
|
|
std::string _testDir; |
|
|
|
|
|
|
|
|
|
GL::Renderbuffer _color{NoCreate}; |
|
|
|
|
#ifndef MAGNUM_TARGET_GLES2 |
|
|
|
|
@ -219,6 +220,20 @@ FlatGLTest::FlatGLTest() {
|
|
|
|
|
#ifdef TGAIMPORTER_PLUGIN_FILENAME |
|
|
|
|
CORRADE_INTERNAL_ASSERT(_manager.load(TGAIMPORTER_PLUGIN_FILENAME) & PluginManager::LoadState::Loaded); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef CORRADE_TARGET_APPLE |
|
|
|
|
if(Utility::Directory::isSandboxed() |
|
|
|
|
#if defined(CORRADE_TARGET_IOS) && defined(CORRADE_TESTSUITE_TARGET_XCTEST) |
|
|
|
|
/** @todo Fix this once I persuade CMake to run XCTest tests properly */ |
|
|
|
|
&& std::getenv("SIMULATOR_UDID") |
|
|
|
|
#endif |
|
|
|
|
) { |
|
|
|
|
_testDir = Utility::Directory::path(Utility::Directory::executableLocation()); |
|
|
|
|
} else |
|
|
|
|
#endif |
|
|
|
|
{ |
|
|
|
|
_testDir = SHADERS_TEST_DIR; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<UnsignedInt dimensions> void FlatGLTest::construct() { |
|
|
|
|
@ -344,7 +359,7 @@ void FlatGLTest::renderDefaults2D() {
|
|
|
|
|
CORRADE_COMPARE_WITH( |
|
|
|
|
/* Dropping the alpha channel, as it's always 1.0 */ |
|
|
|
|
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), |
|
|
|
|
Utility::Directory::join(SHADERS_TEST_DIR, "FlatTestFiles/defaults.tga"), |
|
|
|
|
Utility::Directory::join(_testDir, "FlatTestFiles/defaults.tga"), |
|
|
|
|
/* SwiftShader has 8 different pixels on the edges */ |
|
|
|
|
(DebugTools::CompareImageToFile{_manager, 238.0f, 0.2975f})); |
|
|
|
|
} |
|
|
|
|
@ -364,7 +379,7 @@ void FlatGLTest::renderDefaults3D() {
|
|
|
|
|
CORRADE_COMPARE_WITH( |
|
|
|
|
/* Dropping the alpha channel, as it's always 1.0 */ |
|
|
|
|
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), |
|
|
|
|
Utility::Directory::join(SHADERS_TEST_DIR, "FlatTestFiles/defaults.tga"), |
|
|
|
|
Utility::Directory::join(_testDir, "FlatTestFiles/defaults.tga"), |
|
|
|
|
/* SwiftShader has 8 different pixels on the edges */ |
|
|
|
|
(DebugTools::CompareImageToFile{_manager, 238.0f, 0.2975f})); |
|
|
|
|
} |
|
|
|
|
@ -393,7 +408,7 @@ void FlatGLTest::renderColored2D() {
|
|
|
|
|
CORRADE_COMPARE_WITH( |
|
|
|
|
/* Dropping the alpha channel, as it's always 1.0 */ |
|
|
|
|
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), |
|
|
|
|
Utility::Directory::join(SHADERS_TEST_DIR, "FlatTestFiles/colored2D.tga"), |
|
|
|
|
Utility::Directory::join(_testDir, "FlatTestFiles/colored2D.tga"), |
|
|
|
|
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -426,7 +441,7 @@ void FlatGLTest::renderColored3D() {
|
|
|
|
|
CORRADE_COMPARE_WITH( |
|
|
|
|
/* Dropping the alpha channel, as it's always 1.0 */ |
|
|
|
|
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), |
|
|
|
|
Utility::Directory::join(SHADERS_TEST_DIR, "FlatTestFiles/colored3D.tga"), |
|
|
|
|
Utility::Directory::join(_testDir, "FlatTestFiles/colored3D.tga"), |
|
|
|
|
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -479,7 +494,7 @@ void FlatGLTest::renderSinglePixelTextured2D() {
|
|
|
|
|
CORRADE_COMPARE_WITH( |
|
|
|
|
/* Dropping the alpha channel, as it's always 1.0 */ |
|
|
|
|
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), |
|
|
|
|
Utility::Directory::join(SHADERS_TEST_DIR, "FlatTestFiles/colored2D.tga"), |
|
|
|
|
Utility::Directory::join(_testDir, "FlatTestFiles/colored2D.tga"), |
|
|
|
|
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -521,7 +536,7 @@ void FlatGLTest::renderSinglePixelTextured3D() {
|
|
|
|
|
CORRADE_COMPARE_WITH( |
|
|
|
|
/* Dropping the alpha channel, as it's always 1.0 */ |
|
|
|
|
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), |
|
|
|
|
Utility::Directory::join(SHADERS_TEST_DIR, "FlatTestFiles/colored3D.tga"), |
|
|
|
|
Utility::Directory::join(_testDir, "FlatTestFiles/colored3D.tga"), |
|
|
|
|
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -538,7 +553,7 @@ void FlatGLTest::renderTextured2D() {
|
|
|
|
|
|
|
|
|
|
GL::Texture2D texture; |
|
|
|
|
Containers::Optional<Trade::ImageData2D> image; |
|
|
|
|
CORRADE_VERIFY(importer->openFile(Utility::Directory::join(SHADERS_TEST_DIR, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); |
|
|
|
|
CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); |
|
|
|
|
texture.setMinificationFilter(GL::SamplerFilter::Linear) |
|
|
|
|
.setMagnificationFilter(GL::SamplerFilter::Linear) |
|
|
|
|
.setWrapping(GL::SamplerWrapping::ClampToEdge) |
|
|
|
|
@ -565,7 +580,7 @@ void FlatGLTest::renderTextured2D() {
|
|
|
|
|
CORRADE_COMPARE_WITH( |
|
|
|
|
/* Dropping the alpha channel, as it's always 1.0 */ |
|
|
|
|
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), |
|
|
|
|
Utility::Directory::join(SHADERS_TEST_DIR, "FlatTestFiles/textured2D.tga"), |
|
|
|
|
Utility::Directory::join(_testDir, "FlatTestFiles/textured2D.tga"), |
|
|
|
|
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -582,7 +597,7 @@ void FlatGLTest::renderTextured3D() {
|
|
|
|
|
|
|
|
|
|
GL::Texture2D texture; |
|
|
|
|
Containers::Optional<Trade::ImageData2D> image; |
|
|
|
|
CORRADE_VERIFY(importer->openFile(Utility::Directory::join(SHADERS_TEST_DIR, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); |
|
|
|
|
CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); |
|
|
|
|
texture.setMinificationFilter(GL::SamplerFilter::Linear) |
|
|
|
|
.setMagnificationFilter(GL::SamplerFilter::Linear) |
|
|
|
|
.setWrapping(GL::SamplerWrapping::ClampToEdge) |
|
|
|
|
@ -613,7 +628,7 @@ void FlatGLTest::renderTextured3D() {
|
|
|
|
|
CORRADE_COMPARE_WITH( |
|
|
|
|
/* Dropping the alpha channel, as it's always 1.0 */ |
|
|
|
|
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), |
|
|
|
|
Utility::Directory::join(SHADERS_TEST_DIR, "FlatTestFiles/textured3D.tga"), |
|
|
|
|
Utility::Directory::join(_testDir, "FlatTestFiles/textured3D.tga"), |
|
|
|
|
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -642,7 +657,7 @@ template<class T> void FlatGLTest::renderVertexColor2D() {
|
|
|
|
|
|
|
|
|
|
GL::Texture2D texture; |
|
|
|
|
Containers::Optional<Trade::ImageData2D> image; |
|
|
|
|
CORRADE_VERIFY(importer->openFile(Utility::Directory::join(SHADERS_TEST_DIR, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); |
|
|
|
|
CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); |
|
|
|
|
texture.setMinificationFilter(GL::SamplerFilter::Linear) |
|
|
|
|
.setMagnificationFilter(GL::SamplerFilter::Linear) |
|
|
|
|
.setWrapping(GL::SamplerWrapping::ClampToEdge) |
|
|
|
|
@ -667,7 +682,7 @@ template<class T> void FlatGLTest::renderVertexColor2D() {
|
|
|
|
|
CORRADE_COMPARE_WITH( |
|
|
|
|
/* Dropping the alpha channel, as it's always 1.0 */ |
|
|
|
|
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), |
|
|
|
|
Utility::Directory::join(SHADERS_TEST_DIR, "FlatTestFiles/vertexColor2D.tga"), |
|
|
|
|
Utility::Directory::join(_testDir, "FlatTestFiles/vertexColor2D.tga"), |
|
|
|
|
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -696,7 +711,7 @@ template<class T> void FlatGLTest::renderVertexColor3D() {
|
|
|
|
|
|
|
|
|
|
GL::Texture2D texture; |
|
|
|
|
Containers::Optional<Trade::ImageData2D> image; |
|
|
|
|
CORRADE_VERIFY(importer->openFile(Utility::Directory::join(SHADERS_TEST_DIR, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); |
|
|
|
|
CORRADE_VERIFY(importer->openFile(Utility::Directory::join(_testDir, "TestFiles/diffuse-texture.tga")) && (image = importer->image2D(0))); |
|
|
|
|
texture.setMinificationFilter(GL::SamplerFilter::Linear) |
|
|
|
|
.setMagnificationFilter(GL::SamplerFilter::Linear) |
|
|
|
|
.setWrapping(GL::SamplerWrapping::ClampToEdge) |
|
|
|
|
@ -725,7 +740,7 @@ template<class T> void FlatGLTest::renderVertexColor3D() {
|
|
|
|
|
CORRADE_COMPARE_WITH( |
|
|
|
|
/* Dropping the alpha channel, as it's always 1.0 */ |
|
|
|
|
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), |
|
|
|
|
Utility::Directory::join(SHADERS_TEST_DIR, "FlatTestFiles/vertexColor3D.tga"), |
|
|
|
|
Utility::Directory::join(_testDir, "FlatTestFiles/vertexColor3D.tga"), |
|
|
|
|
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -756,7 +771,7 @@ void FlatGLTest::renderAlpha2D() {
|
|
|
|
|
CORRADE_VERIFY(importer); |
|
|
|
|
|
|
|
|
|
GL::Texture2D texture; |
|
|
|
|
CORRADE_VERIFY(importer->openFile(Utility::Directory::join({SHADERS_TEST_DIR, "TestFiles", "diffuse-alpha-texture.tga"})) && (image = importer->image2D(0))); |
|
|
|
|
CORRADE_VERIFY(importer->openFile(Utility::Directory::join({_testDir, "TestFiles", "diffuse-alpha-texture.tga"})) && (image = importer->image2D(0))); |
|
|
|
|
texture.setMinificationFilter(GL::SamplerFilter::Linear) |
|
|
|
|
.setMagnificationFilter(GL::SamplerFilter::Linear) |
|
|
|
|
.setWrapping(GL::SamplerWrapping::ClampToEdge) |
|
|
|
|
@ -790,7 +805,7 @@ void FlatGLTest::renderAlpha2D() {
|
|
|
|
|
CORRADE_COMPARE_WITH( |
|
|
|
|
/* Dropping the alpha channel, as it's always 1.0 */ |
|
|
|
|
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), |
|
|
|
|
Utility::Directory::join(SHADERS_TEST_DIR, data.expected2D), |
|
|
|
|
Utility::Directory::join(_testDir, data.expected2D), |
|
|
|
|
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -807,7 +822,7 @@ void FlatGLTest::renderAlpha3D() {
|
|
|
|
|
CORRADE_VERIFY(importer); |
|
|
|
|
|
|
|
|
|
GL::Texture2D texture; |
|
|
|
|
CORRADE_VERIFY(importer->openFile(Utility::Directory::join({SHADERS_TEST_DIR, "TestFiles", "diffuse-alpha-texture.tga"})) && (image = importer->image2D(0))); |
|
|
|
|
CORRADE_VERIFY(importer->openFile(Utility::Directory::join({_testDir, "TestFiles", "diffuse-alpha-texture.tga"})) && (image = importer->image2D(0))); |
|
|
|
|
texture.setMinificationFilter(GL::SamplerFilter::Linear) |
|
|
|
|
.setMagnificationFilter(GL::SamplerFilter::Linear) |
|
|
|
|
.setWrapping(GL::SamplerWrapping::ClampToEdge) |
|
|
|
|
@ -850,7 +865,7 @@ void FlatGLTest::renderAlpha3D() {
|
|
|
|
|
CORRADE_COMPARE_WITH( |
|
|
|
|
/* Dropping the alpha channel, as it's always 1.0 */ |
|
|
|
|
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), |
|
|
|
|
Utility::Directory::join({SHADERS_TEST_DIR, data.expected3D}), |
|
|
|
|
Utility::Directory::join({_testDir, data.expected3D}), |
|
|
|
|
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -912,7 +927,7 @@ void FlatGLTest::renderObjectId2D() {
|
|
|
|
|
CORRADE_COMPARE_WITH( |
|
|
|
|
/* Dropping the alpha channel, as it's always 1.0 */ |
|
|
|
|
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), |
|
|
|
|
Utility::Directory::join(SHADERS_TEST_DIR, "FlatTestFiles/colored2D.tga"), |
|
|
|
|
Utility::Directory::join(_testDir, "FlatTestFiles/colored2D.tga"), |
|
|
|
|
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); |
|
|
|
|
|
|
|
|
|
/* Object ID -- no need to verify the whole image, just check that pixels
|
|
|
|
|
@ -964,7 +979,7 @@ void FlatGLTest::renderObjectId3D() {
|
|
|
|
|
CORRADE_COMPARE_WITH( |
|
|
|
|
/* Dropping the alpha channel, as it's always 1.0 */ |
|
|
|
|
Containers::arrayCast<Color3ub>(_framebuffer.read(_framebuffer.viewport(), {PixelFormat::RGBA8Unorm}).pixels<Color4ub>()), |
|
|
|
|
Utility::Directory::join(SHADERS_TEST_DIR, "FlatTestFiles/colored3D.tga"), |
|
|
|
|
Utility::Directory::join(_testDir, "FlatTestFiles/colored3D.tga"), |
|
|
|
|
(DebugTools::CompareImageToFile{_manager, maxThreshold, meanThreshold})); |
|
|
|
|
|
|
|
|
|
/* Object ID -- no need to verify the whole image, just check that pixels
|
|
|
|
|
|