From 58ff5a2f7492cdaccb4d19326dc2f442bf2617b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 28 Apr 2018 13:10:58 +0200 Subject: [PATCH] Low-hanging fruit in CubeMapTextureGLTest and FramebufferGLTest on Mesa. It complains that the texture is cubemap incomplete when calling image(). --- src/Magnum/Test/CubeMapTextureGLTest.cpp | 40 ++++++++++++++++++------ src/Magnum/Test/FramebufferGLTest.cpp | 15 +++++++++ 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/src/Magnum/Test/CubeMapTextureGLTest.cpp b/src/Magnum/Test/CubeMapTextureGLTest.cpp index a67977ebd..a16a8ae01 100644 --- a/src/Magnum/Test/CubeMapTextureGLTest.cpp +++ b/src/Magnum/Test/CubeMapTextureGLTest.cpp @@ -616,6 +616,10 @@ void CubeMapTextureGLTest::storage() { #endif } +namespace { + constexpr UnsignedByte Zero[4*4*4]{}; +} + void CubeMapTextureGLTest::image() { setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name); @@ -629,16 +633,26 @@ void CubeMapTextureGLTest::image() { #endif #endif + #if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL)) + constexpr TextureFormat format = TextureFormat::RGBA8; + #else + constexpr TextureFormat format = TextureFormat::RGBA; + #endif + CubeMapTexture texture; - texture.setImage(CubeMapCoordinate::PositiveX, 0, - #if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL)) - TextureFormat::RGBA8, - #else - TextureFormat::RGBA, - #endif - ImageView2D{PixelStorageData[testCaseInstanceId()].storage, + texture.setImage(CubeMapCoordinate::PositiveX, 0, format, ImageView2D{PixelStorageData[testCaseInstanceId()].storage, PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), PixelStorageData[testCaseInstanceId()].dataSparse}); + texture.setImage(CubeMapCoordinate::NegativeX, 0, format, + ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero}); + texture.setImage(CubeMapCoordinate::PositiveY, 0, format, + ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero}); + texture.setImage(CubeMapCoordinate::NegativeY, 0, format, + ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero}); + texture.setImage(CubeMapCoordinate::PositiveZ, 0, format, + ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero}); + texture.setImage(CubeMapCoordinate::NegativeZ, 0, format, + ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero}); MAGNUM_VERIFY_NO_ERROR(); @@ -667,6 +681,16 @@ void CubeMapTextureGLTest::imageBuffer() { PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), PixelStorageData[testCaseInstanceId()].dataSparse, BufferUsage::StaticDraw}); + texture.setImage(CubeMapCoordinate::NegativeX, 0, TextureFormat::RGBA8, + ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero}); + texture.setImage(CubeMapCoordinate::PositiveY, 0, TextureFormat::RGBA8, + ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero}); + texture.setImage(CubeMapCoordinate::NegativeY, 0, TextureFormat::RGBA8, + ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero}); + texture.setImage(CubeMapCoordinate::PositiveZ, 0, TextureFormat::RGBA8, + ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero}); + texture.setImage(CubeMapCoordinate::NegativeZ, 0, TextureFormat::RGBA8, + ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero}); MAGNUM_VERIFY_NO_ERROR(); @@ -687,8 +711,6 @@ void CubeMapTextureGLTest::imageBuffer() { #endif namespace { - constexpr UnsignedByte Zero[4*4*4]{}; - #ifndef MAGNUM_TARGET_GLES constexpr UnsignedByte SubDataComplete[]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/src/Magnum/Test/FramebufferGLTest.cpp b/src/Magnum/Test/FramebufferGLTest.cpp index 38cd14e03..c8ac753ed 100644 --- a/src/Magnum/Test/FramebufferGLTest.cpp +++ b/src/Magnum/Test/FramebufferGLTest.cpp @@ -1680,7 +1680,22 @@ void FramebufferGLTest::copyImageCubeMapTexture() { Framebuffer fb{{{}, Vector2i{4}}}; fb.attachTexture(Framebuffer::ColorAttachment{0}, storage, 0); + constexpr UnsignedByte Zero[2*2*4]{}; + CubeMapTexture texture; + texture.setImage(CubeMapCoordinate::PositiveX, 0, TextureFormat::RGBA8, + ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero}); + texture.setImage(CubeMapCoordinate::NegativeX, 0, TextureFormat::RGBA8, + ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero}); + texture.setImage(CubeMapCoordinate::PositiveY, 0, TextureFormat::RGBA8, + ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero}); + texture.setImage(CubeMapCoordinate::NegativeY, 0, TextureFormat::RGBA8, + ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero}); + texture.setImage(CubeMapCoordinate::PositiveZ, 0, TextureFormat::RGBA8, + ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero}); + texture.setImage(CubeMapCoordinate::NegativeZ, 0, TextureFormat::RGBA8, + ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero}); + fb.copyImage(Range2Di::fromSize(Vector2i{1}, Vector2i{2}), texture, CubeMapCoordinate::PositiveX, 0, #ifndef MAGNUM_TARGET_GLES2 TextureFormat::RGBA8