|
|
|
|
@ -57,9 +57,6 @@ struct BufferTextureGLTest: OpenGLTester {
|
|
|
|
|
void appleSetBufferQueryData(); |
|
|
|
|
void appleSetBufferMap(); |
|
|
|
|
void appleSetBufferMapRange(); |
|
|
|
|
void appleSetBufferDataMoved(); |
|
|
|
|
void appleSetBufferDataBufferDetached(); |
|
|
|
|
void appleSetBufferDataTextureDeleted(); |
|
|
|
|
#endif |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
@ -81,10 +78,7 @@ BufferTextureGLTest::BufferTextureGLTest() {
|
|
|
|
|
&BufferTextureGLTest::appleSetUnrelatedBufferData, |
|
|
|
|
&BufferTextureGLTest::appleSetBufferQueryData, |
|
|
|
|
&BufferTextureGLTest::appleSetBufferMap, |
|
|
|
|
&BufferTextureGLTest::appleSetBufferMapRange, |
|
|
|
|
&BufferTextureGLTest::appleSetBufferDataMoved, |
|
|
|
|
&BufferTextureGLTest::appleSetBufferDataBufferDetached, |
|
|
|
|
&BufferTextureGLTest::appleSetBufferDataTextureDeleted |
|
|
|
|
&BufferTextureGLTest::appleSetBufferMapRange |
|
|
|
|
#endif |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
@ -461,95 +455,6 @@ void BufferTextureGLTest::appleSetBufferMapRange() {
|
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void BufferTextureGLTest::appleSetBufferDataMoved() { |
|
|
|
|
#ifndef MAGNUM_TARGET_GLES |
|
|
|
|
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_buffer_object>()) |
|
|
|
|
CORRADE_SKIP(Extensions::ARB::texture_buffer_object::string() + std::string(" is not supported.")); |
|
|
|
|
#else |
|
|
|
|
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_buffer>()) |
|
|
|
|
CORRADE_SKIP(Extensions::EXT::texture_buffer::string() + std::string(" is not supported.")); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
BufferTexture texture; |
|
|
|
|
Buffer a; |
|
|
|
|
texture.setBuffer(BufferTextureFormat::RG8UI, a); |
|
|
|
|
|
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
|
|
|
|
|
if(Context::current().isVersionSupported(Version::GLES310)) |
|
|
|
|
CORRADE_COMPARE(texture.size(), 0); |
|
|
|
|
|
|
|
|
|
/* Verify that the texture relation info survives moving the buffer */ |
|
|
|
|
|
|
|
|
|
a.setData<UnsignedByte>({ |
|
|
|
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
|
|
|
|
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f |
|
|
|
|
}); |
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
CORRADE_COMPARE(texture.size(), 8); |
|
|
|
|
|
|
|
|
|
Buffer b{std::move(a)}; |
|
|
|
|
b.setData<UnsignedByte>({0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}); |
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
CORRADE_COMPARE(texture.size(), 4); |
|
|
|
|
|
|
|
|
|
Buffer c; |
|
|
|
|
c = std::move(b); |
|
|
|
|
c.setData<UnsignedByte>({ |
|
|
|
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
|
|
|
|
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f |
|
|
|
|
}); |
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
CORRADE_COMPARE(texture.size(), 8); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void BufferTextureGLTest::appleSetBufferDataBufferDetached() { |
|
|
|
|
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_buffer_object>()) |
|
|
|
|
CORRADE_SKIP(Extensions::ARB::texture_buffer_object::string() + std::string(" is not supported.")); |
|
|
|
|
|
|
|
|
|
BufferTexture texture; |
|
|
|
|
Buffer buffer; |
|
|
|
|
buffer.setData<UnsignedByte>({ |
|
|
|
|
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(); |
|
|
|
|
CORRADE_COMPARE(texture.size(), 8); |
|
|
|
|
|
|
|
|
|
texture.resetBuffer(); |
|
|
|
|
CORRADE_COMPARE(texture.size(), 0); |
|
|
|
|
|
|
|
|
|
/* The buffer is no longer attached to the texture, so it should not
|
|
|
|
|
attempt to attach itself again */ |
|
|
|
|
buffer.setData<UnsignedByte>({0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}); |
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
CORRADE_COMPARE(texture.size(), 0); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void BufferTextureGLTest::appleSetBufferDataTextureDeleted() { |
|
|
|
|
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_buffer_object>()) |
|
|
|
|
CORRADE_SKIP(Extensions::ARB::texture_buffer_object::string() + std::string(" is not supported.")); |
|
|
|
|
|
|
|
|
|
Buffer buffer; |
|
|
|
|
buffer.setData<UnsignedByte>({ |
|
|
|
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
|
|
|
|
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
BufferTexture texture; |
|
|
|
|
texture.setBuffer(BufferTextureFormat::RG8UI, buffer); |
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
CORRADE_COMPARE(texture.size(), 8); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* The texture no longer exists, so the buffer should not attempt to
|
|
|
|
|
access it */ |
|
|
|
|
buffer.setData<UnsignedByte>({0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}); |
|
|
|
|
MAGNUM_VERIFY_NO_GL_ERROR(); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
}}}} |
|
|
|
|
|