From cd7f67e5c9010350a1af2de031bb9cf0e021159b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 21 Oct 2018 12:19:28 +0200 Subject: [PATCH] GL: make the Array GL::samplerWrapping() work and test it. Also not sure what happened there. --- src/Magnum/GL/Sampler.h | 5 +++-- src/Magnum/GL/Test/SamplerTest.cpp | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Magnum/GL/Sampler.h b/src/Magnum/GL/Sampler.h index 9336767b5..752a20948 100644 --- a/src/Magnum/GL/Sampler.h +++ b/src/Magnum/GL/Sampler.h @@ -29,6 +29,7 @@ * @brief Class @ref Magnum::GL::Sampler, enum @ref Magnum::GL::SamplerFilter, @ref Magnum::GL::SamplerMipmap, @ref Magnum::GL::SamplerWrapping, @ref Magnum::GL::SamplerCompareMode, @ref Magnum::GL::SamplerCompareFunction, @ref Magnum::GL::SamplerDepthStencilMode, function @ref Magnum::GL::samplerFilter(), @ref Magnum::GL::samplerMipmap(), @ref Magnum::GL::hasSamplerWrapping(), @ref Magnum::GL::samplerWrapping() */ +#include "Magnum/Array.h" #include "Magnum/Magnum.h" #include "Magnum/GL/OpenGL.h" #include "Magnum/GL/visibility.h" @@ -189,9 +190,9 @@ format, @cpp true @ce otherwise. The @p filter value is expected to be valid. extension. Such check is outside of the scope of this function and you are expected to verify extension availability before using such format. -@see @ref samplerFilter(), @ref samplerMipmap() +@see @see @ref samplerWrapping(), @ref samplerFilter(), @ref samplerMipmap() */ -MAGNUM_GL_EXPORT bool hasSamplerWrapping(Magnum::SamplerWrapping wrappomg); +MAGNUM_GL_EXPORT bool hasSamplerWrapping(Magnum::SamplerWrapping wrapping); /** @brief Convert generic sampler filter mode to OpenGL filter mode diff --git a/src/Magnum/GL/Test/SamplerTest.cpp b/src/Magnum/GL/Test/SamplerTest.cpp index b6a8f2086..ea606e563 100644 --- a/src/Magnum/GL/Test/SamplerTest.cpp +++ b/src/Magnum/GL/Test/SamplerTest.cpp @@ -39,6 +39,7 @@ struct SamplerTest: TestSuite::Tester { void mapMipmap(); void mapMipmapInvalid(); void mapWrapping(); + void mapWrappingArray(); void mapWrappingInvalid(); void mapWrappingUnsupported(); @@ -60,6 +61,7 @@ SamplerTest::SamplerTest() { &SamplerTest::mapMipmap, &SamplerTest::mapMipmapInvalid, &SamplerTest::mapWrapping, + &SamplerTest::mapWrappingArray, &SamplerTest::mapWrappingInvalid, &SamplerTest::mapWrappingUnsupported, @@ -126,6 +128,10 @@ void SamplerTest::mapWrapping() { #endif } +void SamplerTest::mapWrappingArray() { + CORRADE_COMPARE(samplerWrapping<2>({Magnum::SamplerWrapping::Repeat, Magnum::SamplerWrapping::ClampToEdge}), (Array2D{SamplerWrapping::Repeat, SamplerWrapping::ClampToEdge})); +} + void SamplerTest::mapWrappingInvalid() { std::ostringstream out; Error redirectError{&out}; @@ -141,10 +147,13 @@ void SamplerTest::mapWrappingUnsupported() { #ifndef MAGNUM_TARGET_GLES CORRADE_SKIP("All pixel formats are supported on desktop"); #else - std::ostringstream out; - Error redirectError{&out}; + CORRADE_VERIFY(!hasSamplerWrapping(Magnum::SamplerWrapping::MirrorClampToEdge)); - samplerWrapping(Magnum::SamplerWrapping::MirrorClampToEdge); + std::ostringstream out; + { + Error redirectError{&out}; + samplerWrapping(Magnum::SamplerWrapping::MirrorClampToEdge); + } CORRADE_COMPARE(out.str(), "GL::samplerWrapping(): wrapping SamplerWrapping::MirrorClampToEdge is not supported on this target\n"); #endif