From c0baad30a27cb67bfe64831dc6174b8a4633b16c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 6 Jul 2015 12:55:51 +0200 Subject: [PATCH] Implemented EXT_texture_cube_map_array AEP extension. --- doc/opengl-support.dox | 2 +- src/Magnum/CMakeLists.txt | 11 +- src/Magnum/CubeMapTextureArray.cpp | 9 +- src/Magnum/CubeMapTextureArray.h | 56 +++++++- src/Magnum/Magnum.h | 2 +- src/Magnum/Platform/magnum-info.cpp | 15 ++- src/Magnum/Test/CMakeLists.txt | 2 +- src/Magnum/Test/CubeMapTextureArrayGLTest.cpp | 127 ++++++++++++++++++ 8 files changed, 207 insertions(+), 17 deletions(-) diff --git a/doc/opengl-support.dox b/doc/opengl-support.dox index f4103630a..701510dac 100644 --- a/doc/opengl-support.dox +++ b/doc/opengl-support.dox @@ -368,7 +368,7 @@ Extension | Status @es_extension{EXT,tessellation_shader} | | @es_extension{EXT,texture_border_clamp} | done @es_extension{EXT,texture_buffer} | | -@es_extension{EXT,texture_cube_map_array} | | +@es_extension{EXT,texture_cube_map_array} | done @es_extension{EXT,primitive_bounding_box} | | @es_extension2{KHR,texture_compression_astc_ldr,texture_compression_astc_hdr} | | @es_extension2{KHR,texture_compression_astc_hdr,texture_compression_astc_hdr} | | diff --git a/src/Magnum/CMakeLists.txt b/src/Magnum/CMakeLists.txt index 7769904f2..ce6fabc0d 100644 --- a/src/Magnum/CMakeLists.txt +++ b/src/Magnum/CMakeLists.txt @@ -133,12 +133,10 @@ set(Magnum_PRIVATE_HEADERS if(NOT TARGET_GLES) list(APPEND Magnum_SRCS BufferTexture.cpp - CubeMapTextureArray.cpp RectangleTexture.cpp) list(APPEND Magnum_HEADERS BufferTexture.h - CubeMapTextureArray.h RectangleTexture.h) endif() @@ -176,9 +174,14 @@ if(NOT TARGET_WEBGL) list(APPEND Magnum_PRIVATE_HEADERS Implementation/DebugState.h) + # Desktop and OpenGL ES 3.0 stuff that is not available in ES2 and WebGL if(NOT TARGET_GLES2) - list(APPEND Magnum_SRCS MultisampleTexture.cpp) - list(APPEND Magnum_HEADERS MultisampleTexture.h) + list(APPEND Magnum_SRCS + CubeMapTextureArray.cpp + MultisampleTexture.cpp) + list(APPEND Magnum_HEADERS + CubeMapTextureArray.h + MultisampleTexture.h) endif() if(BUILD_DEPRECATED) diff --git a/src/Magnum/CubeMapTextureArray.cpp b/src/Magnum/CubeMapTextureArray.cpp index 22b5024cb..8ddda9de8 100644 --- a/src/Magnum/CubeMapTextureArray.cpp +++ b/src/Magnum/CubeMapTextureArray.cpp @@ -25,7 +25,7 @@ #include "CubeMapTextureArray.h" -#ifndef MAGNUM_TARGET_GLES +#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #include "Magnum/BufferImage.h" #include "Magnum/Context.h" #include "Magnum/Extensions.h" @@ -36,13 +36,19 @@ namespace Magnum { Vector3i CubeMapTextureArray::maxSize() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) return {}; + #else + if(!Context::current()->isExtensionSupported()) + return {}; + #endif return Vector3i{Vector2i{Implementation::maxCubeMapTextureSideSize()}, Implementation::maxTextureArrayLayers()}; } +#ifndef MAGNUM_TARGET_GLES Image3D CubeMapTextureArray::image(const Int level, Image3D&& image) { this->image(level, image); return std::move(image); @@ -62,6 +68,7 @@ BufferImage3D CubeMapTextureArray::subImage(const Int level, const Range3Di& ran this->subImage(level, range, image, usage); return std::move(image); } +#endif } #endif diff --git a/src/Magnum/CubeMapTextureArray.h b/src/Magnum/CubeMapTextureArray.h index 27116298e..dfbc88ae8 100644 --- a/src/Magnum/CubeMapTextureArray.h +++ b/src/Magnum/CubeMapTextureArray.h @@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE. */ -#ifndef MAGNUM_TARGET_GLES +#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) /** @file * @brief Class @ref Magnum::CubeMapTextureArray */ @@ -35,7 +35,7 @@ #include "Magnum/Array.h" #include "Magnum/Math/Vector3.h" -#ifndef MAGNUM_TARGET_GLES +#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) namespace Magnum { /** @@ -80,7 +80,10 @@ the six sides of the cube map, fourth part is layer in the array. See @ref Texture, @ref TextureArray, @ref RectangleTexture, @ref BufferTexture, @ref MultisampleTexture @requires_gl40 Extension @extension{ARB,texture_cube_map_array} -@requires_gl Cube map texture arrays are not available in OpenGL ES or WebGL. +@requires_gles30 Not defined in OpenGL ES 2.0. +@requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + @es_extension{EXT,texture_cube_map_array} +@requires_gles Cube map texture arrays are not available in WebGL. */ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { public: @@ -120,7 +123,12 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { * @fn_gl{CreateTextures} with @def_gl{TEXTURE_CUBE_MAP_ARRAY}, * eventually @fn_gl{GenTextures} */ - explicit CubeMapTextureArray(): AbstractTexture(GL_TEXTURE_CUBE_MAP_ARRAY) {} + explicit CubeMapTextureArray(): + #ifndef MAGNUM_TARGET_GLES + AbstractTexture{GL_TEXTURE_CUBE_MAP_ARRAY} {} + #else + AbstractTexture{GL_TEXTURE_CUBE_MAP_ARRAY_EXT} {} + #endif /** * @brief Construct without creating the underlying OpenGL object @@ -130,7 +138,12 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { * another object over it to make it useful. * @see @ref CubeMapTextureArray(), @ref wrap() */ - explicit CubeMapTextureArray(NoCreateT) noexcept: AbstractTexture{NoCreate, GL_TEXTURE_CUBE_MAP_ARRAY} {} + explicit CubeMapTextureArray(NoCreateT) noexcept: + #ifndef MAGNUM_TARGET_GLES + AbstractTexture{NoCreate, GL_TEXTURE_CUBE_MAP_ARRAY} {} + #else + AbstractTexture{NoCreate, GL_TEXTURE_CUBE_MAP_ARRAY_EXT} {} + #endif /** * @copybrief Texture::setBaseLevel() @@ -198,16 +211,20 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { return *this; } + #ifndef MAGNUM_TARGET_GLES /** * @copybrief Texture::setLodBias() * @return Reference to self (for method chaining) * * See @ref Texture::setLodBias() for more information. + * @requires_gl Texture LOD bias can be specified only directly in + * fragment shader in OpenGL ES. */ CubeMapTextureArray& setLodBias(Float bias) { AbstractTexture::setLodBias(bias); return *this; } + #endif /** * @copybrief Texture::setWrapping() @@ -226,6 +243,9 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { * * See @ref Texture::setBorderColor(const Color4&) for more * information. + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension{EXT,texture_border_clamp} or + * @es_extension{NV,texture_border_clamp} */ CubeMapTextureArray& setBorderColor(const Color4& color) { AbstractTexture::setBorderColor(color); @@ -239,6 +259,8 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { * See @ref Texture::setBorderColor(const Vector4ui&) for more * information. * @requires_gl30 Extension @extension{EXT,texture_integer} + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension{EXT,texture_border_clamp} */ CubeMapTextureArray& setBorderColor(const Vector4ui& color) { AbstractTexture::setBorderColor(color); @@ -247,6 +269,8 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { /** @overload * @requires_gl30 Extension @extension{EXT,texture_integer} + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension{EXT,texture_border_clamp} */ CubeMapTextureArray& setBorderColor(const Vector4i& color) { AbstractTexture::setBorderColor(color); @@ -270,6 +294,8 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { * * See @ref Texture::setSRGBDecode() for more information. * @requires_extension Extension @extension{EXT,texture_sRGB_decode} + * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/ + * @es_extension2{EXT,texture_sRGB_decode,texture_sRGB_decode} */ CubeMapTextureArray& setSRGBDecode(bool decode) { AbstractTexture::setSRGBDecode(decode); @@ -345,10 +371,13 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { return DataHelper<3>::imageSize(*this, level); } + #ifndef MAGNUM_TARGET_GLES /** * @copybrief Texture::image(Int, Image&) * * See @ref Texture::image(Int, Image&) for more information. + * @requires_gl Texture image queries are not available in OpenGL ES. + * See @ref Framebuffer::read() for possible workaround. */ void image(Int level, Image3D& image) { AbstractTexture::image<3>(level, image); @@ -368,6 +397,8 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { * * See @ref Texture::image(Int, BufferImage&, BufferUsage) for more * information. + * @requires_gl Texture image queries are not available in OpenGL ES. + * See @ref Framebuffer::read() for possible workaround. */ void image(Int level, BufferImage3D& image, BufferUsage usage) { AbstractTexture::image<3>(level, image, usage); @@ -388,6 +419,8 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { * See @ref Texture::subImage(Int, const RangeTypeFor&, Image&) * for more information. * @requires_gl45 Extension @extension{ARB,get_texture_sub_image} + * @requires_gl Texture image queries are not available in OpenGL ES. + * See @ref Framebuffer::read() for possible workaround. */ void subImage(Int level, const Range3Di& range, Image3D& image) { AbstractTexture::subImage<3>(level, range, image); @@ -408,6 +441,8 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { * See @ref Texture::subImage(Int, const RangeTypeFor&, BufferImage&, BufferUsage) * for more information. * @requires_gl45 Extension @extension{ARB,get_texture_sub_image} + * @requires_gl Texture image queries are not available in OpenGL ES. + * See @ref Framebuffer::read() for possible workaround. */ void subImage(Int level, const Range3Di& range, BufferImage3D& image, BufferUsage usage) { AbstractTexture::subImage<3>(level, range, image, usage); @@ -421,6 +456,7 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { * @endcode */ BufferImage3D subImage(Int level, const Range3Di& range, BufferImage3D&& image, BufferUsage usage); + #endif /** * @copybrief Texture::setImage() @@ -527,12 +563,18 @@ class MAGNUM_EXPORT CubeMapTextureArray: public AbstractTexture { #endif private: - explicit CubeMapTextureArray(GLuint id, ObjectFlags flags) noexcept: AbstractTexture{id, GL_TEXTURE_CUBE_MAP_ARRAY, flags} {} + explicit CubeMapTextureArray(GLuint id, ObjectFlags flags) noexcept: AbstractTexture{id, + #ifndef MAGNUM_TARGET_GLES + GL_TEXTURE_CUBE_MAP_ARRAY, + #else + GL_TEXTURE_CUBE_MAP_ARRAY_EXT, + #endif + flags} {} }; } #else -#error this header is not available in OpenGL ES build +#error this header is not available in OpenGL ES 2.0 and WebGL build #endif #endif diff --git a/src/Magnum/Magnum.h b/src/Magnum/Magnum.h index 79ae21062..f48d81271 100644 --- a/src/Magnum/Magnum.h +++ b/src/Magnum/Magnum.h @@ -459,7 +459,7 @@ enum class ColorType: GLenum; class Context; class CubeMapTexture; -#ifndef MAGNUM_TARGET_GLES +#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) class CubeMapTextureArray; #endif diff --git a/src/Magnum/Platform/magnum-info.cpp b/src/Magnum/Platform/magnum-info.cpp index 5cdf7ebc5..7cecf300f 100644 --- a/src/Magnum/Platform/magnum-info.cpp +++ b/src/Magnum/Platform/magnum-info.cpp @@ -35,7 +35,7 @@ #include "Magnum/BufferTexture.h" #endif #include "Magnum/Context.h" -#ifndef MAGNUM_TARGET_GLES +#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) #include "Magnum/CubeMapTextureArray.h" #endif #include "Magnum/DebugOutput.h" @@ -494,9 +494,20 @@ MagnumInfo::MagnumInfo(const Arguments& arguments): Platform::WindowlessApplicat _l(BufferTexture::offsetAlignment()) } + #endif - if(c->isExtensionSupported()) { + #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) + #ifndef MAGNUM_TARGET_GLES + if(c->isExtensionSupported()) + #else + if(c->isExtensionSupported()) + #endif + { + #ifndef MAGNUM_TARGET_GLES _h(ARB::texture_cube_map_array) + #else + _h(EXT::texture_cube_map_array) + #endif _l(CubeMapTextureArray::maxSize()) } diff --git a/src/Magnum/Test/CMakeLists.txt b/src/Magnum/Test/CMakeLists.txt index 60d0557b6..43eb3fa2c 100644 --- a/src/Magnum/Test/CMakeLists.txt +++ b/src/Magnum/Test/CMakeLists.txt @@ -75,6 +75,7 @@ if(BUILD_GL_TESTS) if(NOT MAGNUM_TARGET_GLES2) corrade_add_test(BufferImageGLTest BufferImageGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + corrade_add_test(CubeMapTextureArrayGLTest CubeMapTextureArrayGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(MultisampleTextureGLTest MultisampleTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(PrimitiveQueryGLTest PrimitiveQueryGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(TextureArrayGLTest TextureArrayGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) @@ -83,7 +84,6 @@ if(BUILD_GL_TESTS) if(NOT MAGNUM_TARGET_GLES) corrade_add_test(BufferTextureGLTest BufferTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) - corrade_add_test(CubeMapTextureArrayGLTest CubeMapTextureArrayGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(RectangleTextureGLTest RectangleTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) endif() endif() diff --git a/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp b/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp index 3282f056c..7be43da79 100644 --- a/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp +++ b/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp @@ -50,6 +50,9 @@ struct CubeMapTextureArrayGLTest: AbstractOpenGLTester { void samplingBorderInteger(); void samplingSwizzle(); void samplingDepthStencilMode(); + #ifdef MAGNUM_TARGET_GLES + void samplingBorder(); + #endif void storage(); @@ -57,8 +60,10 @@ struct CubeMapTextureArrayGLTest: AbstractOpenGLTester { void imageBuffer(); void subImage(); void subImageBuffer(); + #ifndef MAGNUM_TARGET_GLES void subImageQuery(); void subImageQueryBuffer(); + #endif void generateMipmap(); @@ -78,6 +83,9 @@ CubeMapTextureArrayGLTest::CubeMapTextureArrayGLTest() { &CubeMapTextureArrayGLTest::samplingBorderInteger, &CubeMapTextureArrayGLTest::samplingSwizzle, &CubeMapTextureArrayGLTest::samplingDepthStencilMode, + #ifdef MAGNUM_TARGET_GLES + &CubeMapTextureArrayGLTest::samplingBorder, + #endif &CubeMapTextureArrayGLTest::storage, @@ -85,8 +93,10 @@ CubeMapTextureArrayGLTest::CubeMapTextureArrayGLTest() { &CubeMapTextureArrayGLTest::imageBuffer, &CubeMapTextureArrayGLTest::subImage, &CubeMapTextureArrayGLTest::subImageBuffer, + #ifndef MAGNUM_TARGET_GLES &CubeMapTextureArrayGLTest::subImageQuery, &CubeMapTextureArrayGLTest::subImageQueryBuffer, + #endif &CubeMapTextureArrayGLTest::generateMipmap, @@ -95,8 +105,13 @@ CubeMapTextureArrayGLTest::CubeMapTextureArrayGLTest() { } void CubeMapTextureArrayGLTest::construct() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + #endif { CubeMapTextureArray texture; @@ -120,8 +135,13 @@ void CubeMapTextureArrayGLTest::constructNoCreate() { } void CubeMapTextureArrayGLTest::wrap() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + #endif GLuint id; glGenTextures(1, &id); @@ -138,8 +158,13 @@ void CubeMapTextureArrayGLTest::wrap() { } void CubeMapTextureArrayGLTest::bind() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + #endif CubeMapTextureArray texture; texture.bind(15); @@ -160,19 +185,30 @@ void CubeMapTextureArrayGLTest::bind() { } void CubeMapTextureArrayGLTest::sampling() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + #endif CubeMapTextureArray texture; texture.setMinificationFilter(Sampler::Filter::Linear, Sampler::Mipmap::Linear) .setMagnificationFilter(Sampler::Filter::Linear) .setMinLod(-750.0f) .setMaxLod(750.0f) + #ifndef MAGNUM_TARGET_GLES .setLodBias(0.5f) + #endif .setBaseLevel(1) .setMaxLevel(750) + #ifndef MAGNUM_TARGET_GLES .setWrapping(Sampler::Wrapping::ClampToBorder) .setBorderColor(Color3(0.5f)) + #else + .setWrapping(Sampler::Wrapping::ClampToEdge) + #endif .setMaxAnisotropy(Sampler::maxMaxAnisotropy()) .setCompareMode(Sampler::CompareMode::CompareRefToTexture) .setCompareFunction(Sampler::CompareFunction::GreaterOrEqual); @@ -181,8 +217,13 @@ void CubeMapTextureArrayGLTest::sampling() { } void CubeMapTextureArrayGLTest::samplingSRGBDecode() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + #endif if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::EXT::texture_sRGB_decode::string() + std::string(" is not supported.")); @@ -193,10 +234,17 @@ void CubeMapTextureArrayGLTest::samplingSRGBDecode() { } void CubeMapTextureArrayGLTest::samplingBorderInteger() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::EXT::texture_integer::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_border_clamp::string() + std::string(" is not supported.")); + #endif CubeMapTextureArray a; a.setWrapping(Sampler::Wrapping::ClampToBorder) @@ -209,10 +257,15 @@ void CubeMapTextureArrayGLTest::samplingBorderInteger() { } void CubeMapTextureArrayGLTest::samplingSwizzle() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_swizzle::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + #endif CubeMapTextureArray texture; texture.setSwizzle<'b', 'g', 'r', '0'>(); @@ -221,10 +274,15 @@ void CubeMapTextureArrayGLTest::samplingSwizzle() { } void CubeMapTextureArrayGLTest::samplingDepthStencilMode() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::stencil_texturing::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + #endif CubeMapTextureArray texture; texture.setDepthStencilMode(Sampler::DepthStencilMode::StencilIndex); @@ -232,9 +290,29 @@ void CubeMapTextureArrayGLTest::samplingDepthStencilMode() { MAGNUM_VERIFY_NO_ERROR(); } +#ifdef MAGNUM_TARGET_GLES +void CubeMapTextureArrayGLTest::samplingBorder() { + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_border_clamp::string() + std::string(" is not supported.")); + + CubeMapTextureArray texture; + texture.setWrapping(Sampler::Wrapping::ClampToBorder) + .setBorderColor(Color3(0.5f)); + + MAGNUM_VERIFY_NO_ERROR(); +} +#endif + void CubeMapTextureArrayGLTest::storage() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + #endif CubeMapTextureArray texture; texture.setStorage(5, TextureFormat::RGBA8, {32, 32, 24}); @@ -274,8 +352,13 @@ namespace { } void CubeMapTextureArrayGLTest::image() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + #endif CubeMapTextureArray texture; texture.setImage(0, TextureFormat::RGBA8, @@ -283,6 +366,8 @@ void CubeMapTextureArrayGLTest::image() { MAGNUM_VERIFY_NO_ERROR(); + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES Image3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -291,11 +376,17 @@ void CubeMapTextureArrayGLTest::image() { CORRADE_COMPARE_AS( Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), Containers::ArrayView{Data}, TestSuite::Compare::Container); + #endif } void CubeMapTextureArrayGLTest::imageBuffer() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + #endif CubeMapTextureArray texture; texture.setImage(0, TextureFormat::RGBA8, @@ -303,6 +394,8 @@ void CubeMapTextureArrayGLTest::imageBuffer() { MAGNUM_VERIFY_NO_ERROR(); + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES BufferImage3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); @@ -310,6 +403,7 @@ void CubeMapTextureArrayGLTest::imageBuffer() { CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6)); CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data}, TestSuite::Compare::Container); + #endif } namespace { @@ -363,8 +457,13 @@ namespace { } void CubeMapTextureArrayGLTest::subImage() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + #endif CubeMapTextureArray texture; texture.setImage(0, TextureFormat::RGBA8, @@ -374,6 +473,8 @@ void CubeMapTextureArrayGLTest::subImage() { MAGNUM_VERIFY_NO_ERROR(); + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES Image3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}); MAGNUM_VERIFY_NO_ERROR(); @@ -382,11 +483,17 @@ void CubeMapTextureArrayGLTest::subImage() { CORRADE_COMPARE_AS( Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), Containers::ArrayView{SubDataComplete}, TestSuite::Compare::Container); + #endif } void CubeMapTextureArrayGLTest::subImageBuffer() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + #endif CubeMapTextureArray texture; texture.setImage(0, TextureFormat::RGBA8, @@ -396,6 +503,8 @@ void CubeMapTextureArrayGLTest::subImageBuffer() { MAGNUM_VERIFY_NO_ERROR(); + /** @todo How to test this on ES? */ + #ifndef MAGNUM_TARGET_GLES BufferImage3D image = texture.image(0, {ColorFormat::RGBA, ColorType::UnsignedByte}, BufferUsage::StaticRead); const auto imageData = image.buffer().data(); @@ -403,8 +512,10 @@ void CubeMapTextureArrayGLTest::subImageBuffer() { CORRADE_COMPARE(image.size(), Vector3i(4, 4, 6)); CORRADE_COMPARE_AS(imageData, Containers::ArrayView{SubDataComplete}, TestSuite::Compare::Container); + #endif } +#ifndef MAGNUM_TARGET_GLES void CubeMapTextureArrayGLTest::subImageQuery() { if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); @@ -447,12 +558,18 @@ void CubeMapTextureArrayGLTest::subImageQueryBuffer() { CORRADE_COMPARE(image.size(), Vector3i(2, 2, 4)); CORRADE_COMPARE_AS(imageData, Containers::ArrayView{SubData}, TestSuite::Compare::Container); } +#endif void CubeMapTextureArrayGLTest::generateMipmap() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + #endif CubeMapTextureArray texture; texture.setImage(0, TextureFormat::RGBA8, @@ -476,8 +593,13 @@ void CubeMapTextureArrayGLTest::generateMipmap() { } void CubeMapTextureArrayGLTest::invalidateImage() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + #endif CubeMapTextureArray texture; texture.setStorage(2, TextureFormat::RGBA8, {32, 32, 24}); @@ -487,8 +609,13 @@ void CubeMapTextureArrayGLTest::invalidateImage() { } void CubeMapTextureArrayGLTest::invalidateSubImage() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); + #else + if(!Context::current()->isExtensionSupported()) + CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported.")); + #endif CubeMapTextureArray texture; texture.setStorage(2, TextureFormat::RGBA8, {32, 32, 24});