@ -129,19 +129,19 @@ struct CubeMapTextureGLTest: OpenGLTester {
# endif
# ifndef MAGNUM_TARGET_GLES
void fullImageQuery ( ) ;
void fullImageQueryView ( ) ;
void fullImageQueryViewNullptr ( ) ;
void fullImageQueryViewBadSize ( ) ;
void fullImageQueryBuffer ( ) ;
void image3D ( ) ;
void image3DBuffer ( ) ;
void image3DQueryView ( ) ;
void image3DQueryViewNullptr ( ) ;
void image3DQueryViewBadSize ( ) ;
void compressedFullImageQuery ( ) ;
void compressedFullImageQueryView ( ) ;
void compressedFull ImageQueryViewNullptr ( ) ;
void compressedFullImageQueryViewBadSize ( ) ;
void compressedFull ImageQueryViewBadData Size ( ) ;
void compressedFullImageQueryViewBadFormat ( ) ;
void compressedFullImageQueryBuffer ( ) ;
void compressedImage3D ( ) ;
void compressedImage3DBuffer ( ) ;
void compressedImage3D QueryView ( ) ;
void compressedImage3DQueryViewNullptr ( ) ;
void compressedImage3D QueryViewBadSize ( ) ;
void compressedImage3DQueryViewBadDataSize ( ) ;
void compressedImage3DQueryViewBadFormat ( ) ;
# endif
void generateMipmap ( ) ;
@ -350,13 +350,13 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() {
# ifndef MAGNUM_TARGET_GLES
addInstancedTests ( {
& CubeMapTextureGLTest : : fullImageQuery ,
& CubeMapTextureGLTest : : fullImageQueryView ,
& CubeMapTextureGLTest : : fullImageQueryBuffer } ,
& CubeMapTextureGLTest : : image3D ,
& CubeMapTextureGLTest : : image3DBuffer ,
& CubeMapTextureGLTest : : image3DQueryView } ,
Containers : : arraySize ( FullPixelStorageData ) ) ;
addTests ( { & CubeMapTextureGLTest : : fullImage QueryViewNullptr,
& CubeMapTextureGLTest : : fullImage QueryViewBadSize} ) ;
addTests ( { & CubeMapTextureGLTest : : image3D QueryViewNullptr,
& CubeMapTextureGLTest : : image3D QueryViewBadSize} ) ;
# endif
addInstancedTests ( {
@ -391,15 +391,15 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() {
& CubeMapTextureGLTest : : compressedImageQueryViewBadFormat } ) ;
addInstancedTests ( {
& CubeMapTextureGLTest : : compressedFullImageQuery ,
& CubeMapTextureGLTest : : compressedFullImageQueryView ,
& CubeMapTextureGLTest : : compressedFullImageQueryBuffer } ,
& CubeMapTextureGLTest : : compressedImage3D ,
& CubeMapTextureGLTest : : compressedImage3DBuffer ,
& CubeMapTextureGLTest : : compressedImage3DQueryView } ,
Containers : : arraySize ( CompressedFullPixelStorageData ) ) ;
addTests ( { & CubeMapTextureGLTest : : compressedFull ImageQueryViewNullptr ,
& CubeMapTextureGLTest : : compressedFull ImageQueryViewBadSize ,
& CubeMapTextureGLTest : : compressedFull ImageQueryViewBadDataSize ,
& CubeMapTextureGLTest : : compressedFull ImageQueryViewBadFormat } ) ;
addTests ( { & CubeMapTextureGLTest : : compressedImage3D QueryViewNullptr ,
& CubeMapTextureGLTest : : compressedImage3D QueryViewBadSize ,
& CubeMapTextureGLTest : : compressedImage3D QueryViewBadDataSize ,
& CubeMapTextureGLTest : : compressedImage3D QueryViewBadFormat } ) ;
# endif
addInstancedTests ( {
@ -1736,7 +1736,7 @@ void CubeMapTextureGLTest::compressedSubImageQueryBuffer() {
# endif
# ifndef MAGNUM_TARGET_GLES
void CubeMapTextureGLTest : : fullImageQuery ( ) {
void CubeMapTextureGLTest : : image3D ( ) {
setTestCaseDescription ( FullPixelStorageData [ testCaseInstanceId ( ) ] . name ) ;
if ( ! Context : : current ( ) . isExtensionSupported < Extensions : : ARB : : direct_state_access > ( ) )
@ -1765,7 +1765,38 @@ void CubeMapTextureGLTest::fullImageQuery() {
}
}
void CubeMapTextureGLTest : : fullImageQueryView ( ) {
void CubeMapTextureGLTest : : image3DBuffer ( ) {
setTestCaseDescription ( FullPixelStorageData [ testCaseInstanceId ( ) ] . name ) ;
if ( ! Context : : current ( ) . isExtensionSupported < Extensions : : ARB : : direct_state_access > ( ) )
CORRADE_SKIP ( Extensions : : ARB : : direct_state_access : : string ( ) < < " is not supported. " ) ;
CubeMapTexture texture ;
texture . setStorage ( 1 , TextureFormat : : RGBA8 , Vector2i { 2 } )
. setSubImage ( 0 , { } , BufferImage3D {
PixelFormat : : RGBA , PixelType : : UnsignedByte , { 2 , 2 , 6 } ,
FullPixelStorageData [ testCaseInstanceId ( ) ] . data ,
BufferUsage : : StaticDraw } ) ;
MAGNUM_VERIFY_NO_GL_ERROR ( ) ;
BufferImage3D image = texture . image ( 0 ,
{ FullPixelStorageData [ testCaseInstanceId ( ) ] . storage , PixelFormat : : RGBA ,
PixelType : : UnsignedByte } , BufferUsage : : StaticRead ) ;
MAGNUM_VERIFY_NO_GL_ERROR ( ) ;
CORRADE_COMPARE ( image . size ( ) , Vector3i ( 2 , 2 , 6 ) ) ;
const auto imageData = image . buffer ( ) . data ( ) ;
{
CORRADE_EXPECT_FAIL_IF ( ( Context : : current ( ) . detectedDriver ( ) & Context : : DetectedDriver : : Mesa ) & & FullPixelStorageData [ testCaseInstanceId ( ) ] . storage ! = PixelStorage { } ,
" Mesa drivers can't handle non-default pixel storage for full cubemap image queries. " ) ;
CORRADE_COMPARE_AS ( Containers : : arrayCast < UnsignedByte > ( imageData ) . suffix ( FullPixelStorageData [ testCaseInstanceId ( ) ] . offset ) ,
FullPixelStorageData [ testCaseInstanceId ( ) ] . data , TestSuite : : Compare : : Container ) ;
}
}
void CubeMapTextureGLTest : : image3DQueryView ( ) {
setTestCaseDescription ( FullPixelStorageData [ testCaseInstanceId ( ) ] . name ) ;
if ( ! Context : : current ( ) . isExtensionSupported < Extensions : : ARB : : direct_state_access > ( ) )
@ -1795,7 +1826,7 @@ void CubeMapTextureGLTest::fullImageQueryView() {
}
}
void CubeMapTextureGLTest : : fullImage QueryViewNullptr( ) {
void CubeMapTextureGLTest : : image3D QueryViewNullptr( ) {
# ifdef CORRADE_NO_ASSERT
CORRADE_SKIP ( " CORRADE_NO_ASSERT defined, can't test assertions " ) ;
# endif
@ -1814,7 +1845,7 @@ void CubeMapTextureGLTest::fullImageQueryViewNullptr() {
CORRADE_COMPARE ( out . str ( ) , " GL::CubeMapTexture::image(): image view is nullptr \n " ) ;
}
void CubeMapTextureGLTest : : fullImage QueryViewBadSize( ) {
void CubeMapTextureGLTest : : image3D QueryViewBadSize( ) {
# ifdef CORRADE_NO_ASSERT
CORRADE_SKIP ( " CORRADE_NO_ASSERT defined, can't test assertions " ) ;
# endif
@ -1834,38 +1865,57 @@ void CubeMapTextureGLTest::fullImageQueryViewBadSize() {
CORRADE_COMPARE ( out . str ( ) , " GL::CubeMapTexture::image(): expected image view size Vector(2, 2, 6) but got Vector(2, 1, 6) \n " ) ;
}
void CubeMapTextureGLTest : : fullImageQueryBuffer ( ) {
setTestCaseDescription ( FullPixelStorageData [ testCaseInstanceId ( ) ] . name ) ;
void CubeMapTextureGLTest : : compressedImage3D ( ) {
setTestCaseDescription ( Compressed FullPixelStorageData[ testCaseInstanceId ( ) ] . name ) ;
if ( ! Context : : current ( ) . isExtensionSupported < Extensions : : ARB : : direct_state_access > ( ) )
CORRADE_SKIP ( Extensions : : ARB : : direct_state_access : : string ( ) < < " is not supported. " ) ;
if ( ! Context : : current ( ) . isExtensionSupported < Extensions : : EXT : : texture_compression_s3tc > ( ) )
CORRADE_SKIP ( Extensions : : EXT : : texture_compression_s3tc : : string ( ) < < " is not supported. " ) ;
if ( CompressedPixelStorageData [ testCaseInstanceId ( ) ] . storage ! = CompressedPixelStorage { } & & ! Context : : current ( ) . isExtensionSupported < Extensions : : ARB : : compressed_texture_pixel_storage > ( ) )
CORRADE_SKIP ( Extensions : : ARB : : compressed_texture_pixel_storage : : string ( ) < < " is not supported. " ) ;
CubeMapTexture texture ;
texture . setStorage ( 1 , TextureFormat : : RGBA8 , Vector2i { 2 } )
. setSubImage ( 0 , { } , BufferImage3D {
PixelFormat : : RGBA , PixelType : : UnsignedByte , { 2 , 2 , 6 } ,
FullPixelStorageData [ testCaseInstanceId ( ) ] . data ,
BufferUsage : : StaticDraw } ) ;
texture . setStorage ( 1 , TextureFormat : : CompressedRGBAS3tcDxt3 , Vector2i { 4 } )
. setCompressedSubImage ( 0 , { } , CompressedImageView3D {
CompressedPixelFormat : : RGBAS3tcDxt3 , { 4 , 4 , 6 } ,
CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . data } ) ;
MAGNUM_VERIFY_NO_GL_ERROR ( ) ;
{
bool fails ( Context : : current ( ) . detectedDriver ( ) & Context : : DetectedDriver : : Amd ) ;
CORRADE_EXPECT_FAIL_IF ( fails ,
" ARB_DSA compressed cubemap APIs are broken on AMD drivers. " ) ;
BufferImage3D image = texture . image ( 0 ,
{ FullPixelStorageData [ testCaseInstanceId ( ) ] . storage , PixelFormat : : RGBA ,
PixelType : : UnsignedByte } , BufferUsage : : StaticRead ) ;
MAGNUM_VERIFY_NO_GL_ERROR ( ) ;
if ( fails ) CORRADE_SKIP ( " Skipping the rest of the test " ) ;
}
MAGNUM_VERIFY_NO_GL_ERROR ( ) ;
CompressedImage3D image = texture . compressedImage ( 0 , { CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . storage } ) ;
CORRADE_COMPARE ( image . size ( ) , Vector3i ( 2 , 2 , 6 ) ) ;
const auto imageData = image . buffer ( ) . data ( ) ;
{
CORRADE_EXPECT_FAIL_IF ( ( Context : : current ( ) . detectedDriver ( ) & Context : : DetectedDriver : : Mesa ) & & FullPixelStorageData [ testCaseInstanceId ( ) ] . storage ! = PixelStorage { } ,
# ifdef CORRADE_TARGET_WINDOWS
bool fails ( Context : : current ( ) . detectedDriver ( ) & Context : : DetectedDriver : : IntelWindows ) ;
CORRADE_EXPECT_FAIL_IF ( fails ,
" ARB_DSA compressed cubemap APIs are broken on Intel Windows drivers. " ) ;
# endif
MAGNUM_VERIFY_NO_GL_ERROR ( ) ;
# ifdef CORRADE_TARGET_WINDOWS
if ( fails ) CORRADE_SKIP ( " Skipping the rest of the test " ) ;
# endif
}
CORRADE_COMPARE ( image . size ( ) , ( Vector3i { 4 , 4 , 6 } ) ) ;
{
CORRADE_EXPECT_FAIL_IF ( ( Context : : current ( ) . detectedDriver ( ) & Context : : DetectedDriver : : Mesa ) & & CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . storage ! = CompressedPixelStorage { } ,
" Mesa drivers can't handle non-default pixel storage for full cubemap image queries. " ) ;
CORRADE_COMPARE_AS ( Containers : : arrayCast < UnsignedByte > ( imageData ) . suffix ( FullPixelStorageData [ testCaseInstanceId ( ) ] . offset ) ,
FullPixelStorageData [ testCaseInstanceId ( ) ] . data , TestSuite : : Compare : : Container ) ;
CORRADE_COMPARE_AS ( Containers : : arrayCast < UnsignedByte > ( image . data ( ) ) . suffix ( CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . offset ) ,
CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . data ,
TestSuite : : Compare : : Container ) ;
}
}
void CubeMapTextureGLTest : : compressedFullImageQuery ( ) {
void CubeMapTextureGLTest : : compressedImage3DBuffer ( ) {
setTestCaseDescription ( CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . name ) ;
if ( ! Context : : current ( ) . isExtensionSupported < Extensions : : ARB : : direct_state_access > ( ) )
@ -1877,9 +1927,10 @@ void CubeMapTextureGLTest::compressedFullImageQuery() {
CubeMapTexture texture ;
texture . setStorage ( 1 , TextureFormat : : CompressedRGBAS3tcDxt3 , Vector2i { 4 } )
. setCompressedSubImage ( 0 , { } , CompressedImageView 3D {
. setCompressedSubImage ( 0 , { } , CompressedBuffer Image3D {
CompressedPixelFormat : : RGBAS3tcDxt3 , { 4 , 4 , 6 } ,
CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . data } ) ;
CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . data ,
BufferUsage : : StaticDraw } ) ;
{
bool fails ( Context : : current ( ) . detectedDriver ( ) & Context : : DetectedDriver : : Amd ) ;
@ -1890,7 +1941,7 @@ void CubeMapTextureGLTest::compressedFullImageQuery() {
if ( fails ) CORRADE_SKIP ( " Skipping the rest of the test " ) ;
}
CompressedImage3D image = texture . compressedImage ( 0 , { CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . storage } ) ;
CompressedBuffer Image3D image = texture . compressedImage ( 0 , { CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . storage } , BufferUsage : : StaticRead ) ;
{
# ifdef CORRADE_TARGET_WINDOWS
@ -1906,16 +1957,17 @@ void CubeMapTextureGLTest::compressedFullImageQuery() {
}
CORRADE_COMPARE ( image . size ( ) , ( Vector3i { 4 , 4 , 6 } ) ) ;
const auto imageData = image . buffer ( ) . data ( ) ;
{
CORRADE_EXPECT_FAIL_IF ( ( Context : : current ( ) . detectedDriver ( ) & Context : : DetectedDriver : : Mesa ) & & CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . storage ! = CompressedPixelStorage { } ,
" Mesa drivers can't handle non-default pixel storage for full cubemap image queries. " ) ;
CORRADE_COMPARE_AS ( Containers : : arrayCast < UnsignedByte > ( image . data ( ) ) . suffix ( CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . offset ) ,
CORRADE_COMPARE_AS ( Containers : : arrayCast < UnsignedByte > ( imageData ) . suffix ( CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . offset ) ,
CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . data ,
TestSuite : : Compare : : Container ) ;
}
}
void CubeMapTextureGLTest : : compressedFull ImageQueryView ( ) {
void CubeMapTextureGLTest : : compressedImage3D QueryView ( ) {
setTestCaseDescription ( CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . name ) ;
if ( ! Context : : current ( ) . isExtensionSupported < Extensions : : ARB : : direct_state_access > ( ) )
@ -1967,7 +2019,7 @@ void CubeMapTextureGLTest::compressedFullImageQueryView() {
}
}
void CubeMapTextureGLTest : : compressedFull ImageQueryViewNullptr ( ) {
void CubeMapTextureGLTest : : compressedImage3D QueryViewNullptr ( ) {
# ifdef CORRADE_NO_ASSERT
CORRADE_SKIP ( " CORRADE_NO_ASSERT defined, can't test assertions " ) ;
# endif
@ -1988,7 +2040,7 @@ void CubeMapTextureGLTest::compressedFullImageQueryViewNullptr() {
CORRADE_COMPARE ( out . str ( ) , " GL::CubeMapTexture::compressedImage(): image view is nullptr \n " ) ;
}
void CubeMapTextureGLTest : : compressedFull ImageQueryViewBadSize ( ) {
void CubeMapTextureGLTest : : compressedImage3D QueryViewBadSize ( ) {
# ifdef CORRADE_NO_ASSERT
CORRADE_SKIP ( " CORRADE_NO_ASSERT defined, can't test assertions " ) ;
# endif
@ -2010,7 +2062,7 @@ void CubeMapTextureGLTest::compressedFullImageQueryViewBadSize() {
CORRADE_COMPARE ( out . str ( ) , " GL::CubeMapTexture::compressedImage(): expected image view size Vector(4, 4, 6) but got Vector(4, 8, 6) \n " ) ;
}
void CubeMapTextureGLTest : : compressedFull ImageQueryViewBadDataSize ( ) {
void CubeMapTextureGLTest : : compressedImage3D QueryViewBadDataSize ( ) {
# ifdef CORRADE_NO_ASSERT
CORRADE_SKIP ( " CORRADE_NO_ASSERT defined, can't test assertions " ) ;
# endif
@ -2032,7 +2084,7 @@ void CubeMapTextureGLTest::compressedFullImageQueryViewBadDataSize() {
CORRADE_COMPARE ( out . str ( ) , " GL::CubeMapTexture::compressedImage(): expected image view data size 96 bytes but got 95 \n " ) ;
}
void CubeMapTextureGLTest : : compressedFull ImageQueryViewBadFormat ( ) {
void CubeMapTextureGLTest : : compressedImage3D QueryViewBadFormat ( ) {
# ifdef CORRADE_NO_ASSERT
CORRADE_SKIP ( " CORRADE_NO_ASSERT defined, can't test assertions " ) ;
# endif
@ -2053,58 +2105,6 @@ void CubeMapTextureGLTest::compressedFullImageQueryViewBadFormat() {
texture . compressedImage ( 0 , image ) ;
CORRADE_COMPARE ( out . str ( ) , " GL::CubeMapTexture::compressedImage(): expected image view format GL::CompressedPixelFormat::RGBAS3tcDxt3 but got GL::CompressedPixelFormat::RGBAS3tcDxt1 \n " ) ;
}
void CubeMapTextureGLTest : : compressedFullImageQueryBuffer ( ) {
setTestCaseDescription ( CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . name ) ;
if ( ! Context : : current ( ) . isExtensionSupported < Extensions : : ARB : : direct_state_access > ( ) )
CORRADE_SKIP ( Extensions : : ARB : : direct_state_access : : string ( ) < < " is not supported. " ) ;
if ( ! Context : : current ( ) . isExtensionSupported < Extensions : : EXT : : texture_compression_s3tc > ( ) )
CORRADE_SKIP ( Extensions : : EXT : : texture_compression_s3tc : : string ( ) < < " is not supported. " ) ;
if ( CompressedPixelStorageData [ testCaseInstanceId ( ) ] . storage ! = CompressedPixelStorage { } & & ! Context : : current ( ) . isExtensionSupported < Extensions : : ARB : : compressed_texture_pixel_storage > ( ) )
CORRADE_SKIP ( Extensions : : ARB : : compressed_texture_pixel_storage : : string ( ) < < " is not supported. " ) ;
CubeMapTexture texture ;
texture . setStorage ( 1 , TextureFormat : : CompressedRGBAS3tcDxt3 , Vector2i { 4 } )
. setCompressedSubImage ( 0 , { } , CompressedBufferImage3D {
CompressedPixelFormat : : RGBAS3tcDxt3 , { 4 , 4 , 6 } ,
CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . data ,
BufferUsage : : StaticDraw } ) ;
{
bool fails ( Context : : current ( ) . detectedDriver ( ) & Context : : DetectedDriver : : Amd ) ;
CORRADE_EXPECT_FAIL_IF ( fails ,
" ARB_DSA compressed cubemap APIs are broken on AMD drivers. " ) ;
MAGNUM_VERIFY_NO_GL_ERROR ( ) ;
if ( fails ) CORRADE_SKIP ( " Skipping the rest of the test " ) ;
}
CompressedBufferImage3D image = texture . compressedImage ( 0 , { CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . storage } , BufferUsage : : StaticRead ) ;
{
# ifdef CORRADE_TARGET_WINDOWS
bool fails ( Context : : current ( ) . detectedDriver ( ) & Context : : DetectedDriver : : IntelWindows ) ;
CORRADE_EXPECT_FAIL_IF ( fails ,
" ARB_DSA compressed cubemap APIs are broken on Intel Windows drivers. " ) ;
# endif
MAGNUM_VERIFY_NO_GL_ERROR ( ) ;
# ifdef CORRADE_TARGET_WINDOWS
if ( fails ) CORRADE_SKIP ( " Skipping the rest of the test " ) ;
# endif
}
CORRADE_COMPARE ( image . size ( ) , ( Vector3i { 4 , 4 , 6 } ) ) ;
const auto imageData = image . buffer ( ) . data ( ) ;
{
CORRADE_EXPECT_FAIL_IF ( ( Context : : current ( ) . detectedDriver ( ) & Context : : DetectedDriver : : Mesa ) & & CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . storage ! = CompressedPixelStorage { } ,
" Mesa drivers can't handle non-default pixel storage for full cubemap image queries. " ) ;
CORRADE_COMPARE_AS ( Containers : : arrayCast < UnsignedByte > ( imageData ) . suffix ( CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . offset ) ,
CompressedFullPixelStorageData [ testCaseInstanceId ( ) ] . data ,
TestSuite : : Compare : : Container ) ;
}
}
# endif
void CubeMapTextureGLTest : : generateMipmap ( ) {