From c32523e641a5b9fbb5245c43dff917e1d9d6aa64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 1 Jan 2016 22:46:10 +0100 Subject: [PATCH] Ensure that the cube map is complete for compressed image query tests. I'm experiencing weird inconsistencies when querying GL_TEXTURE_COMPRESSED_IMAGE_SIZE on cube map textures, it seems to depend on whether the texture is complete/immutable or not, this is a first part of an attempt to nail it down. --- src/Magnum/Test/CubeMapTextureGLTest.cpp | 26 ++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/Magnum/Test/CubeMapTextureGLTest.cpp b/src/Magnum/Test/CubeMapTextureGLTest.cpp index 1e9fbb0e6..0c4de0409 100644 --- a/src/Magnum/Test/CubeMapTextureGLTest.cpp +++ b/src/Magnum/Test/CubeMapTextureGLTest.cpp @@ -460,12 +460,19 @@ void CubeMapTextureGLTest::compressedImage() { CORRADE_SKIP(Extensions::GL::WEBGL::compressed_texture_s3tc::string() + std::string(" is not supported.")); #endif - CubeMapTexture texture; - texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0, CompressedImageView2D{ + const CompressedImageView2D view{ #ifndef MAGNUM_TARGET_GLES _compressedDataStorage, #endif - CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, unsafeSuffix(CompressedData, _compressedDataOffset)}); + CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, unsafeSuffix(CompressedData, _compressedDataOffset)}; + + CubeMapTexture texture; + texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0, view) + .setCompressedImage(CubeMapTexture::Coordinate::NegativeX, 0, view) + .setCompressedImage(CubeMapTexture::Coordinate::PositiveY, 0, view) + .setCompressedImage(CubeMapTexture::Coordinate::NegativeY, 0, view) + .setCompressedImage(CubeMapTexture::Coordinate::PositiveZ, 0, view) + .setCompressedImage(CubeMapTexture::Coordinate::NegativeZ, 0, view); MAGNUM_VERIFY_NO_ERROR(); @@ -512,12 +519,19 @@ void CubeMapTextureGLTest::compressedImageBuffer() { CORRADE_SKIP(Extensions::GL::WEBGL::compressed_texture_s3tc::string() + std::string(" is not supported.")); #endif - CubeMapTexture texture; - texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0, CompressedBufferImage2D{ + CompressedBufferImage2D buffer{ #ifndef MAGNUM_TARGET_GLES _compressedDataStorage, #endif - CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, unsafeSuffix(CompressedData, _compressedDataOffset), BufferUsage::StaticDraw}); + CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, unsafeSuffix(CompressedData, _compressedDataOffset), BufferUsage::StaticDraw}; + + CubeMapTexture texture; + texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0, buffer) + .setCompressedImage(CubeMapTexture::Coordinate::NegativeX, 0, buffer) + .setCompressedImage(CubeMapTexture::Coordinate::PositiveY, 0, buffer) + .setCompressedImage(CubeMapTexture::Coordinate::NegativeY, 0, buffer) + .setCompressedImage(CubeMapTexture::Coordinate::PositiveZ, 0, buffer) + .setCompressedImage(CubeMapTexture::Coordinate::NegativeZ, 0, buffer); MAGNUM_VERIFY_NO_ERROR();