From 595421da16080ee7019bd0651359f145b2c65077 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 12 Apr 2021 11:12:34 +0200 Subject: [PATCH] GL: rename & reorganize cubemap internals and test cases for clarity. The 3D subimage setters/queries will get enabled on all platforms now, and naming them "full" just doesn't make sense. --- src/Magnum/GL/CubeMapTexture.cpp | 12 +- src/Magnum/GL/Implementation/TextureState.cpp | 13 +- src/Magnum/GL/Implementation/TextureState.h | 4 +- src/Magnum/GL/Test/CubeMapTextureGLTest.cpp | 214 +++++++++--------- 4 files changed, 121 insertions(+), 122 deletions(-) diff --git a/src/Magnum/GL/CubeMapTexture.cpp b/src/Magnum/GL/CubeMapTexture.cpp index f92e634a5..9651f4ba0 100644 --- a/src/Magnum/GL/CubeMapTexture.cpp +++ b/src/Magnum/GL/CubeMapTexture.cpp @@ -76,7 +76,7 @@ void CubeMapTexture::image(const Int level, Image3D& image) { Buffer::unbindInternal(Buffer::TargetHint::PixelPack); Context::current().state().renderer.applyPixelStoragePack(image.storage()); - (this->*Context::current().state().texture.getFullCubeImageImplementation)(level, size, pixelFormat(image.format()), pixelType(image.format(), image.formatExtra()), data.size(), data, image.storage()); + (this->*Context::current().state().texture.getCubeImage3DImplementation)(level, size, pixelFormat(image.format()), pixelType(image.format(), image.formatExtra()), data.size(), data, image.storage()); image = Image3D{image.storage(), image.format(), image.formatExtra(), image.pixelSize(), size, std::move(data)}; } @@ -94,7 +94,7 @@ void CubeMapTexture::image(const Int level, const MutableImageView3D& image) { Buffer::unbindInternal(Buffer::TargetHint::PixelPack); Context::current().state().renderer.applyPixelStoragePack(image.storage()); - (this->*Context::current().state().texture.getFullCubeImageImplementation)(level, size, pixelFormat(image.format()), pixelType(image.format(), image.formatExtra()), image.data().size(), image.data(), image.storage()); + (this->*Context::current().state().texture.getCubeImage3DImplementation)(level, size, pixelFormat(image.format()), pixelType(image.format(), image.formatExtra()), image.data().size(), image.data(), image.storage()); } void CubeMapTexture::image(const Int level, BufferImage3D& image, const BufferUsage usage) { @@ -111,7 +111,7 @@ void CubeMapTexture::image(const Int level, BufferImage3D& image, const BufferUs image.buffer().bindInternal(Buffer::TargetHint::PixelPack); Context::current().state().renderer.applyPixelStoragePack(image.storage()); - (this->*Context::current().state().texture.getFullCubeImageImplementation)(level, size, image.format(), image.type(), dataSize, nullptr, image.storage()); + (this->*Context::current().state().texture.getCubeImage3DImplementation)(level, size, image.format(), image.type(), dataSize, nullptr, image.storage()); } BufferImage3D CubeMapTexture::image(const Int level, BufferImage3D&& image, const BufferUsage usage) { @@ -147,7 +147,7 @@ void CubeMapTexture::compressedImage(const Int level, CompressedImage3D& image) Buffer::unbindInternal(Buffer::TargetHint::PixelPack); Context::current().state().renderer.applyPixelStoragePack(image.storage()); - (this->*Context::current().state().texture.getFullCompressedCubeImageImplementation)(level, size.xy(), dataOffsetSize.first, dataOffsetSize.second, data); + (this->*Context::current().state().texture.getCompressedCubeImage3DImplementation)(level, size.xy(), dataOffsetSize.first, dataOffsetSize.second, data); image = CompressedImage3D{image.storage(), CompressedPixelFormat(format), size, std::move(data)}; } @@ -190,7 +190,7 @@ void CubeMapTexture::compressedImage(const Int level, const MutableCompressedIma Buffer::unbindInternal(Buffer::TargetHint::PixelPack); Context::current().state().renderer.applyPixelStoragePack(image.storage()); - (this->*Context::current().state().texture.getFullCompressedCubeImageImplementation)(level, size.xy(), dataOffsetSize.first, dataOffsetSize.second, image.data()); + (this->*Context::current().state().texture.getCompressedCubeImage3DImplementation)(level, size.xy(), dataOffsetSize.first, dataOffsetSize.second, image.data()); } void CubeMapTexture::compressedImage(const Int level, CompressedBufferImage3D& image, const BufferUsage usage) { @@ -222,7 +222,7 @@ void CubeMapTexture::compressedImage(const Int level, CompressedBufferImage3D& i image.buffer().bindInternal(Buffer::TargetHint::PixelPack); Context::current().state().renderer.applyPixelStoragePack(image.storage()); - (this->*Context::current().state().texture.getFullCompressedCubeImageImplementation)(level, size.xy(), dataOffsetSize.first, dataOffsetSize.second, nullptr); + (this->*Context::current().state().texture.getCompressedCubeImage3DImplementation)(level, size.xy(), dataOffsetSize.first, dataOffsetSize.second, nullptr); } CompressedBufferImage3D CubeMapTexture::compressedImage(const Int level, CompressedBufferImage3D&& image, const BufferUsage usage) { diff --git a/src/Magnum/GL/Implementation/TextureState.cpp b/src/Magnum/GL/Implementation/TextureState.cpp index 4a61fa103..374ba2ff7 100644 --- a/src/Magnum/GL/Implementation/TextureState.cpp +++ b/src/Magnum/GL/Implementation/TextureState.cpp @@ -326,14 +326,14 @@ TextureState::TextureState(Context& context, getCompressedCubeImageImplementation = &CubeMapTexture::getCompressedImageImplementationDefault; } - /* Full compressed cubemap image query implementation (extensions added + /* 3D compressed cubemap image query implementation (extensions added above) */ if((context.detectedDriver() & Context::DetectedDriver::NVidia) && context.isExtensionSupported() && !context.isDriverWorkaroundDisabled("nv-cubemap-broken-full-compressed-image-query"_s)) - getFullCompressedCubeImageImplementation = &CubeMapTexture::getCompressedImageImplementationDSASingleSliceWorkaround; + getCompressedCubeImage3DImplementation = &CubeMapTexture::getCompressedImageImplementationDSASingleSliceWorkaround; else - getFullCompressedCubeImageImplementation = &CubeMapTexture::getCompressedImageImplementationDSA; + getCompressedCubeImage3DImplementation = &CubeMapTexture::getCompressedImageImplementationDSA; #ifdef CORRADE_TARGET_WINDOWS /** @todo those *might* be happening with the proprietary AMD driver on @@ -341,15 +341,14 @@ TextureState::TextureState(Context& context, if((context.detectedDriver() & Context::DetectedDriver::Amd) && context.isExtensionSupported() && !context.isDriverWorkaroundDisabled("amd-windows-cubemap-image3d-slice-by-slice"_s)) - getFullCubeImageImplementation = &CubeMapTexture::getImageImplementationDSAAmdSliceBySlice; + getCubeImage3DImplementation = &CubeMapTexture::getImageImplementationDSAAmdSliceBySlice; else if((context.detectedDriver() & Context::DetectedDriver::IntelWindows) && context.isExtensionSupported() && !context.isDriverWorkaroundDisabled("intel-windows-broken-dsa-for-cubemaps"_s)) - getFullCubeImageImplementation = &CubeMapTexture::getImageImplementationSliceBySlice; + getCubeImage3DImplementation = &CubeMapTexture::getImageImplementationSliceBySlice; else #endif - { - getFullCubeImageImplementation = &CubeMapTexture::getImageImplementationDSA; + getCubeImage3DImplementation = &CubeMapTexture::getImageImplementationSliceBySlice; } #endif diff --git a/src/Magnum/GL/Implementation/TextureState.h b/src/Magnum/GL/Implementation/TextureState.h index fcb22b91e..a0477a93f 100644 --- a/src/Magnum/GL/Implementation/TextureState.h +++ b/src/Magnum/GL/Implementation/TextureState.h @@ -122,8 +122,8 @@ struct TextureState { #ifndef MAGNUM_TARGET_GLES GLint(CubeMapTexture::*getCubeLevelCompressedImageSizeImplementation)(GLint); void(CubeMapTexture::*getCubeImageImplementation)(CubeMapCoordinate, GLint, const Vector2i&, PixelFormat, PixelType, std::size_t, GLvoid*); - void(CubeMapTexture::*getFullCubeImageImplementation)(GLint, const Vector3i&, PixelFormat, PixelType, std::size_t, GLvoid*, const PixelStorage&); - void(CubeMapTexture::*getFullCompressedCubeImageImplementation)(GLint, const Vector2i&, std::size_t, std::size_t, GLvoid*); + void(CubeMapTexture::*getCubeImage3DImplementation)(GLint, const Vector3i&, PixelFormat, PixelType, std::size_t, GLvoid*, const PixelStorage&); + void(CubeMapTexture::*getCompressedCubeImage3DImplementation)(GLint, const Vector2i&, std::size_t, std::size_t, GLvoid*); void(CubeMapTexture::*getCompressedCubeImageImplementation)(CubeMapCoordinate, GLint, const Vector2i&, std::size_t, GLvoid*); void(CubeMapTexture::*cubeSubImage3DImplementation)(GLint, const Vector3i&, const Vector3i&, PixelFormat, PixelType, const GLvoid*, const PixelStorage&); #endif diff --git a/src/Magnum/GL/Test/CubeMapTextureGLTest.cpp b/src/Magnum/GL/Test/CubeMapTextureGLTest.cpp index 4d46d284b..41f78f076 100644 --- a/src/Magnum/GL/Test/CubeMapTextureGLTest.cpp +++ b/src/Magnum/GL/Test/CubeMapTextureGLTest.cpp @@ -129,19 +129,19 @@ struct CubeMapTextureGLTest: OpenGLTester { #endif #ifndef MAGNUM_TARGET_GLES - void fullImageQuery(); - void fullImageQueryView(); - void fullImageQueryViewNullptr(); - void fullImageQueryViewBadSize(); - void fullImageQueryBuffer(); + void image3D(); + void image3DBuffer(); + void image3DQueryView(); + void image3DQueryViewNullptr(); + void image3DQueryViewBadSize(); - void compressedFullImageQuery(); - void compressedFullImageQueryView(); - void compressedFullImageQueryViewNullptr(); - void compressedFullImageQueryViewBadSize(); - void compressedFullImageQueryViewBadDataSize(); - void compressedFullImageQueryViewBadFormat(); - void compressedFullImageQueryBuffer(); + void compressedImage3D(); + void compressedImage3DBuffer(); + void compressedImage3DQueryView(); + void compressedImage3DQueryViewNullptr(); + void compressedImage3DQueryViewBadSize(); + void compressedImage3DQueryViewBadDataSize(); + void compressedImage3DQueryViewBadFormat(); #endif void generateMipmap(); @@ -350,13 +350,13 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() { #ifndef MAGNUM_TARGET_GLES addInstancedTests({ - &CubeMapTextureGLTest::fullImageQuery, - &CubeMapTextureGLTest::fullImageQueryView, - &CubeMapTextureGLTest::fullImageQueryBuffer}, + &CubeMapTextureGLTest::image3D, + &CubeMapTextureGLTest::image3DBuffer, + &CubeMapTextureGLTest::image3DQueryView}, Containers::arraySize(FullPixelStorageData)); - addTests({&CubeMapTextureGLTest::fullImageQueryViewNullptr, - &CubeMapTextureGLTest::fullImageQueryViewBadSize}); + addTests({&CubeMapTextureGLTest::image3DQueryViewNullptr, + &CubeMapTextureGLTest::image3DQueryViewBadSize}); #endif addInstancedTests({ @@ -391,15 +391,15 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() { &CubeMapTextureGLTest::compressedImageQueryViewBadFormat}); addInstancedTests({ - &CubeMapTextureGLTest::compressedFullImageQuery, - &CubeMapTextureGLTest::compressedFullImageQueryView, - &CubeMapTextureGLTest::compressedFullImageQueryBuffer}, + &CubeMapTextureGLTest::compressedImage3D, + &CubeMapTextureGLTest::compressedImage3DBuffer, + &CubeMapTextureGLTest::compressedImage3DQueryView}, Containers::arraySize(CompressedFullPixelStorageData)); - addTests({&CubeMapTextureGLTest::compressedFullImageQueryViewNullptr, - &CubeMapTextureGLTest::compressedFullImageQueryViewBadSize, - &CubeMapTextureGLTest::compressedFullImageQueryViewBadDataSize, - &CubeMapTextureGLTest::compressedFullImageQueryViewBadFormat}); + addTests({&CubeMapTextureGLTest::compressedImage3DQueryViewNullptr, + &CubeMapTextureGLTest::compressedImage3DQueryViewBadSize, + &CubeMapTextureGLTest::compressedImage3DQueryViewBadDataSize, + &CubeMapTextureGLTest::compressedImage3DQueryViewBadFormat}); #endif addInstancedTests({ @@ -1736,7 +1736,7 @@ void CubeMapTextureGLTest::compressedSubImageQueryBuffer() { #endif #ifndef MAGNUM_TARGET_GLES -void CubeMapTextureGLTest::fullImageQuery() { +void CubeMapTextureGLTest::image3D() { setTestCaseDescription(FullPixelStorageData[testCaseInstanceId()].name); if(!Context::current().isExtensionSupported()) @@ -1765,7 +1765,38 @@ void CubeMapTextureGLTest::fullImageQuery() { } } -void CubeMapTextureGLTest::fullImageQueryView() { +void CubeMapTextureGLTest::image3DBuffer() { + setTestCaseDescription(FullPixelStorageData[testCaseInstanceId()].name); + + if(!Context::current().isExtensionSupported()) + CORRADE_SKIP(Extensions::ARB::direct_state_access::string() << "is not supported."); + + CubeMapTexture texture; + texture.setStorage(1, TextureFormat::RGBA8, Vector2i{2}) + .setSubImage(0, {}, BufferImage3D{ + PixelFormat::RGBA, PixelType::UnsignedByte, {2, 2, 6}, + FullPixelStorageData[testCaseInstanceId()].data, + BufferUsage::StaticDraw}); + + MAGNUM_VERIFY_NO_GL_ERROR(); + + BufferImage3D image = texture.image(0, + {FullPixelStorageData[testCaseInstanceId()].storage, PixelFormat::RGBA, + PixelType::UnsignedByte}, BufferUsage::StaticRead); + + MAGNUM_VERIFY_NO_GL_ERROR(); + + CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6)); + const auto imageData = image.buffer().data(); + { + CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && FullPixelStorageData[testCaseInstanceId()].storage != PixelStorage{}, + "Mesa drivers can't handle non-default pixel storage for full cubemap image queries."); + CORRADE_COMPARE_AS(Containers::arrayCast(imageData).suffix(FullPixelStorageData[testCaseInstanceId()].offset), + FullPixelStorageData[testCaseInstanceId()].data, TestSuite::Compare::Container); + } +} + +void CubeMapTextureGLTest::image3DQueryView() { setTestCaseDescription(FullPixelStorageData[testCaseInstanceId()].name); if(!Context::current().isExtensionSupported()) @@ -1795,7 +1826,7 @@ void CubeMapTextureGLTest::fullImageQueryView() { } } -void CubeMapTextureGLTest::fullImageQueryViewNullptr() { +void CubeMapTextureGLTest::image3DQueryViewNullptr() { #ifdef CORRADE_NO_ASSERT CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); #endif @@ -1814,7 +1845,7 @@ void CubeMapTextureGLTest::fullImageQueryViewNullptr() { CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::image(): image view is nullptr\n"); } -void CubeMapTextureGLTest::fullImageQueryViewBadSize() { +void CubeMapTextureGLTest::image3DQueryViewBadSize() { #ifdef CORRADE_NO_ASSERT CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); #endif @@ -1834,38 +1865,57 @@ void CubeMapTextureGLTest::fullImageQueryViewBadSize() { CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::image(): expected image view size Vector(2, 2, 6) but got Vector(2, 1, 6)\n"); } -void CubeMapTextureGLTest::fullImageQueryBuffer() { - setTestCaseDescription(FullPixelStorageData[testCaseInstanceId()].name); +void CubeMapTextureGLTest::compressedImage3D() { + setTestCaseDescription(CompressedFullPixelStorageData[testCaseInstanceId()].name); if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::ARB::direct_state_access::string() << "is not supported."); + if(!Context::current().isExtensionSupported()) + CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() << "is not supported."); + if(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported()) + CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() << "is not supported."); CubeMapTexture texture; - texture.setStorage(1, TextureFormat::RGBA8, Vector2i{2}) - .setSubImage(0, {}, BufferImage3D{ - PixelFormat::RGBA, PixelType::UnsignedByte, {2, 2, 6}, - FullPixelStorageData[testCaseInstanceId()].data, - BufferUsage::StaticDraw}); + texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, Vector2i{4}) + .setCompressedSubImage(0, {}, CompressedImageView3D{ + CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 6}, + CompressedFullPixelStorageData[testCaseInstanceId()].data}); - MAGNUM_VERIFY_NO_GL_ERROR(); + { + bool fails(Context::current().detectedDriver() & Context::DetectedDriver::Amd); + CORRADE_EXPECT_FAIL_IF(fails, + "ARB_DSA compressed cubemap APIs are broken on AMD drivers."); - BufferImage3D image = texture.image(0, - {FullPixelStorageData[testCaseInstanceId()].storage, PixelFormat::RGBA, - PixelType::UnsignedByte}, BufferUsage::StaticRead); + MAGNUM_VERIFY_NO_GL_ERROR(); + if(fails) CORRADE_SKIP("Skipping the rest of the test"); + } - MAGNUM_VERIFY_NO_GL_ERROR(); + CompressedImage3D image = texture.compressedImage(0, {CompressedFullPixelStorageData[testCaseInstanceId()].storage}); - CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6)); - const auto imageData = image.buffer().data(); { - CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && FullPixelStorageData[testCaseInstanceId()].storage != PixelStorage{}, + #ifdef CORRADE_TARGET_WINDOWS + bool fails(Context::current().detectedDriver() & Context::DetectedDriver::IntelWindows); + CORRADE_EXPECT_FAIL_IF(fails, + "ARB_DSA compressed cubemap APIs are broken on Intel Windows drivers."); + #endif + + MAGNUM_VERIFY_NO_GL_ERROR(); + #ifdef CORRADE_TARGET_WINDOWS + if(fails) CORRADE_SKIP("Skipping the rest of the test"); + #endif + } + + CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 6})); + { + CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && CompressedFullPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{}, "Mesa drivers can't handle non-default pixel storage for full cubemap image queries."); - CORRADE_COMPARE_AS(Containers::arrayCast(imageData).suffix(FullPixelStorageData[testCaseInstanceId()].offset), - FullPixelStorageData[testCaseInstanceId()].data, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(Containers::arrayCast(image.data()).suffix(CompressedFullPixelStorageData[testCaseInstanceId()].offset), + CompressedFullPixelStorageData[testCaseInstanceId()].data, + TestSuite::Compare::Container); } } -void CubeMapTextureGLTest::compressedFullImageQuery() { +void CubeMapTextureGLTest::compressedImage3DBuffer() { setTestCaseDescription(CompressedFullPixelStorageData[testCaseInstanceId()].name); if(!Context::current().isExtensionSupported()) @@ -1877,9 +1927,10 @@ void CubeMapTextureGLTest::compressedFullImageQuery() { CubeMapTexture texture; texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, Vector2i{4}) - .setCompressedSubImage(0, {}, CompressedImageView3D{ + .setCompressedSubImage(0, {}, CompressedBufferImage3D{ CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 6}, - CompressedFullPixelStorageData[testCaseInstanceId()].data}); + CompressedFullPixelStorageData[testCaseInstanceId()].data, + BufferUsage::StaticDraw}); { bool fails(Context::current().detectedDriver() & Context::DetectedDriver::Amd); @@ -1890,7 +1941,7 @@ void CubeMapTextureGLTest::compressedFullImageQuery() { if(fails) CORRADE_SKIP("Skipping the rest of the test"); } - CompressedImage3D image = texture.compressedImage(0, {CompressedFullPixelStorageData[testCaseInstanceId()].storage}); + CompressedBufferImage3D image = texture.compressedImage(0, {CompressedFullPixelStorageData[testCaseInstanceId()].storage}, BufferUsage::StaticRead); { #ifdef CORRADE_TARGET_WINDOWS @@ -1906,16 +1957,17 @@ void CubeMapTextureGLTest::compressedFullImageQuery() { } CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 6})); + const auto imageData = image.buffer().data(); { CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && CompressedFullPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{}, "Mesa drivers can't handle non-default pixel storage for full cubemap image queries."); - CORRADE_COMPARE_AS(Containers::arrayCast(image.data()).suffix(CompressedFullPixelStorageData[testCaseInstanceId()].offset), + CORRADE_COMPARE_AS(Containers::arrayCast(imageData).suffix(CompressedFullPixelStorageData[testCaseInstanceId()].offset), CompressedFullPixelStorageData[testCaseInstanceId()].data, TestSuite::Compare::Container); } } -void CubeMapTextureGLTest::compressedFullImageQueryView() { +void CubeMapTextureGLTest::compressedImage3DQueryView() { setTestCaseDescription(CompressedFullPixelStorageData[testCaseInstanceId()].name); if(!Context::current().isExtensionSupported()) @@ -1967,7 +2019,7 @@ void CubeMapTextureGLTest::compressedFullImageQueryView() { } } -void CubeMapTextureGLTest::compressedFullImageQueryViewNullptr() { +void CubeMapTextureGLTest::compressedImage3DQueryViewNullptr() { #ifdef CORRADE_NO_ASSERT CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); #endif @@ -1988,7 +2040,7 @@ void CubeMapTextureGLTest::compressedFullImageQueryViewNullptr() { CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::compressedImage(): image view is nullptr\n"); } -void CubeMapTextureGLTest::compressedFullImageQueryViewBadSize() { +void CubeMapTextureGLTest::compressedImage3DQueryViewBadSize() { #ifdef CORRADE_NO_ASSERT CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); #endif @@ -2010,7 +2062,7 @@ void CubeMapTextureGLTest::compressedFullImageQueryViewBadSize() { CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::compressedImage(): expected image view size Vector(4, 4, 6) but got Vector(4, 8, 6)\n"); } -void CubeMapTextureGLTest::compressedFullImageQueryViewBadDataSize() { +void CubeMapTextureGLTest::compressedImage3DQueryViewBadDataSize() { #ifdef CORRADE_NO_ASSERT CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); #endif @@ -2032,7 +2084,7 @@ void CubeMapTextureGLTest::compressedFullImageQueryViewBadDataSize() { CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::compressedImage(): expected image view data size 96 bytes but got 95\n"); } -void CubeMapTextureGLTest::compressedFullImageQueryViewBadFormat() { +void CubeMapTextureGLTest::compressedImage3DQueryViewBadFormat() { #ifdef CORRADE_NO_ASSERT CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions"); #endif @@ -2053,58 +2105,6 @@ void CubeMapTextureGLTest::compressedFullImageQueryViewBadFormat() { texture.compressedImage(0, image); CORRADE_COMPARE(out.str(), "GL::CubeMapTexture::compressedImage(): expected image view format GL::CompressedPixelFormat::RGBAS3tcDxt3 but got GL::CompressedPixelFormat::RGBAS3tcDxt1\n"); } - -void CubeMapTextureGLTest::compressedFullImageQueryBuffer() { - setTestCaseDescription(CompressedFullPixelStorageData[testCaseInstanceId()].name); - - if(!Context::current().isExtensionSupported()) - CORRADE_SKIP(Extensions::ARB::direct_state_access::string() << "is not supported."); - if(!Context::current().isExtensionSupported()) - CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() << "is not supported."); - if(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported()) - CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() << "is not supported."); - - CubeMapTexture texture; - texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, Vector2i{4}) - .setCompressedSubImage(0, {}, CompressedBufferImage3D{ - CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 6}, - CompressedFullPixelStorageData[testCaseInstanceId()].data, - BufferUsage::StaticDraw}); - - { - bool fails(Context::current().detectedDriver() & Context::DetectedDriver::Amd); - CORRADE_EXPECT_FAIL_IF(fails, - "ARB_DSA compressed cubemap APIs are broken on AMD drivers."); - - MAGNUM_VERIFY_NO_GL_ERROR(); - if(fails) CORRADE_SKIP("Skipping the rest of the test"); - } - - CompressedBufferImage3D image = texture.compressedImage(0, {CompressedFullPixelStorageData[testCaseInstanceId()].storage}, BufferUsage::StaticRead); - - { - #ifdef CORRADE_TARGET_WINDOWS - bool fails(Context::current().detectedDriver() & Context::DetectedDriver::IntelWindows); - CORRADE_EXPECT_FAIL_IF(fails, - "ARB_DSA compressed cubemap APIs are broken on Intel Windows drivers."); - #endif - - MAGNUM_VERIFY_NO_GL_ERROR(); - #ifdef CORRADE_TARGET_WINDOWS - if(fails) CORRADE_SKIP("Skipping the rest of the test"); - #endif - } - - CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 6})); - const auto imageData = image.buffer().data(); - { - CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && CompressedFullPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{}, - "Mesa drivers can't handle non-default pixel storage for full cubemap image queries."); - CORRADE_COMPARE_AS(Containers::arrayCast(imageData).suffix(CompressedFullPixelStorageData[testCaseInstanceId()].offset), - CompressedFullPixelStorageData[testCaseInstanceId()].data, - TestSuite::Compare::Container); - } -} #endif void CubeMapTextureGLTest::generateMipmap() {