From 31bfff76e7b215b5750791ceec936c8bb65ae6c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 5 Sep 2015 13:01:23 +0200 Subject: [PATCH] Clearer test case naming. We're testing just full image query, not full image upload. --- src/Magnum/Test/CubeMapTextureGLTest.cpp | 270 +++++++++++------------ 1 file changed, 135 insertions(+), 135 deletions(-) diff --git a/src/Magnum/Test/CubeMapTextureGLTest.cpp b/src/Magnum/Test/CubeMapTextureGLTest.cpp index b4de2a517..c29213243 100644 --- a/src/Magnum/Test/CubeMapTextureGLTest.cpp +++ b/src/Magnum/Test/CubeMapTextureGLTest.cpp @@ -68,18 +68,18 @@ struct CubeMapTextureGLTest: AbstractOpenGLTester { void storage(); - #ifndef MAGNUM_TARGET_GLES - void imageFull(); - void compressedImageFull(); - void imageFullBuffer(); - void compressedImageFullBuffer(); - #endif void image(); void compressedImage(); #ifndef MAGNUM_TARGET_GLES2 void imageBuffer(); void compressedImageBuffer(); #endif + #ifndef MAGNUM_TARGET_GLES + void fullImageQuery(); + void compressedFullImageQuery(); + void fullImageQueryBuffer(); + void compressedFullImageQueryBuffer(); + #endif void subImage(); void compressedSubImage(); @@ -125,18 +125,18 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() { &CubeMapTextureGLTest::storage, - #ifndef MAGNUM_TARGET_GLES - &CubeMapTextureGLTest::imageFull, - &CubeMapTextureGLTest::compressedImageFull, - &CubeMapTextureGLTest::imageFullBuffer, - &CubeMapTextureGLTest::compressedImageFullBuffer, - #endif &CubeMapTextureGLTest::image, &CubeMapTextureGLTest::compressedImage, #ifndef MAGNUM_TARGET_GLES2 &CubeMapTextureGLTest::imageBuffer, &CubeMapTextureGLTest::compressedImageBuffer, #endif + #ifndef MAGNUM_TARGET_GLES + &CubeMapTextureGLTest::fullImageQuery, + &CubeMapTextureGLTest::compressedFullImageQuery, + &CubeMapTextureGLTest::fullImageQueryBuffer, + &CubeMapTextureGLTest::compressedFullImageQueryBuffer, + #endif &CubeMapTextureGLTest::subImage, &CubeMapTextureGLTest::compressedSubImage, @@ -367,7 +367,116 @@ void CubeMapTextureGLTest::storage() { } namespace { - constexpr UnsignedByte DataFull[] = { 0x00, 0x01, 0x02, 0x03, + constexpr UnsignedByte Data[] = { 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, + 0x0c, 0x0d, 0x0e, 0x0f }; + + /* Just 4x4 0x00 - 0x3f compressed using RGBA DXT3 by the driver */ + constexpr UnsignedByte CompressedData[] = { + 0, 17, 17, 34, 34, 51, 51, 67, + 232, 57, 0, 0, 213, 255, 170, 2 + }; +} + +void CubeMapTextureGLTest::image() { + CubeMapTexture texture; + texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8, + ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data)); + + MAGNUM_VERIFY_NO_ERROR(); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + Image2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte}); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(2)); + CORRADE_COMPARE_AS( + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{Data}, TestSuite::Compare::Container); + #endif +} + +void CubeMapTextureGLTest::compressedImage() { + #ifndef MAGNUM_TARGET_WEBGL + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::WEBGL::compressed_texture_s3tc::string() + std::string(" is not supported.")); + #endif + + CubeMapTexture texture; + texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0, + CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData}); + + MAGNUM_VERIFY_NO_ERROR(); + + #ifndef MAGNUM_TARGET_GLES + CompressedImage2D image = texture.compressedImage(CubeMapTexture::Coordinate::PositiveX, 0, {}); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i{4}); + CORRADE_COMPARE_AS( + (Containers::ArrayView{image.data(), image.data().size()}), + Containers::ArrayView{CompressedData}, TestSuite::Compare::Container); + #endif +} + +#ifndef MAGNUM_TARGET_GLES2 +void CubeMapTextureGLTest::imageBuffer() { + CubeMapTexture texture; + texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8, + BufferImage2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data, BufferUsage::StaticDraw)); + + MAGNUM_VERIFY_NO_ERROR(); + + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES + BufferImage2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); + const auto imageData = image.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i(2)); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data}, TestSuite::Compare::Container); + #endif +} + +void CubeMapTextureGLTest::compressedImageBuffer() { + #ifndef MAGNUM_TARGET_WEBGL + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::WEBGL::compressed_texture_s3tc::string() + std::string(" is not supported.")); + #endif + + CubeMapTexture texture; + texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0, + CompressedBufferImage2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData, BufferUsage::StaticDraw}); + + MAGNUM_VERIFY_NO_ERROR(); + + #ifndef MAGNUM_TARGET_GLES + CompressedBufferImage2D image = texture.compressedImage(CubeMapTexture::Coordinate::PositiveX, 0, + {}, BufferUsage::StaticRead); + const auto imageData = image.buffer().data(); + + MAGNUM_VERIFY_NO_ERROR(); + + CORRADE_COMPARE(image.size(), Vector2i{4}); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{CompressedData}, TestSuite::Compare::Container); + #endif +} +#endif + +#ifndef MAGNUM_TARGET_GLES +namespace { + constexpr UnsignedByte FullData[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, @@ -399,7 +508,7 @@ namespace { /* Just 4x4 0x00 - 0x3f compressed using RGBA DXT3 by the driver, repeated six times */ - constexpr UnsignedByte CompressedDataFull[] = { + constexpr UnsignedByte CompressedFullData[] = { 0, 17, 17, 34, 34, 51, 51, 67, 232, 57, 0, 0, 213, 255, 170, 2, 0, 17, 17, 34, 34, 51, 51, 67, @@ -416,14 +525,13 @@ namespace { }; } -#ifndef MAGNUM_TARGET_GLES -void CubeMapTextureGLTest::imageFull() { +void CubeMapTextureGLTest::fullImageQuery() { if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::direct_state_access::string() + std::string(" is not supported.")); CubeMapTexture texture; texture.setStorage(1, TextureFormat::RGBA8, Vector2i{2, 2}) - .setSubImage(0, {}, ImageView3D{PixelFormat::RGBA, PixelType::UnsignedByte, {2, 2, 6}, DataFull}); + .setSubImage(0, {}, ImageView3D{PixelFormat::RGBA, PixelType::UnsignedByte, {2, 2, 6}, FullData}); MAGNUM_VERIFY_NO_ERROR(); @@ -434,10 +542,10 @@ void CubeMapTextureGLTest::imageFull() { CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6)); CORRADE_COMPARE_AS( Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayView{DataFull}, TestSuite::Compare::Container); + Containers::ArrayView{FullData}, TestSuite::Compare::Container); } -void CubeMapTextureGLTest::compressedImageFull() { +void CubeMapTextureGLTest::compressedFullImageQuery() { if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::direct_state_access::string() + std::string(" is not supported.")); if(!Context::current()->isExtensionSupported()) @@ -445,7 +553,7 @@ void CubeMapTextureGLTest::compressedImageFull() { CubeMapTexture texture; texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, Vector2i{4}) - .setCompressedSubImage(0, {}, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 6}, CompressedDataFull}); + .setCompressedSubImage(0, {}, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 6}, CompressedFullData}); MAGNUM_VERIFY_NO_ERROR(); @@ -456,16 +564,16 @@ void CubeMapTextureGLTest::compressedImageFull() { CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 6})); CORRADE_COMPARE_AS( Containers::ArrayView(image.data(), image.data().size()), - Containers::ArrayView{CompressedDataFull}, TestSuite::Compare::Container); + Containers::ArrayView{CompressedFullData}, TestSuite::Compare::Container); } -void CubeMapTextureGLTest::imageFullBuffer() { +void CubeMapTextureGLTest::fullImageQueryBuffer() { if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::direct_state_access::string() + std::string(" is not supported.")); CubeMapTexture texture; texture.setStorage(1, TextureFormat::RGBA8, Vector2i{2}) - .setSubImage(0, {}, BufferImage3D{PixelFormat::RGBA, PixelType::UnsignedByte, {2, 2, 6}, DataFull, BufferUsage::StaticDraw}); + .setSubImage(0, {}, BufferImage3D{PixelFormat::RGBA, PixelType::UnsignedByte, {2, 2, 6}, FullData, BufferUsage::StaticDraw}); MAGNUM_VERIFY_NO_ERROR(); @@ -475,10 +583,10 @@ void CubeMapTextureGLTest::imageFullBuffer() { CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6)); const auto imageData = image.buffer().data(); - CORRADE_COMPARE_AS(imageData, Containers::ArrayView{DataFull}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{FullData}, TestSuite::Compare::Container); } -void CubeMapTextureGLTest::compressedImageFullBuffer() { +void CubeMapTextureGLTest::compressedFullImageQueryBuffer() { if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::direct_state_access::string() + std::string(" is not supported.")); if(!Context::current()->isExtensionSupported()) @@ -486,7 +594,7 @@ void CubeMapTextureGLTest::compressedImageFullBuffer() { CubeMapTexture texture; texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, Vector2i{4}) - .setCompressedSubImage(0, {}, CompressedBufferImage3D{CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 6}, CompressedDataFull, BufferUsage::StaticDraw}); + .setCompressedSubImage(0, {}, CompressedBufferImage3D{CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 6}, CompressedFullData, BufferUsage::StaticDraw}); MAGNUM_VERIFY_NO_ERROR(); @@ -496,115 +604,7 @@ void CubeMapTextureGLTest::compressedImageFullBuffer() { CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 6})); const auto imageData = image.buffer().data(); - CORRADE_COMPARE_AS(imageData, Containers::ArrayView{CompressedDataFull}, TestSuite::Compare::Container); -} -#endif - -namespace { - constexpr UnsignedByte Data[] = { 0x00, 0x01, 0x02, 0x03, - 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, - 0x0c, 0x0d, 0x0e, 0x0f }; - - /* Just 4x4 0x00 - 0x3f compressed using RGBA DXT3 by the driver */ - constexpr UnsignedByte CompressedData[] = { - 0, 17, 17, 34, 34, 51, 51, 67, - 232, 57, 0, 0, 213, 255, 170, 2 - }; -} - -void CubeMapTextureGLTest::image() { - CubeMapTexture texture; - texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8, - ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data)); - - MAGNUM_VERIFY_NO_ERROR(); - - /** @todo How to test this on ES? */ - #ifndef MAGNUM_TARGET_GLES - Image2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte}); - - MAGNUM_VERIFY_NO_ERROR(); - - CORRADE_COMPARE(image.size(), Vector2i(2)); - CORRADE_COMPARE_AS( - Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayView{Data}, TestSuite::Compare::Container); - #endif -} - -void CubeMapTextureGLTest::compressedImage() { - #ifndef MAGNUM_TARGET_WEBGL - if(!Context::current()->isExtensionSupported()) - CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported.")); - #else - if(!Context::current()->isExtensionSupported()) - CORRADE_SKIP(Extensions::GL::WEBGL::compressed_texture_s3tc::string() + std::string(" is not supported.")); - #endif - - CubeMapTexture texture; - texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0, - CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData}); - - MAGNUM_VERIFY_NO_ERROR(); - - #ifndef MAGNUM_TARGET_GLES - CompressedImage2D image = texture.compressedImage(CubeMapTexture::Coordinate::PositiveX, 0, {}); - - MAGNUM_VERIFY_NO_ERROR(); - - CORRADE_COMPARE(image.size(), Vector2i{4}); - CORRADE_COMPARE_AS( - (Containers::ArrayView{image.data(), image.data().size()}), - Containers::ArrayView{CompressedData}, TestSuite::Compare::Container); - #endif -} - -#ifndef MAGNUM_TARGET_GLES2 -void CubeMapTextureGLTest::imageBuffer() { - CubeMapTexture texture; - texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8, - BufferImage2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Data, BufferUsage::StaticDraw)); - - MAGNUM_VERIFY_NO_ERROR(); - - /** @todo How to test this on ES? */ - #ifndef MAGNUM_TARGET_GLES - BufferImage2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead); - const auto imageData = image.buffer().data(); - - MAGNUM_VERIFY_NO_ERROR(); - - CORRADE_COMPARE(image.size(), Vector2i(2)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data}, TestSuite::Compare::Container); - #endif -} - -void CubeMapTextureGLTest::compressedImageBuffer() { - #ifndef MAGNUM_TARGET_WEBGL - if(!Context::current()->isExtensionSupported()) - CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported.")); - #else - if(!Context::current()->isExtensionSupported()) - CORRADE_SKIP(Extensions::GL::WEBGL::compressed_texture_s3tc::string() + std::string(" is not supported.")); - #endif - - CubeMapTexture texture; - texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0, - CompressedBufferImage2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData, BufferUsage::StaticDraw}); - - MAGNUM_VERIFY_NO_ERROR(); - - #ifndef MAGNUM_TARGET_GLES - CompressedBufferImage2D image = texture.compressedImage(CubeMapTexture::Coordinate::PositiveX, 0, - {}, BufferUsage::StaticRead); - const auto imageData = image.buffer().data(); - - MAGNUM_VERIFY_NO_ERROR(); - - CORRADE_COMPARE(image.size(), Vector2i{4}); - CORRADE_COMPARE_AS(imageData, Containers::ArrayView{CompressedData}, TestSuite::Compare::Container); - #endif + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{CompressedFullData}, TestSuite::Compare::Container); } #endif