From 0e1779ad619ec180ba2449b5861c6bd8b5ee0902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 28 Jan 2020 20:24:13 +0100 Subject: [PATCH] GL: a new case that the new Apple BufferTexture workaround doesn't fix. Sigh. --- src/Magnum/GL/Test/BufferTextureGLTest.cpp | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/Magnum/GL/Test/BufferTextureGLTest.cpp b/src/Magnum/GL/Test/BufferTextureGLTest.cpp index b55d93eeb..000a33c1f 100644 --- a/src/Magnum/GL/Test/BufferTextureGLTest.cpp +++ b/src/Magnum/GL/Test/BufferTextureGLTest.cpp @@ -53,6 +53,7 @@ struct BufferTextureGLTest: OpenGLTester { #if defined(CORRADE_TARGET_APPLE) && !defined(CORRADE_TARGET_IOS) void appleSetBufferSubData(); + void appleSetUnrelatedBufferData(); void appleSetBufferQueryData(); void appleSetBufferMap(); void appleSetBufferMapRange(); @@ -77,6 +78,7 @@ BufferTextureGLTest::BufferTextureGLTest() { #if defined(CORRADE_TARGET_APPLE) && !defined(CORRADE_TARGET_IOS) &BufferTextureGLTest::appleSetBufferSubData, + &BufferTextureGLTest::appleSetUnrelatedBufferData, &BufferTextureGLTest::appleSetBufferQueryData, &BufferTextureGLTest::appleSetBufferMap, &BufferTextureGLTest::appleSetBufferMapRange, @@ -357,6 +359,29 @@ void BufferTextureGLTest::appleSetBufferSubData() { MAGNUM_VERIFY_NO_GL_ERROR(); } +void BufferTextureGLTest::appleSetUnrelatedBufferData() { + if(!Context::current().isExtensionSupported()) + CORRADE_SKIP(Extensions::ARB::texture_buffer_object::string() + std::string(" is not supported.")); + + BufferTexture texture; + Buffer buffer{Buffer::TargetHint::Texture}; + buffer.setData({ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f + }); + texture.setBuffer(BufferTextureFormat::RG8UI, buffer); + + MAGNUM_VERIFY_NO_GL_ERROR(); + + /* This crashes even though there is no relation to the texture. */ + Buffer another; + another.setData({0xf3, 0xab, 0x01, 0x57}); + + CORRADE_COMPARE(texture.size(), 8); + + MAGNUM_VERIFY_NO_GL_ERROR(); +} + void BufferTextureGLTest::appleSetBufferQueryData() { if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::ARB::texture_buffer_object::string() + std::string(" is not supported."));