Browse Source

GL: minor cleanup in the tests.

pull/317/head
Vladimír Vondruš 7 years ago
parent
commit
428773fdcb
  1. 42
      src/Magnum/GL/Test/CubeMapTextureArrayGLTest.cpp
  2. 54
      src/Magnum/GL/Test/CubeMapTextureGLTest.cpp
  3. 6
      src/Magnum/GL/Test/RectangleTextureGLTest.cpp
  4. 24
      src/Magnum/GL/Test/TextureArrayGLTest.cpp
  5. 57
      src/Magnum/GL/Test/TextureGLTest.cpp

42
src/Magnum/GL/Test/CubeMapTextureArrayGLTest.cpp

@ -115,15 +115,13 @@ constexpr UnsignedByte Data[]{
0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f
};
enum: std::size_t { PixelStorageDataCount = 2 };
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorageData[PixelStorageDataCount]{
} PixelStorageData[]{
{"default pixel storage",
Containers::arrayView(Data).suffix(16), {},
Containers::arrayView(Data).suffix(16), 0},
@ -155,14 +153,6 @@ constexpr UnsignedByte CompressedData[]{
232, 57, 0, 0, 213, 255, 170, 2
};
enum: std::size_t { CompressedPixelStorageDataCount =
#ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
@ -171,7 +161,7 @@ const struct {
#endif
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} CompressedPixelStorageData[CompressedPixelStorageDataCount]{
} CompressedPixelStorageData[]{
{"default pixel storage",
Containers::arrayView(CompressedData).suffix(16*4),
#ifndef MAGNUM_TARGET_GLES
@ -204,15 +194,13 @@ constexpr UnsignedByte SubData[]{
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f
};
enum: std::size_t { SubPixelStorageDataCount = 2 };
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} SubPixelStorageData[SubPixelStorageDataCount]{
} SubPixelStorageData[]{
{"default pixel storage",
Containers::arrayView(SubData).suffix(16), {},
Containers::arrayView(SubData).suffix(16), 0},
@ -238,14 +226,6 @@ constexpr UnsignedByte CompressedSubData[] = {
255, 255, 24, 190, 213, 255, 170, 2
};
enum: std::size_t { CompressedSubPixelStorageDataCount =
#ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
@ -254,7 +234,7 @@ const struct {
#endif
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} CompressedSubPixelStorageData[CompressedSubPixelStorageDataCount]{
} CompressedSubPixelStorageData[]{
{"default pixel storage",
Containers::arrayView(CompressedSubData).suffix(16*4),
#ifndef MAGNUM_TARGET_GLES
@ -293,25 +273,31 @@ CubeMapTextureArrayGLTest::CubeMapTextureArrayGLTest() {
addInstancedTests({
&CubeMapTextureArrayGLTest::image,
&CubeMapTextureArrayGLTest::imageBuffer,
&CubeMapTextureArrayGLTest::imageBuffer},
Containers::arraySize(PixelStorageData));
addInstancedTests({
&CubeMapTextureArrayGLTest::subImage,
&CubeMapTextureArrayGLTest::subImageBuffer,
#ifndef MAGNUM_TARGET_GLES
&CubeMapTextureArrayGLTest::subImageQuery,
&CubeMapTextureArrayGLTest::subImageQueryBuffer
#endif
}, PixelStorageDataCount);
}, Containers::arraySize(SubPixelStorageData));
addInstancedTests({
&CubeMapTextureArrayGLTest::compressedImage,
&CubeMapTextureArrayGLTest::compressedImageBuffer,
&CubeMapTextureArrayGLTest::compressedImageBuffer},
Containers::arraySize(CompressedPixelStorageData));
addInstancedTests({
&CubeMapTextureArrayGLTest::compressedSubImage,
&CubeMapTextureArrayGLTest::compressedSubImageBuffer,
#ifndef MAGNUM_TARGET_GLES
&CubeMapTextureArrayGLTest::compressedSubImageQuery,
&CubeMapTextureArrayGLTest::compressedSubImageQueryBuffer,
#endif
}, CompressedPixelStorageDataCount);
}, Containers::arraySize(CompressedSubPixelStorageData));
addTests({&CubeMapTextureArrayGLTest::generateMipmap,

54
src/Magnum/GL/Test/CubeMapTextureGLTest.cpp

@ -133,21 +133,13 @@ constexpr UnsignedByte Data[]{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
enum: std::size_t { PixelStorageDataCount =
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
2
#else
1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorageData[PixelStorageDataCount]{
} PixelStorageData[]{
{"default pixel storage",
Containers::arrayView(Data).suffix(8), {},
Containers::arrayView(Data).suffix(8), 0},
@ -165,14 +157,6 @@ constexpr UnsignedByte CompressedData[]{
232, 57, 0, 0, 213, 255, 170, 2
};
enum: std::size_t { CompressedPixelStorageDataCount =
#ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
@ -181,7 +165,7 @@ const struct {
#endif
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} CompressedPixelStorageData[CompressedPixelStorageDataCount]{
} CompressedPixelStorageData[]{
{"default pixel storage",
Containers::arrayView(CompressedData).suffix(16),
#ifndef MAGNUM_TARGET_GLES
@ -222,14 +206,12 @@ constexpr UnsignedByte FullData[]{
0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f
};
enum: std::size_t { FullPixelStorageDataCount = 2 };
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
std::size_t offset;
} FullPixelStorageData[FullPixelStorageDataCount]{
} FullPixelStorageData[]{
{"default pixel storage",
Containers::arrayView(FullData).suffix(16), {}, 0},
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
@ -261,14 +243,6 @@ constexpr UnsignedByte CompressedFullData[]{
232, 57, 0, 0, 213, 255, 170, 2
};
enum: std::size_t { CompressedFullPixelStorageDataCount =
#ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
@ -276,7 +250,7 @@ const struct {
CompressedPixelStorage storage;
#endif
std::size_t offset;
} CompressedFullPixelStorageData[CompressedFullPixelStorageDataCount]{
} CompressedFullPixelStorageData[]{
{"default pixel storage",
Containers::arrayView(CompressedFullData).suffix(16*4),
#ifndef MAGNUM_TARGET_GLES
@ -329,10 +303,16 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() {
#ifndef MAGNUM_TARGET_GLES2
&CubeMapTextureGLTest::imageBuffer,
#endif
}, Containers::arraySize(PixelStorageData));
#ifndef MAGNUM_TARGET_GLES
addInstancedTests({
&CubeMapTextureGLTest::fullImageQuery,
&CubeMapTextureGLTest::fullImageQueryBuffer,
&CubeMapTextureGLTest::fullImageQueryBuffer},
Containers::arraySize(FullPixelStorageData));
#endif
addInstancedTests({
&CubeMapTextureGLTest::subImage,
#ifndef MAGNUM_TARGET_GLES2
&CubeMapTextureGLTest::subImageBuffer,
@ -341,7 +321,7 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() {
&CubeMapTextureGLTest::subImageQuery,
&CubeMapTextureGLTest::subImageQueryBuffer
#endif
}, PixelStorageDataCount);
}, Containers::arraySize(PixelStorageData));
addInstancedTests({
&CubeMapTextureGLTest::compressedImage,
@ -351,10 +331,16 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() {
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
&CubeMapTextureGLTest::immutableCompressedImage,
#endif
}, Containers::arraySize(CompressedPixelStorageData));
#ifndef MAGNUM_TARGET_GLES
addInstancedTests({
&CubeMapTextureGLTest::compressedFullImageQuery,
&CubeMapTextureGLTest::compressedFullImageQueryBuffer,
&CubeMapTextureGLTest::compressedFullImageQueryBuffer},
Containers::arraySize(CompressedFullPixelStorageData));
#endif
addInstancedTests({
&CubeMapTextureGLTest::compressedSubImage,
#ifndef MAGNUM_TARGET_GLES2
&CubeMapTextureGLTest::compressedSubImageBuffer,
@ -363,7 +349,7 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() {
&CubeMapTextureGLTest::compressedSubImageQuery,
&CubeMapTextureGLTest::compressedSubImageQueryBuffer
#endif
}, CompressedPixelStorageDataCount);
}, Containers::arraySize(CompressedPixelStorageData));
addTests({&CubeMapTextureGLTest::generateMipmap,

6
src/Magnum/GL/Test/RectangleTextureGLTest.cpp

@ -88,15 +88,13 @@ constexpr UnsignedByte Data[]{
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
enum: std::size_t { PixelStorageDataCount = 2 };
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorageData[PixelStorageDataCount]{
} PixelStorageData[]{
{"default pixel storage",
Containers::arrayView(Data).suffix(8), {},
Containers::arrayView(Data).suffix(8), 0},
@ -130,7 +128,7 @@ RectangleTextureGLTest::RectangleTextureGLTest() {
&RectangleTextureGLTest::subImageBuffer,
&RectangleTextureGLTest::subImageQuery,
&RectangleTextureGLTest::subImageQueryBuffer},
PixelStorageDataCount);
Containers::arraySize(PixelStorageData));
addTests({&RectangleTextureGLTest::compressedImage,
&RectangleTextureGLTest::compressedImageBuffer,

24
src/Magnum/GL/Test/TextureArrayGLTest.cpp

@ -175,15 +175,13 @@ constexpr UnsignedByte Data1D[]{
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
};
enum: std::size_t { PixelStorage1DDataCount = 2 };
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorage1DData[PixelStorage1DDataCount]{
} PixelStorage1DData[]{
{"default pixel storage",
Containers::arrayView(Data1D).suffix(8), {},
Containers::arrayView(Data1D).suffix(8), 0},
@ -201,15 +199,13 @@ constexpr UnsignedByte Data2D[]{
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
};
enum: std::size_t { PixelStorage2DDataCount = 2 };
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorage2DData[PixelStorage2DDataCount]{
} PixelStorage2DData[]{
{"default pixel storage",
Containers::arrayView(Data2D).suffix(16), {},
Containers::arrayView(Data2D).suffix(16), 0},
@ -227,14 +223,6 @@ constexpr UnsignedByte CompressedData2D[]{
239, 123, 8, 66, 213, 255, 170, 2
};
enum: std::size_t { CompressedPixelStorage2DDataCount =
#ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
@ -243,7 +231,7 @@ const struct {
#endif
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} CompressedPixelStorage2DData[CompressedPixelStorage2DDataCount]{
} CompressedPixelStorage2DData[]{
{"default pixel storage",
Containers::arrayView(CompressedData2D).suffix(16),
#ifndef MAGNUM_TARGET_GLES
@ -335,7 +323,7 @@ TextureArrayGLTest::TextureArrayGLTest() {
&TextureArrayGLTest::subImage1DBuffer,
&TextureArrayGLTest::subImage1DQuery,
&TextureArrayGLTest::subImage1DQueryBuffer},
PixelStorage1DDataCount);
Containers::arraySize(PixelStorage1DData));
addTests({&TextureArrayGLTest::compressedImage1D,
&TextureArrayGLTest::compressedImage1DBuffer,
@ -354,7 +342,7 @@ TextureArrayGLTest::TextureArrayGLTest() {
&TextureArrayGLTest::subImage2DQuery,
&TextureArrayGLTest::subImage2DQueryBuffer
#endif
}, PixelStorage2DDataCount);
}, Containers::arraySize(PixelStorage2DData));
addInstancedTests({
&TextureArrayGLTest::compressedImage2D,
@ -365,7 +353,7 @@ TextureArrayGLTest::TextureArrayGLTest() {
&TextureArrayGLTest::compressedSubImage2DQuery,
&TextureArrayGLTest::compressedSubImage2DQueryBuffer
#endif
}, CompressedPixelStorage2DDataCount);
}, Containers::arraySize(CompressedPixelStorage2DData));
addTests({
#ifndef MAGNUM_TARGET_GLES

57
src/Magnum/GL/Test/TextureGLTest.cpp

@ -252,15 +252,13 @@ constexpr UnsignedByte Data1D[]{
0x04, 0x05, 0x06, 0x07
};
enum: std::size_t { PixelStorage1DDataCount = 2 };
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorage1DData[PixelStorage1DDataCount]{
} PixelStorage1DData[]{
{"default pixel storage",
Containers::arrayView(Data1D).suffix(4), {},
Containers::arrayView(Data1D).suffix(4), 0},
@ -275,21 +273,13 @@ constexpr UnsignedByte Data2D[]{
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
};
enum: std::size_t { PixelStorage2DDataCount =
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
2
#else
1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorage2DData[PixelStorage2DDataCount]{
} PixelStorage2DData[]{
{"default pixel storage",
Containers::arrayView(Data2D).suffix(8), {},
Containers::arrayView(Data2D).suffix(8), 0},
@ -308,14 +298,6 @@ constexpr UnsignedByte CompressedData2D[]{
232, 57, 0, 0, 213, 255, 170, 2
};
enum: std::size_t { CompressedPixelStorage2DDataCount =
#ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
@ -324,7 +306,7 @@ const struct {
#endif
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} CompressedPixelStorage2DData[CompressedPixelStorage2DDataCount]{
} CompressedPixelStorage2DData[]{
{"default pixel storage",
Containers::arrayView(CompressedData2D).suffix(16),
#ifndef MAGNUM_TARGET_GLES
@ -342,6 +324,7 @@ const struct {
#endif
};
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
constexpr UnsignedByte Data3D[]{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
@ -350,14 +333,7 @@ constexpr UnsignedByte Data3D[]{
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f };
enum: std::size_t { PixelStorage3DDataCount =
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
2
#else
1
#endif
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
};
const struct {
@ -366,7 +342,7 @@ const struct {
PixelStorage storage;
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} PixelStorage3DData[PixelStorage3DDataCount]{
} PixelStorage3DData[]{
{"default pixel storage",
Containers::arrayView(Data3D).suffix(16), {},
Containers::arrayView(Data3D).suffix(16), 0},
@ -376,6 +352,7 @@ const struct {
Containers::arrayView(Data3D), 16}
#endif
};
#endif
/* Just 4x4x8 0x00 - 0xff compressed using RGBA BPTC Unorm by the driver */
constexpr UnsignedByte CompressedData3D[]{
@ -395,14 +372,6 @@ constexpr UnsignedByte CompressedData3D[]{
84, 253, 73, 34, 109, 100, 91, 251
};
enum: std::size_t { CompressedPixelStorage3DDataCount =
#ifndef MAGNUM_TARGET_GLES
2
#else
1
#endif
};
const struct {
const char* name;
Containers::ArrayView<const UnsignedByte> data;
@ -411,7 +380,7 @@ const struct {
#endif
Containers::ArrayView<const UnsignedByte> dataSparse;
std::size_t offset;
} CompressedPixelStorage3DData[CompressedPixelStorage3DDataCount]{
} CompressedPixelStorage3DData[]{
{"default pixel storage",
Containers::arrayView(CompressedData3D).suffix(16*4),
#ifndef MAGNUM_TARGET_GLES
@ -533,7 +502,7 @@ TextureGLTest::TextureGLTest() {
&TextureGLTest::subImage1DBuffer,
&TextureGLTest::subImage1DQuery,
&TextureGLTest::subImage1DQueryBuffer},
PixelStorage1DDataCount);
Containers::arraySize(PixelStorage1DData));
addTests({&TextureGLTest::compressedImage1D,
&TextureGLTest::compressedImage1DBuffer,
@ -556,7 +525,7 @@ TextureGLTest::TextureGLTest() {
&TextureGLTest::subImage2DQuery,
&TextureGLTest::subImage2DQueryBuffer,
#endif
}, PixelStorage2DDataCount);
}, Containers::arraySize(PixelStorage2DData));
addInstancedTests({
&TextureGLTest::compressedImage2D,
@ -571,7 +540,7 @@ TextureGLTest::TextureGLTest() {
&TextureGLTest::compressedSubImage2DQuery,
&TextureGLTest::compressedSubImage2DQueryBuffer
#endif
}, CompressedPixelStorage2DDataCount);
}, Containers::arraySize(CompressedPixelStorage2DData));
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
addInstancedTests({
@ -587,7 +556,7 @@ TextureGLTest::TextureGLTest() {
&TextureGLTest::subImage3DQuery,
&TextureGLTest::subImage3DQueryBuffer,
#endif
}, PixelStorage3DDataCount);
}, Containers::arraySize(PixelStorage3DData));
addInstancedTests({
&TextureGLTest::compressedImage3D,
@ -602,7 +571,7 @@ TextureGLTest::TextureGLTest() {
&TextureGLTest::compressedSubImage3DQuery,
&TextureGLTest::compressedSubImage3DQueryBuffer
#endif
}, CompressedPixelStorage3DDataCount);
}, Containers::arraySize(CompressedPixelStorage3DData));
#endif
addTests({

Loading…
Cancel
Save