@ -139,7 +139,9 @@ struct TextureGLTest: AbstractOpenGLTester {
void subImage1DBuffer ( ) ;
void subImage1DBuffer ( ) ;
void compressedSubImage1DBuffer ( ) ;
void compressedSubImage1DBuffer ( ) ;
void subImage1DQuery ( ) ;
void subImage1DQuery ( ) ;
void compressedSubImage1DQuery ( ) ;
void subImage1DQueryBuffer ( ) ;
void subImage1DQueryBuffer ( ) ;
void compressedSubImage1DQueryBuffer ( ) ;
# endif
# endif
void subImage2D ( ) ;
void subImage2D ( ) ;
void compressedSubImage2D ( ) ;
void compressedSubImage2D ( ) ;
@ -149,7 +151,9 @@ struct TextureGLTest: AbstractOpenGLTester {
# endif
# endif
# ifndef MAGNUM_TARGET_GLES
# ifndef MAGNUM_TARGET_GLES
void subImage2DQuery ( ) ;
void subImage2DQuery ( ) ;
void compressedSubImage2DQuery ( ) ;
void subImage2DQueryBuffer ( ) ;
void subImage2DQueryBuffer ( ) ;
void compressedSubImage2DQueryBuffer ( ) ;
# endif
# endif
void subImage3D ( ) ;
void subImage3D ( ) ;
void compressedSubImage3D ( ) ;
void compressedSubImage3D ( ) ;
@ -159,7 +163,9 @@ struct TextureGLTest: AbstractOpenGLTester {
# endif
# endif
# ifndef MAGNUM_TARGET_GLES
# ifndef MAGNUM_TARGET_GLES
void subImage3DQuery ( ) ;
void subImage3DQuery ( ) ;
void compressedSubImage3DQuery ( ) ;
void subImage3DQueryBuffer ( ) ;
void subImage3DQueryBuffer ( ) ;
void compressedSubImage3DQueryBuffer ( ) ;
# endif
# endif
# ifndef MAGNUM_TARGET_GLES
# ifndef MAGNUM_TARGET_GLES
@ -286,7 +292,9 @@ TextureGLTest::TextureGLTest() {
& TextureGLTest : : subImage1DBuffer ,
& TextureGLTest : : subImage1DBuffer ,
& TextureGLTest : : compressedSubImage1DBuffer ,
& TextureGLTest : : compressedSubImage1DBuffer ,
& TextureGLTest : : subImage1DQuery ,
& TextureGLTest : : subImage1DQuery ,
& TextureGLTest : : compressedSubImage1DQuery ,
& TextureGLTest : : subImage1DQueryBuffer ,
& TextureGLTest : : subImage1DQueryBuffer ,
& TextureGLTest : : compressedSubImage1DQueryBuffer ,
# endif
# endif
& TextureGLTest : : subImage2D ,
& TextureGLTest : : subImage2D ,
& TextureGLTest : : compressedSubImage2D ,
& TextureGLTest : : compressedSubImage2D ,
@ -296,7 +304,9 @@ TextureGLTest::TextureGLTest() {
# endif
# endif
# ifndef MAGNUM_TARGET_GLES
# ifndef MAGNUM_TARGET_GLES
& TextureGLTest : : subImage2DQuery ,
& TextureGLTest : : subImage2DQuery ,
& TextureGLTest : : compressedSubImage2DQuery ,
& TextureGLTest : : subImage2DQueryBuffer ,
& TextureGLTest : : subImage2DQueryBuffer ,
& TextureGLTest : : compressedSubImage2DQueryBuffer ,
# endif
# endif
& TextureGLTest : : subImage3D ,
& TextureGLTest : : subImage3D ,
& TextureGLTest : : compressedSubImage3D ,
& TextureGLTest : : compressedSubImage3D ,
@ -306,7 +316,9 @@ TextureGLTest::TextureGLTest() {
# endif
# endif
# ifndef MAGNUM_TARGET_GLES
# ifndef MAGNUM_TARGET_GLES
& TextureGLTest : : subImage3DQuery ,
& TextureGLTest : : subImage3DQuery ,
& TextureGLTest : : compressedSubImage3DQuery ,
& TextureGLTest : : subImage3DQueryBuffer ,
& TextureGLTest : : subImage3DQueryBuffer ,
& TextureGLTest : : compressedSubImage3DQueryBuffer ,
# endif
# endif
# ifndef MAGNUM_TARGET_GLES
# ifndef MAGNUM_TARGET_GLES
@ -1316,6 +1328,10 @@ void TextureGLTest::subImage1DQuery() {
( Containers : : ArrayView < const UnsignedByte > { image . data < UnsignedByte > ( ) , image . data ( ) . size ( ) } . suffix ( DataOffset1D ) ) , Containers : : ArrayView < const UnsignedByte > { Data1D } , TestSuite : : Compare : : Container ) ;
( Containers : : ArrayView < const UnsignedByte > { image . data < UnsignedByte > ( ) , image . data ( ) . size ( ) } . suffix ( DataOffset1D ) ) , Containers : : ArrayView < const UnsignedByte > { Data1D } , TestSuite : : Compare : : Container ) ;
}
}
void TextureGLTest : : compressedSubImage1DQuery ( ) {
CORRADE_SKIP ( " No 1D texture compression format exists. " ) ;
}
void TextureGLTest : : subImage1DQueryBuffer ( ) {
void TextureGLTest : : subImage1DQueryBuffer ( ) {
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : get_texture_sub_image > ( ) )
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : get_texture_sub_image > ( ) )
CORRADE_SKIP ( Extensions : : GL : : ARB : : get_texture_sub_image : : string ( ) + std : : string ( " is not supported. " ) ) ;
CORRADE_SKIP ( Extensions : : GL : : ARB : : get_texture_sub_image : : string ( ) + std : : string ( " is not supported. " ) ) ;
@ -1336,6 +1352,10 @@ void TextureGLTest::subImage1DQueryBuffer() {
CORRADE_COMPARE_AS ( imageData . suffix ( DataOffset1D ) ,
CORRADE_COMPARE_AS ( imageData . suffix ( DataOffset1D ) ,
Containers : : ArrayView < const UnsignedByte > { Data1D } , TestSuite : : Compare : : Container ) ;
Containers : : ArrayView < const UnsignedByte > { Data1D } , TestSuite : : Compare : : Container ) ;
}
}
void TextureGLTest : : compressedSubImage1DQueryBuffer ( ) {
CORRADE_SKIP ( " No 1D texture compression format exists. " ) ;
}
# endif
# endif
namespace {
namespace {
@ -1491,6 +1511,41 @@ void TextureGLTest::subImage2DQuery() {
( Containers : : ArrayView < const UnsignedByte > { image . data < UnsignedByte > ( ) , image . data ( ) . size ( ) } . suffix ( _dataOffset2D ) ) , Containers : : ArrayView < const UnsignedByte > { Data2D } , TestSuite : : Compare : : Container ) ;
( Containers : : ArrayView < const UnsignedByte > { image . data < UnsignedByte > ( ) , image . data ( ) . size ( ) } . suffix ( _dataOffset2D ) ) , Containers : : ArrayView < const UnsignedByte > { Data2D } , TestSuite : : Compare : : Container ) ;
}
}
void TextureGLTest : : compressedSubImage2DQuery ( ) {
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : get_texture_sub_image > ( ) )
CORRADE_SKIP ( Extensions : : GL : : ARB : : get_texture_sub_image : : string ( ) + std : : string ( " is not supported. " ) ) ;
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : EXT : : texture_compression_s3tc > ( ) )
CORRADE_SKIP ( Extensions : : GL : : EXT : : texture_compression_s3tc : : string ( ) + std : : string ( " is not supported. " ) ) ;
Texture2D texture ;
texture . setStorage ( 1 , TextureFormat : : CompressedRGBAS3tcDxt3 , { 12 , 4 } )
. setCompressedSubImage ( 0 , { } , CompressedImageView2D { CompressedPixelFormat : : RGBAS3tcDxt3 , { 12 , 4 } , CompressedSubData2DComplete } ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
/* Test also without compressed pixel storage to ensure that both size
computations work */
if ( Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : compressed_texture_pixel_storage > ( ) ) {
CompressedImage2D image = texture . compressedSubImage ( 0 , Range2Di : : fromSize ( { 4 , 0 } , Vector2i { 4 } ) , { } ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
CORRADE_COMPARE ( image . size ( ) , Vector2i { 4 } ) ;
CORRADE_COMPARE_AS (
( Containers : : ArrayView < const UnsignedByte > { image . data < UnsignedByte > ( ) , image . data ( ) . size ( ) } ) ,
Containers : : ArrayView < const UnsignedByte > { CompressedData2D } , TestSuite : : Compare : : Container ) ;
}
CompressedImage2D image = texture . compressedSubImage ( 0 , Range2Di : : fromSize ( { 4 , 0 } , Vector2i { 4 } ) , { _compressedDataStorage2D } ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
CORRADE_COMPARE ( image . size ( ) , Vector2i { 4 } ) ;
CORRADE_COMPARE_AS (
( Containers : : ArrayView < const UnsignedByte > { image . data < UnsignedByte > ( ) , image . data ( ) . size ( ) } . suffix ( _compressedDataOffset2D ) ) ,
Containers : : ArrayView < const UnsignedByte > { CompressedData2D } , TestSuite : : Compare : : Container ) ;
}
void TextureGLTest : : subImage2DQueryBuffer ( ) {
void TextureGLTest : : subImage2DQueryBuffer ( ) {
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : get_texture_sub_image > ( ) )
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : get_texture_sub_image > ( ) )
CORRADE_SKIP ( Extensions : : GL : : ARB : : get_texture_sub_image : : string ( ) + std : : string ( " is not supported. " ) ) ;
CORRADE_SKIP ( Extensions : : GL : : ARB : : get_texture_sub_image : : string ( ) + std : : string ( " is not supported. " ) ) ;
@ -1511,6 +1566,39 @@ void TextureGLTest::subImage2DQueryBuffer() {
CORRADE_COMPARE_AS ( imageData . suffix ( _dataOffset2D ) ,
CORRADE_COMPARE_AS ( imageData . suffix ( _dataOffset2D ) ,
Containers : : ArrayView < const UnsignedByte > { Data2D } , TestSuite : : Compare : : Container ) ;
Containers : : ArrayView < const UnsignedByte > { Data2D } , TestSuite : : Compare : : Container ) ;
}
}
void TextureGLTest : : compressedSubImage2DQueryBuffer ( ) {
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : get_texture_sub_image > ( ) )
CORRADE_SKIP ( Extensions : : GL : : ARB : : get_texture_sub_image : : string ( ) + std : : string ( " is not supported. " ) ) ;
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : EXT : : texture_compression_s3tc > ( ) )
CORRADE_SKIP ( Extensions : : GL : : EXT : : texture_compression_s3tc : : string ( ) + std : : string ( " is not supported. " ) ) ;
Texture2D texture ;
texture . setStorage ( 1 , TextureFormat : : CompressedRGBAS3tcDxt3 , { 12 , 4 } )
. setCompressedSubImage ( 0 , { } , CompressedImageView2D { CompressedPixelFormat : : RGBAS3tcDxt3 , { 12 , 4 } , CompressedSubData2DComplete } ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
/* Test also without compressed pixel storage to ensure that both size
computations work */
if ( Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : compressed_texture_pixel_storage > ( ) ) {
CompressedBufferImage2D image = texture . compressedSubImage ( 0 , Range2Di : : fromSize ( { 4 , 0 } , Vector2i { 4 } ) , { } , BufferUsage : : StaticRead ) ;
const auto imageData = image . buffer ( ) . data < UnsignedByte > ( ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
CORRADE_COMPARE ( image . size ( ) , Vector2i { 4 } ) ;
CORRADE_COMPARE_AS ( imageData , Containers : : ArrayView < const UnsignedByte > { CompressedData2D } , TestSuite : : Compare : : Container ) ;
}
CompressedBufferImage2D image = texture . compressedSubImage ( 0 , Range2Di : : fromSize ( { 4 , 0 } , Vector2i { 4 } ) , { _compressedDataStorage2D } , BufferUsage : : StaticRead ) ;
const auto imageData = image . buffer ( ) . data < UnsignedByte > ( ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
CORRADE_COMPARE ( image . size ( ) , Vector2i { 4 } ) ;
CORRADE_COMPARE_AS ( imageData . suffix ( _compressedDataOffset2D ) , Containers : : ArrayView < const UnsignedByte > { CompressedData2D } , TestSuite : : Compare : : Container ) ;
}
# endif
# endif
namespace {
namespace {
@ -1707,6 +1795,41 @@ void TextureGLTest::subImage3DQuery() {
( Containers : : ArrayView < const UnsignedByte > { image . data < UnsignedByte > ( ) , image . data ( ) . size ( ) } . suffix ( _dataOffset3D ) ) , Containers : : ArrayView < const UnsignedByte > { Data3D } , TestSuite : : Compare : : Container ) ;
( Containers : : ArrayView < const UnsignedByte > { image . data < UnsignedByte > ( ) , image . data ( ) . size ( ) } . suffix ( _dataOffset3D ) ) , Containers : : ArrayView < const UnsignedByte > { Data3D } , TestSuite : : Compare : : Container ) ;
}
}
void TextureGLTest : : compressedSubImage3DQuery ( ) {
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : get_texture_sub_image > ( ) )
CORRADE_SKIP ( Extensions : : GL : : ARB : : get_texture_sub_image : : string ( ) + std : : string ( " is not supported. " ) ) ;
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : texture_compression_bptc > ( ) )
CORRADE_SKIP ( Extensions : : GL : : ARB : : texture_compression_bptc : : string ( ) + std : : string ( " is not supported. " ) ) ;
Texture3D texture ;
texture . setStorage ( 1 , TextureFormat : : CompressedRGBABptcUnorm , { 12 , 4 , 4 } )
. setCompressedSubImage ( 0 , { } , CompressedImageView3D { CompressedPixelFormat : : RGBABptcUnorm , { 12 , 4 , 4 } , CompressedSubData3DComplete } ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
/* Test also without compressed pixel storage to ensure that both size
computations work */
if ( Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : compressed_texture_pixel_storage > ( ) ) {
CompressedImage3D image = texture . compressedSubImage ( 0 , Range3Di : : fromSize ( { 4 , 0 , 0 } , Vector3i { 4 } ) , { } ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
CORRADE_COMPARE ( image . size ( ) , ( Vector3i { 4 } ) ) ;
CORRADE_COMPARE_AS (
( Containers : : ArrayView < const UnsignedByte > { image . data < UnsignedByte > ( ) , image . data ( ) . size ( ) } ) ,
Containers : : ArrayView < const UnsignedByte > { CompressedData3D } , TestSuite : : Compare : : Container ) ;
}
CompressedImage3D image = texture . compressedSubImage ( 0 , Range3Di : : fromSize ( { 4 , 0 , 0 } , Vector3i { 4 } ) , { _compressedDataStorage3D } ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
CORRADE_COMPARE ( image . size ( ) , ( Vector3i { 4 } ) ) ;
CORRADE_COMPARE_AS (
( Containers : : ArrayView < const UnsignedByte > { image . data < UnsignedByte > ( ) , image . data ( ) . size ( ) } . suffix ( _compressedDataOffset3D ) ) ,
Containers : : ArrayView < const UnsignedByte > { CompressedData3D } , TestSuite : : Compare : : Container ) ;
}
void TextureGLTest : : subImage3DQueryBuffer ( ) {
void TextureGLTest : : subImage3DQueryBuffer ( ) {
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : get_texture_sub_image > ( ) )
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : get_texture_sub_image > ( ) )
CORRADE_SKIP ( Extensions : : GL : : ARB : : get_texture_sub_image : : string ( ) + std : : string ( " is not supported. " ) ) ;
CORRADE_SKIP ( Extensions : : GL : : ARB : : get_texture_sub_image : : string ( ) + std : : string ( " is not supported. " ) ) ;
@ -1728,6 +1851,39 @@ void TextureGLTest::subImage3DQueryBuffer() {
Containers : : ArrayView < const UnsignedByte > { Data3D } , TestSuite : : Compare : : Container ) ;
Containers : : ArrayView < const UnsignedByte > { Data3D } , TestSuite : : Compare : : Container ) ;
}
}
void TextureGLTest : : compressedSubImage3DQueryBuffer ( ) {
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : get_texture_sub_image > ( ) )
CORRADE_SKIP ( Extensions : : GL : : ARB : : get_texture_sub_image : : string ( ) + std : : string ( " is not supported. " ) ) ;
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : texture_compression_bptc > ( ) )
CORRADE_SKIP ( Extensions : : GL : : ARB : : texture_compression_bptc : : string ( ) + std : : string ( " is not supported. " ) ) ;
Texture3D texture ;
texture . setStorage ( 1 , TextureFormat : : CompressedRGBABptcUnorm , { 12 , 4 , 4 } )
. setCompressedSubImage ( 0 , { } , CompressedImageView3D { CompressedPixelFormat : : RGBABptcUnorm , { 12 , 4 , 4 } , CompressedSubData3DComplete } ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
/* Test also without compressed pixel storage to ensure that both size
computations work */
if ( Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : compressed_texture_pixel_storage > ( ) ) {
CompressedBufferImage3D image = texture . compressedSubImage ( 0 , Range3Di : : fromSize ( { 4 , 0 , 0 } , Vector3i { 4 } ) , { } , BufferUsage : : StaticRead ) ;
const auto imageData = image . buffer ( ) . data < UnsignedByte > ( ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
CORRADE_COMPARE ( image . size ( ) , Vector3i { 4 } ) ;
CORRADE_COMPARE_AS ( imageData , Containers : : ArrayView < const UnsignedByte > { CompressedData3D } , TestSuite : : Compare : : Container ) ;
}
CompressedBufferImage3D image = texture . compressedSubImage ( 0 , Range3Di : : fromSize ( { 4 , 0 , 0 } , Vector3i { 4 } ) , { _compressedDataStorage3D } , BufferUsage : : StaticRead ) ;
const auto imageData = image . buffer ( ) . data < UnsignedByte > ( ) ;
MAGNUM_VERIFY_NO_ERROR ( ) ;
CORRADE_COMPARE ( image . size ( ) , Vector3i { 4 } ) ;
CORRADE_COMPARE_AS ( imageData . suffix ( _compressedDataOffset3D ) , Containers : : ArrayView < const UnsignedByte > { CompressedData3D } , TestSuite : : Compare : : Container ) ;
}
void TextureGLTest : : generateMipmap1D ( ) {
void TextureGLTest : : generateMipmap1D ( ) {
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : framebuffer_object > ( ) )
if ( ! Context : : current ( ) - > isExtensionSupported < Extensions : : GL : : ARB : : framebuffer_object > ( ) )
CORRADE_SKIP ( Extensions : : GL : : ARB : : framebuffer_object : : string ( ) + std : : string ( " is not supported. " ) ) ;
CORRADE_SKIP ( Extensions : : GL : : ARB : : framebuffer_object : : string ( ) + std : : string ( " is not supported. " ) ) ;