diff --git a/src/Magnum/AbstractTexture.h b/src/Magnum/AbstractTexture.h index b708473be..e6c62decf 100644 --- a/src/Magnum/AbstractTexture.h +++ b/src/Magnum/AbstractTexture.h @@ -108,6 +108,10 @@ functions do nothing. @todo `GL_NUM_COMPRESSED_TEXTURE_FORMATS` when compressed textures are implemented @todo `GL_MAX_SAMPLE_MASK_WORDS` when @extension{ARB,texture_multisample} is done @todo Query for immutable levels (@extension{ARB,ES3_compatibility}) +@bug If using @extension{ARB,multi_bind} and the texture is bound right after + construction, the @fn_gl{BindTextures} call will fail with + Renderer::Error::InvalidOperation, because the texture doesn't yet have + associated target */ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { friend struct Implementation::TextureState; diff --git a/src/Magnum/Test/BufferTextureGLTest.cpp b/src/Magnum/Test/BufferTextureGLTest.cpp index b67180ea9..0789b2aaa 100644 --- a/src/Magnum/Test/BufferTextureGLTest.cpp +++ b/src/Magnum/Test/BufferTextureGLTest.cpp @@ -67,6 +67,19 @@ void BufferTextureGLTest::bind() { CORRADE_SKIP(Extensions::GL::ARB::texture_buffer_object::string() + std::string(" is not supported.")); BufferTexture texture; + + if(Context::current()->isExtensionSupported()) { + CORRADE_EXPECT_FAIL("With ARB_multi_bind the texture must be associated with given target at least once before binding it"); + Buffer buffer; + constexpr UnsignedByte data[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f + }; + buffer.setData(data, BufferUsage::StaticDraw); + texture.setBuffer(BufferTextureFormat::R8UI, buffer); + CORRADE_VERIFY(false); + } + texture.bind(15); MAGNUM_VERIFY_NO_ERROR(); diff --git a/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp b/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp index fbe7e7f5c..e6f9fdf63 100644 --- a/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp +++ b/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp @@ -94,6 +94,15 @@ void CubeMapTextureArrayGLTest::construct() { void CubeMapTextureArrayGLTest::bind() { CubeMapTextureArray texture; + + #ifndef MAGNUM_TARGET_GLES + if(Context::current()->isExtensionSupported()) { + CORRADE_EXPECT_FAIL("With ARB_multi_bind the texture must be associated with given target at least once before binding it."); + texture.setBaseLevel(0); + CORRADE_VERIFY(false); + } + #endif + texture.bind(15); MAGNUM_VERIFY_NO_ERROR(); diff --git a/src/Magnum/Test/CubeMapTextureGLTest.cpp b/src/Magnum/Test/CubeMapTextureGLTest.cpp index 092d6b5e4..c820d365c 100644 --- a/src/Magnum/Test/CubeMapTextureGLTest.cpp +++ b/src/Magnum/Test/CubeMapTextureGLTest.cpp @@ -114,6 +114,15 @@ void CubeMapTextureGLTest::construct() { void CubeMapTextureGLTest::bind() { CubeMapTexture texture; + + #ifndef MAGNUM_TARGET_GLES + if(Context::current()->isExtensionSupported()) { + CORRADE_EXPECT_FAIL("With ARB_multi_bind the texture must be associated with given target at least once before binding it."); + texture.setBaseLevel(0); + CORRADE_VERIFY(false); + } + #endif + texture.bind(15); MAGNUM_VERIFY_NO_ERROR(); diff --git a/src/Magnum/Test/MultisampleTextureGLTest.cpp b/src/Magnum/Test/MultisampleTextureGLTest.cpp index 0de1a3d44..afeaec3b0 100644 --- a/src/Magnum/Test/MultisampleTextureGLTest.cpp +++ b/src/Magnum/Test/MultisampleTextureGLTest.cpp @@ -120,6 +120,13 @@ void MultisampleTextureGLTest::bind2D() { CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); MultisampleTexture2D texture; + + if(Context::current()->isExtensionSupported()) { + CORRADE_EXPECT_FAIL("With ARB_multi_bind the texture must be associated with given target at least once before binding it."); + CORRADE_VERIFY(false); + CORRADE_SKIP("...but we don't have any function to do that yet."); + } + texture.bind(15); MAGNUM_VERIFY_NO_ERROR(); @@ -138,6 +145,13 @@ void MultisampleTextureGLTest::bind2DArray() { CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported.")); MultisampleTexture2DArray texture; + + if(Context::current()->isExtensionSupported()) { + CORRADE_EXPECT_FAIL("With ARB_multi_bind the texture must be associated with given target at least once before binding it."); + CORRADE_VERIFY(false); + CORRADE_SKIP("...but we don't have any function to do that yet."); + } + texture.bind(15); MAGNUM_VERIFY_NO_ERROR(); diff --git a/src/Magnum/Test/RectangleTextureGLTest.cpp b/src/Magnum/Test/RectangleTextureGLTest.cpp index a0a9827c3..91404f694 100644 --- a/src/Magnum/Test/RectangleTextureGLTest.cpp +++ b/src/Magnum/Test/RectangleTextureGLTest.cpp @@ -95,6 +95,15 @@ void RectangleTextureGLTest::bind() { CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported.")); RectangleTexture texture; + + #ifndef MAGNUM_TARGET_GLES + if(Context::current()->isExtensionSupported()) { + CORRADE_EXPECT_FAIL("With ARB_multi_bind the texture must be associated with given target at least once before binding it."); + texture.setWrapping(Sampler::Wrapping::ClampToEdge); + CORRADE_VERIFY(false); + } + #endif + texture.bind(15); MAGNUM_VERIFY_NO_ERROR(); diff --git a/src/Magnum/Test/TextureArrayGLTest.cpp b/src/Magnum/Test/TextureArrayGLTest.cpp index 0a7f7676b..d7c2d2f68 100644 --- a/src/Magnum/Test/TextureArrayGLTest.cpp +++ b/src/Magnum/Test/TextureArrayGLTest.cpp @@ -205,6 +205,13 @@ void TextureArrayGLTest::bind1D() { CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); Texture1DArray texture; + + if(Context::current()->isExtensionSupported()) { + CORRADE_EXPECT_FAIL("With ARB_multi_bind the texture must be associated with given target at least once before binding it."); + texture.setBaseLevel(0); + CORRADE_VERIFY(false); + } + texture.bind(15); MAGNUM_VERIFY_NO_ERROR(); @@ -226,6 +233,15 @@ void TextureArrayGLTest::bind2D() { #endif Texture2DArray texture; + + #ifndef MAGNUM_TARGET_GLES + if(Context::current()->isExtensionSupported()) { + CORRADE_EXPECT_FAIL("With ARB_multi_bind the texture must be associated with given target at least once before binding it."); + texture.setBaseLevel(0); + CORRADE_VERIFY(false); + } + #endif + texture.bind(15); MAGNUM_VERIFY_NO_ERROR(); diff --git a/src/Magnum/Test/TextureGLTest.cpp b/src/Magnum/Test/TextureGLTest.cpp index fb5a90b5b..ee23b0316 100644 --- a/src/Magnum/Test/TextureGLTest.cpp +++ b/src/Magnum/Test/TextureGLTest.cpp @@ -254,6 +254,13 @@ void TextureGLTest::construct3D() { #ifndef MAGNUM_TARGET_GLES void TextureGLTest::bind1D() { Texture1D texture; + + if(Context::current()->isExtensionSupported()) { + CORRADE_EXPECT_FAIL("With ARB_multi_bind the texture must be associated with given target at least once before binding it."); + texture.setBaseLevel(0); + CORRADE_VERIFY(false); + } + texture.bind(15); MAGNUM_VERIFY_NO_ERROR(); @@ -270,6 +277,15 @@ void TextureGLTest::bind1D() { void TextureGLTest::bind2D() { Texture2D texture; + + #ifndef MAGNUM_TARGET_GLES + if(Context::current()->isExtensionSupported()) { + CORRADE_EXPECT_FAIL("With ARB_multi_bind the texture must be associated with given target at least once before binding it."); + texture.setBaseLevel(0); + CORRADE_VERIFY(false); + } + #endif + texture.bind(15); MAGNUM_VERIFY_NO_ERROR(); @@ -290,6 +306,15 @@ void TextureGLTest::bind3D() { #endif Texture3D texture; + + #ifndef MAGNUM_TARGET_GLES + if(Context::current()->isExtensionSupported()) { + CORRADE_EXPECT_FAIL("With ARB_multi_bind the texture must be associated with given target at least once before binding it."); + texture.setBaseLevel(0); + CORRADE_VERIFY(false); + } + #endif + texture.bind(15); MAGNUM_VERIFY_NO_ERROR();