From 214dd5dbadf4bba8884e2cafed1eced838cda977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 25 Jan 2025 19:01:48 +0100 Subject: [PATCH] GL: fix compressed Texture3D subimage upload test. Not sure what was happening here, but my suspicion is that I took what NVidia did with BPTC when used in 3D textures as the correct thing, and then tried to shape the test around that. Or something. Basically, instead of the blocks being 4x4x1 as the format says, the test overwrote the pixel storage parameters to be four times larger 4x4x4 blocks, and then went with that, trying to shape the other test variants to match that as well. And failing really bad, because it failed on Mesa, and the only case where where it matched the (wrong) expectation was on NVidia and only when the custom (wrong) pixel storage was used. --- src/Magnum/GL/Test/TextureGLTest.cpp | 55 ++++++++-------------------- 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/src/Magnum/GL/Test/TextureGLTest.cpp b/src/Magnum/GL/Test/TextureGLTest.cpp index e16751044..0179ae5e0 100644 --- a/src/Magnum/GL/Test/TextureGLTest.cpp +++ b/src/Magnum/GL/Test/TextureGLTest.cpp @@ -447,8 +447,8 @@ const struct { {"skip Z", Containers::arrayView(CompressedData3D).exceptPrefix(16*4), CompressedPixelStorage{} - .setCompressedBlockSize({4, 4, 4}) - .setCompressedBlockDataSize(16*4) + .setCompressedBlockSize({4, 4, 1}) + .setCompressedBlockDataSize(16) .setSkip({0, 0, 4}), Containers::arrayView(CompressedData3D), 16*4} #endif @@ -2725,8 +2725,6 @@ void TextureGLTest::compressedImage3D() { CORRADE_COMPARE(image.flags(), ImageFlags3D{}); CORRADE_COMPARE(image.size(), Vector3i{4}); { - CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && data.storage != CompressedPixelStorage{}, - "Mesa drivers can't handle non-default compressed 3D pixel storage."); CORRADE_COMPARE_AS(Containers::arrayCast(image.data()).exceptPrefix(data.offset), data.data, TestSuite::Compare::Container); @@ -2768,8 +2766,6 @@ void TextureGLTest::compressedImage3DBuffer() { CORRADE_COMPARE(image.size(), Vector3i{4}); { - CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && data.storage != CompressedPixelStorage{}, - "Mesa drivers can't handle non-default compressed 3D pixel storage."); CORRADE_COMPARE_AS(Containers::arrayCast(imageData).exceptPrefix(data.offset), data.data, TestSuite::Compare::Container); @@ -2806,8 +2802,6 @@ void TextureGLTest::compressedImage3DQueryView() { CORRADE_COMPARE(image.flags(), ImageFlag3D::Array); CORRADE_COMPARE(image.size(), Vector3i{4}); { - CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa) && data.storage != CompressedPixelStorage{}, - "Mesa drivers can't handle non-default compressed 3D pixel storage."); CORRADE_COMPARE_AS(Containers::arrayCast(image.data()).exceptPrefix(data.offset), data.data, TestSuite::Compare::Container); @@ -2836,27 +2830,26 @@ constexpr UnsignedByte CompressedZero3D[3*4*16]{ #endif #ifndef MAGNUM_TARGET_GLES -/* Combination of CompressedZero3D and CompressedData3D. Note that, in - contrast to array textures, the data are ordered in "cubes" instead of - slices. */ +/* Combination of CompressedZero3D and CompressedData3D */ constexpr UnsignedByte CompressedSubData3DComplete[]{ 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 144, 224, 128, 3, 80, 0, 129, 170, 84, 253, 73, 36, 109, 100, 107, 255, + 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 144, 232, 161, 135, 94, 244, 129, 170, 84, 253, 65, 34, 109, 100, 107, 255, - 144, 240, 194, 11, 47, 248, 130, 170, - 84, 253, 65, 34, 109, 100, 107, 251, - 144, 247, 223, 143, 63, 252, 131, 170, - 84, 253, 73, 34, 109, 100, 91, 251, + 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 144, 240, 194, 11, 47, 248, 130, 170, + 84, 253, 65, 34, 109, 100, 107, 251, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 144, 247, 223, 143, 63, 252, 131, 170, + 84, 253, 73, 34, 109, 100, 91, 251, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; #endif @@ -2896,10 +2889,8 @@ void TextureGLTest::compressedSubImage3D() { CORRADE_COMPARE(image.size(), (Vector3i{12, 4, 4})); { - CORRADE_EXPECT_FAIL_IF(data.storage == CompressedPixelStorage{} && (Context::current().detectedDriver() & Context::DetectedDriver::NVidia), - "Default compressed pixel storage behaves weirdly with BPTC compression on NVidia."); - CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa), - "Mesa drivers can't handle compressed 3D pixel storage for subimages."); + CORRADE_EXPECT_FAIL_IF(data.storage != CompressedPixelStorage{} && (Context::current().detectedDriver() & Context::DetectedDriver::NVidia), + "Compressed 3D pixel storage behaves weirdly with BPTC compression on NVidia."); CORRADE_COMPARE_AS(Containers::arrayCast(image.data()), Containers::arrayView(CompressedSubData3DComplete), TestSuite::Compare::Container); @@ -2942,10 +2933,8 @@ void TextureGLTest::compressedSubImage3DBuffer() { CORRADE_COMPARE(image.size(), (Vector3i{12, 4, 4})); { - CORRADE_EXPECT_FAIL_IF(data.storage == CompressedPixelStorage{} && (Context::current().detectedDriver() & Context::DetectedDriver::NVidia), - "Default compressed pixel storage behaves weirdly with BPTC compression on NVidia."); - CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa), - "Mesa drivers can't handle compressed 3D pixel storage for subimages."); + CORRADE_EXPECT_FAIL_IF(data.storage != CompressedPixelStorage{} && (Context::current().detectedDriver() & Context::DetectedDriver::NVidia), + "Compressed 3D pixel storage behaves weirdly with BPTC compression on NVidia."); CORRADE_COMPARE_AS(Containers::arrayCast(imageData), Containers::arrayView(CompressedSubData3DComplete), TestSuite::Compare::Container); @@ -2983,10 +2972,6 @@ void TextureGLTest::compressedSubImage3DQuery() { CORRADE_COMPARE(image.size(), (Vector3i{4})); { - CORRADE_EXPECT_FAIL_IF(data.storage == CompressedPixelStorage{} && (Context::current().detectedDriver() & Context::DetectedDriver::NVidia), - "Default compressed pixel storage behaves weirdly with BPTC compression on NVidia."); - CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa), - "Mesa drivers can't handle compressed 3D pixel storage for subimages."); CORRADE_COMPARE_AS(Containers::arrayCast(image.data()).exceptPrefix(data.offset), data.data, TestSuite::Compare::Container); @@ -3023,10 +3008,6 @@ void TextureGLTest::compressedSubImage3DQueryView() { CORRADE_COMPARE(image.size(), (Vector3i{4})); { - CORRADE_EXPECT_FAIL_IF(data.storage == CompressedPixelStorage{} && (Context::current().detectedDriver() & Context::DetectedDriver::NVidia), - "Default compressed pixel storage behaves weirdly with BPTC compression on NVidia."); - CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa), - "Mesa drivers can't handle compressed 3D pixel storage for subimages."); CORRADE_COMPARE_AS(Containers::arrayCast(image.data()).exceptPrefix(data.offset), data.data, TestSuite::Compare::Container); @@ -3061,10 +3042,6 @@ void TextureGLTest::compressedSubImage3DQueryBuffer() { CORRADE_COMPARE(image.size(), Vector3i{4}); { - CORRADE_EXPECT_FAIL_IF(data.storage == CompressedPixelStorage{} && (Context::current().detectedDriver() & Context::DetectedDriver::NVidia), - "Default compressed pixel storage behaves weirdly with BPTC compression on NVidia."); - CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa), - "Mesa drivers can't handle compressed 3D pixel storage for subimages."); CORRADE_COMPARE_AS(Containers::arrayCast(imageData).exceptPrefix(data.offset), data.data, TestSuite::Compare::Container);