Browse Source

Fixed compilation of tests on ES3.

pull/51/head
Vladimír Vondruš 13 years ago
parent
commit
d2b38b712f
  1. 12
      src/Test/BufferGLTest.cpp
  2. 14
      src/Test/BufferImageGLTest.cpp
  3. 3
      src/Test/CubeMapTextureGLTest.cpp
  4. 36
      src/Test/TextureGLTest.cpp

12
src/Test/BufferGLTest.cpp

@ -197,7 +197,7 @@ void BufferGLTest::data() {
}
void BufferGLTest::map() {
#ifdef MAGNUM_TARGET_GLES2
#ifdef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::OES::mapbuffer>())
CORRADE_SKIP(Extensions::GL::OES::mapbuffer::string() + std::string(" is not supported"));
#endif
@ -206,7 +206,7 @@ void BufferGLTest::map() {
constexpr char data[] = {2, 7, 5, 13, 25};
buffer.setData(data, BufferUsage::StaticDraw);
#ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES
char* contents = reinterpret_cast<char*>(buffer.map(Buffer::MapAccess::ReadWrite));
#else
char* contents = reinterpret_cast<char*>(buffer.map(Buffer::MapAccess::WriteOnly));
@ -254,10 +254,10 @@ void BufferGLTest::mapSub() {
#endif
void BufferGLTest::mapRange() {
#ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::map_buffer_range>())
CORRADE_SKIP(Extensions::GL::ARB::map_buffer_range::string() + std::string(" is not supported"));
#else
#elif defined(MAGNUM_TARGET_GLES2)
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::map_buffer_range>())
CORRADE_SKIP(Extensions::GL::EXT::map_buffer_range::string() + std::string(" is not supported"));
#endif
@ -285,10 +285,10 @@ void BufferGLTest::mapRange() {
}
void BufferGLTest::mapRangeExplicitFlush() {
#ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::map_buffer_range>())
CORRADE_SKIP(Extensions::GL::ARB::map_buffer_range::string() + std::string(" is not supported"));
#else
#elif defined(MAGNUM_TARGET_GLES2)
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::map_buffer_range>())
CORRADE_SKIP(Extensions::GL::EXT::map_buffer_range::string() + std::string(" is not supported"));
#endif

14
src/Test/BufferImageGLTest.cpp

@ -52,16 +52,23 @@ BufferImageTest::BufferImageTest() {
void BufferImageTest::construct() {
const unsigned char data[] = { 'a', 'b', 'c' };
BufferImage2D a(ColorFormat::Red, ColorType::UnsignedByte, {1, 3}, data, BufferUsage::StaticDraw);
#ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data<UnsignedByte>();
#endif
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(a.format(), ColorFormat::Red);
CORRADE_COMPARE(a.type(), ColorType::UnsignedByte);
CORRADE_COMPARE(a.size(), Vector2i(1, 3));
/** @todo How to verify the contents in ES? */
#ifndef MAGNUM_TARGET_GLES
CORRADE_COMPARE_AS(std::vector<UnsignedByte>(imageData.begin(), imageData.end()),
std::vector<UnsignedByte>(data, data + 3),
TestSuite::Compare::Container);
#endif
}
void BufferImageTest::constructCopy() {
@ -113,16 +120,23 @@ void BufferImageTest::setData() {
const unsigned short data2[2*4] = { 1, 2, 3, 4, 5, 6, 7, 8 };
a.setData(ColorFormat::RGBA, ColorType::UnsignedShort, {2, 1}, data2, BufferUsage::StaticDraw);
#ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data<UnsignedShort>();
#endif
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(a.format(), ColorFormat::RGBA);
CORRADE_COMPARE(a.type(), ColorType::UnsignedShort);
CORRADE_COMPARE(a.size(), Vector2i(2, 1));
/** @todo How to verify the contents in ES? */
#ifndef MAGNUM_TARGET_GLES
CORRADE_COMPARE_AS(std::vector<UnsignedShort>(imageData.begin(), imageData.end()),
std::vector<UnsignedShort>(data2, data2 + 8),
TestSuite::Compare::Container);
#endif
}
}}

3
src/Test/CubeMapTextureGLTest.cpp

@ -244,6 +244,8 @@ void CubeMapTextureGLTest::subImageBuffer() {
MAGNUM_VERIFY_NO_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
BufferImage2D image(ColorFormat::RGBA, ColorType::UnsignedByte);
texture.image(CubeMapTexture::Coordinate::PositiveX, 0, image, BufferUsage::StaticRead);
@ -257,6 +259,7 @@ void CubeMapTextureGLTest::subImageBuffer() {
0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}), TestSuite::Compare::Container);
#endif
}
#endif

36
src/Test/TextureGLTest.cpp

@ -701,6 +701,8 @@ void TextureGLTest::storage1DArray() {
MAGNUM_VERIFY_NO_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
CORRADE_COMPARE(texture.imageSize(0), Vector2i(32, 32));
CORRADE_COMPARE(texture.imageSize(1), Vector2i(16, 32));
CORRADE_COMPARE(texture.imageSize(2), Vector2i( 8, 32));
@ -709,6 +711,7 @@ void TextureGLTest::storage1DArray() {
CORRADE_COMPARE(texture.imageSize(5), Vector2i( 0, 0)); /* not available */
MAGNUM_VERIFY_NO_ERROR();
#endif
}
#endif
@ -724,6 +727,8 @@ void TextureGLTest::storage2DArray() {
MAGNUM_VERIFY_NO_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
CORRADE_COMPARE(texture.imageSize(0), Vector3i(32, 32, 32));
CORRADE_COMPARE(texture.imageSize(1), Vector3i(16, 16, 32));
CORRADE_COMPARE(texture.imageSize(2), Vector3i( 8, 8, 32));
@ -732,6 +737,7 @@ void TextureGLTest::storage2DArray() {
CORRADE_COMPARE(texture.imageSize(5), Vector3i( 0, 0, 0)); /* not available */
MAGNUM_VERIFY_NO_ERROR();
#endif
}
#endif
@ -843,6 +849,8 @@ void TextureGLTest::image2DBuffer() {
MAGNUM_VERIFY_NO_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
BufferImage2D image(ColorFormat::RGBA, ColorType::UnsignedByte);
texture.image(0, image, BufferUsage::StaticRead);
const auto imageData = image.buffer().data<UnsignedByte>();
@ -852,6 +860,7 @@ void TextureGLTest::image2DBuffer() {
CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(std::vector<UnsignedByte>(imageData.begin(), imageData.end()),
std::vector<UnsignedByte>(data, data + 16), TestSuite::Compare::Container);
#endif
}
#endif
@ -904,6 +913,8 @@ void TextureGLTest::image3DBuffer() {
MAGNUM_VERIFY_NO_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
BufferImage3D image(ColorFormat::RGBA, ColorType::UnsignedByte);
texture.image(0, image, BufferUsage::StaticRead);
const auto imageData = image.buffer().data<UnsignedByte>();
@ -913,6 +924,7 @@ void TextureGLTest::image3DBuffer() {
CORRADE_COMPARE(image.size(), Vector3i(2));
CORRADE_COMPARE_AS(std::vector<UnsignedByte>(imageData.begin(), imageData.end()),
std::vector<UnsignedByte>(data, data + 32), TestSuite::Compare::Container);
#endif
}
#endif
@ -988,6 +1000,8 @@ void TextureGLTest::image2DArray() {
MAGNUM_VERIFY_NO_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
Image3D image(ColorFormat::RGBA, ColorType::UnsignedByte);
texture.image(0, image);
@ -996,6 +1010,7 @@ void TextureGLTest::image2DArray() {
CORRADE_COMPARE(image.size(), Vector3i(2));
CORRADE_COMPARE_AS(std::vector<UnsignedByte>(image.data(), image.data()+image.pixelSize()*image.size().product()),
std::vector<UnsignedByte>(data, data + 32), TestSuite::Compare::Container);
#endif
}
void TextureGLTest::image2DArrayBuffer() {
@ -1018,6 +1033,8 @@ void TextureGLTest::image2DArrayBuffer() {
MAGNUM_VERIFY_NO_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
BufferImage3D image(ColorFormat::RGBA, ColorType::UnsignedByte);
texture.image(0, image, BufferUsage::StaticRead);
const auto imageData = image.buffer().data<UnsignedByte>();
@ -1027,6 +1044,7 @@ void TextureGLTest::image2DArrayBuffer() {
CORRADE_COMPARE(image.size(), Vector3i(2));
CORRADE_COMPARE_AS(std::vector<UnsignedByte>(imageData.begin(), imageData.end()),
std::vector<UnsignedByte>(data, data + 32), TestSuite::Compare::Container);
#endif
}
#endif
@ -1204,6 +1222,8 @@ void TextureGLTest::subImage2DBuffer() {
MAGNUM_VERIFY_NO_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
BufferImage2D image(ColorFormat::RGBA, ColorType::UnsignedByte);
texture.image(0, image, BufferUsage::StaticRead);
const auto imageData = image.buffer().data<UnsignedByte>();
@ -1217,6 +1237,7 @@ void TextureGLTest::subImage2DBuffer() {
0, 0, 0, 0, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}), TestSuite::Compare::Container);
#endif
}
#endif
@ -1294,6 +1315,8 @@ void TextureGLTest::subImage3DBuffer() {
MAGNUM_VERIFY_NO_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
BufferImage3D image(ColorFormat::RGBA, ColorType::UnsignedByte);
texture.image(0, image, BufferUsage::StaticRead);
const auto imageData = image.buffer().data<UnsignedByte>();
@ -1322,6 +1345,7 @@ void TextureGLTest::subImage3DBuffer() {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}), TestSuite::Compare::Container);
#endif
}
#endif
@ -1414,6 +1438,8 @@ void TextureGLTest::subImage2DArray() {
MAGNUM_VERIFY_NO_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
Image3D image(ColorFormat::RGBA, ColorType::UnsignedByte);
texture.image(0, image);
@ -1441,6 +1467,7 @@ void TextureGLTest::subImage2DArray() {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}), TestSuite::Compare::Container);
#endif
}
void TextureGLTest::subImage2DArrayBuffer() {
@ -1466,6 +1493,8 @@ void TextureGLTest::subImage2DArrayBuffer() {
MAGNUM_VERIFY_NO_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
BufferImage3D image(ColorFormat::RGBA, ColorType::UnsignedByte);
texture.image(0, image, BufferUsage::StaticRead);
const auto imageData = image.buffer().data<UnsignedByte>();
@ -1494,6 +1523,7 @@ void TextureGLTest::subImage2DArrayBuffer() {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}), TestSuite::Compare::Container);
#endif
}
#endif
@ -1713,13 +1743,18 @@ void TextureGLTest::generateMipmap2DArray() {
texture.setImage(0, TextureFormat::RGBA8,
ImageReference3D(ColorFormat::RGBA, ColorType::UnsignedByte, Vector3i(32)));
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
CORRADE_COMPARE(texture.imageSize(0), Vector3i(32));
CORRADE_COMPARE(texture.imageSize(1), Vector3i( 0));
#endif
texture.generateMipmap();
MAGNUM_VERIFY_NO_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
CORRADE_COMPARE(texture.imageSize(0), Vector3i(32, 32, 32));
CORRADE_COMPARE(texture.imageSize(1), Vector3i(16, 16, 32));
CORRADE_COMPARE(texture.imageSize(2), Vector3i( 8, 8, 32));
@ -1728,6 +1763,7 @@ void TextureGLTest::generateMipmap2DArray() {
CORRADE_COMPARE(texture.imageSize(5), Vector3i( 1, 1, 32));
MAGNUM_VERIFY_NO_ERROR();
#endif
}
#endif

Loading…
Cancel
Save