Browse Source

GL,Text: verify buffer contents on GLES3

gltestlib-symbol-duplication
Pablo Escobar 4 years ago committed by Vladimír Vondruš
parent
commit
8090013e0a
  1. 53
      src/Magnum/GL/Test/BufferGLTest.cpp
  2. 112
      src/Magnum/GL/Test/BufferImageGLTest.cpp
  3. 16
      src/Magnum/GL/Test/CMakeLists.txt
  4. 10
      src/Magnum/GL/Test/FramebufferGLTest.cpp
  5. 77
      src/Magnum/GL/Test/TransformFeedbackGLTest.cpp
  6. 3
      src/Magnum/Text/Test/CMakeLists.txt
  7. 35
      src/Magnum/Text/Test/RendererGLTest.cpp

53
src/Magnum/GL/Test/BufferGLTest.cpp

@ -34,6 +34,10 @@
#include "Magnum/GL/Extensions.h" #include "Magnum/GL/Extensions.h"
#include "Magnum/GL/OpenGLTester.h" #include "Magnum/GL/OpenGLTester.h"
#ifndef MAGNUM_TARGET_GLES2
#include "Magnum/DebugTools/BufferData.h"
#endif
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
#include <Corrade/Containers/String.h> #include <Corrade/Containers/String.h>
#endif #endif
@ -138,15 +142,14 @@ void BufferGLTest::constructFromData() {
CORRADE_COMPARE(c.size(), 5*4); CORRADE_COMPARE(c.size(), 5*4);
CORRADE_COMPARE(d.size(), 5*4); CORRADE_COMPARE(d.size(), 5*4);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES CORRADE_COMPARE_AS(Containers::arrayCast<Int>(DebugTools::bufferData(a)),
CORRADE_COMPARE_AS(Containers::arrayCast<Int>(a.data()),
Containers::arrayView(data), Containers::arrayView(data),
TestSuite::Compare::Container); TestSuite::Compare::Container);
CORRADE_COMPARE_AS(Containers::arrayCast<Int>(b.data()), CORRADE_COMPARE_AS(Containers::arrayCast<Int>(DebugTools::bufferData(b)),
Containers::arrayView(data), Containers::arrayView(data),
TestSuite::Compare::Container); TestSuite::Compare::Container);
CORRADE_COMPARE_AS(Containers::arrayCast<Int>(c.data()), CORRADE_COMPARE_AS(Containers::arrayCast<Int>(DebugTools::bufferData(c)),
Containers::arrayView(data), Containers::arrayView(data),
TestSuite::Compare::Container); TestSuite::Compare::Container);
/* d's data is undefined, not testing */ /* d's data is undefined, not testing */
@ -307,10 +310,9 @@ void BufferGLTest::data() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(buffer.size(), 5*4); CORRADE_COMPARE(buffer.size(), 5*4);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(Containers::arrayCast<Int>(buffer.data()), CORRADE_COMPARE_AS(Containers::arrayCast<Int>(DebugTools::bufferData(buffer)),
Containers::arrayView(data), Containers::arrayView(data),
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -320,10 +322,9 @@ void BufferGLTest::data() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(buffer.size(), 5*4); CORRADE_COMPARE(buffer.size(), 5*4);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(Containers::arrayCast<Int>(buffer.data()), CORRADE_COMPARE_AS(Containers::arrayCast<Int>(DebugTools::bufferData(buffer)),
Containers::arrayView(data), Containers::arrayView(data),
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -334,10 +335,9 @@ void BufferGLTest::data() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(buffer.size(), 5*4); CORRADE_COMPARE(buffer.size(), 5*4);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(Containers::arrayCast<Int>(buffer.subData(4, 3*4)), CORRADE_COMPARE_AS(Containers::arrayCast<Int>(DebugTools::bufferSubData(buffer, 4, 3*4)),
Containers::arrayView(subData), Containers::arrayView(subData),
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -347,10 +347,9 @@ void BufferGLTest::data() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(buffer.size(), 5*4); CORRADE_COMPARE(buffer.size(), 5*4);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(Containers::arrayCast<Int>(buffer.subData(4, 3*4)), CORRADE_COMPARE_AS(Containers::arrayCast<Int>(DebugTools::bufferSubData(buffer, 4, 3*4)),
Containers::arrayView(subData), Containers::arrayView(subData),
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -385,9 +384,8 @@ void BufferGLTest::map() {
CORRADE_VERIFY(buffer.unmap()); CORRADE_VERIFY(buffer.unmap());
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES Containers::Array<char> changedContents = DebugTools::bufferData(buffer);
Containers::Array<char> changedContents = buffer.data();
CORRADE_COMPARE(changedContents.size(), 5); CORRADE_COMPARE(changedContents.size(), 5);
CORRADE_COMPARE(changedContents[3], 107); CORRADE_COMPARE(changedContents[3], 107);
#endif #endif
@ -417,9 +415,8 @@ void BufferGLTest::mapRange() {
CORRADE_VERIFY(buffer.unmap()); CORRADE_VERIFY(buffer.unmap());
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES Containers::Array<char> changedContents = DebugTools::bufferData(buffer);
Containers::Array<char> changedContents = buffer.data();
CORRADE_COMPARE(changedContents.size(), 5); CORRADE_COMPARE(changedContents.size(), 5);
CORRADE_COMPARE(changedContents[4], 107); CORRADE_COMPARE(changedContents[4], 107);
#endif #endif
@ -457,9 +454,8 @@ void BufferGLTest::mapRangeExplicitFlush() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
/* Flushed range should be changed */ /* Flushed range should be changed */
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES Containers::Array<char> changedContents = DebugTools::bufferData(buffer);
Containers::Array<char> changedContents = buffer.data();
CORRADE_COMPARE(changedContents.size(), 5); CORRADE_COMPARE(changedContents.size(), 5);
CORRADE_COMPARE(changedContents[4], 107); CORRADE_COMPARE(changedContents[4], 107);
#endif #endif
@ -478,9 +474,8 @@ void BufferGLTest::copy() {
Buffer::copy(buffer1, buffer2, 1, 2, 3); Buffer::copy(buffer1, buffer2, 1, 2, 3);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES const Containers::Array<char> subContents = DebugTools::bufferSubData(buffer2, 2, 3);
const Containers::Array<char> subContents = buffer2.subData(2, 3);
CORRADE_COMPARE_AS(subContents, Containers::arrayView(data).slice(1, 4), CORRADE_COMPARE_AS(subContents, Containers::arrayView(data).slice(1, 4),
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif

112
src/Magnum/GL/Test/BufferImageGLTest.cpp

@ -33,6 +33,10 @@
#include "Magnum/GL/PixelFormat.h" #include "Magnum/GL/PixelFormat.h"
#include "Magnum/GL/OpenGLTester.h" #include "Magnum/GL/OpenGLTester.h"
#ifndef MAGNUM_TARGET_GLES2
#include "Magnum/DebugTools/BufferData.h"
#endif
namespace Magnum { namespace GL { namespace Test { namespace { namespace Magnum { namespace GL { namespace Test { namespace {
struct BufferImageGLTest: OpenGLTester { struct BufferImageGLTest: OpenGLTester {
@ -98,10 +102,6 @@ void BufferImageGLTest::construct() {
BufferImage2D a{PixelStorage{}.setAlignment(1), BufferImage2D a{PixelStorage{}.setAlignment(1),
PixelFormat::Red, PixelType::UnsignedByte, {1, 3}, data, BufferUsage::StaticDraw}; PixelFormat::Red, PixelType::UnsignedByte, {1, 3}, data, BufferUsage::StaticDraw};
#ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(a.storage().alignment(), 1); CORRADE_COMPARE(a.storage().alignment(), 1);
@ -110,8 +110,9 @@ void BufferImageGLTest::construct() {
CORRADE_COMPARE(a.size(), Vector2i(1, 3)); CORRADE_COMPARE(a.size(), Vector2i(1, 3));
CORRADE_COMPARE(a.dataSize(), 3); CORRADE_COMPARE(a.dataSize(), 3);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES const auto imageData = DebugTools::bufferData(a.buffer());
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(imageData, Containers::arrayView(data), CORRADE_COMPARE_AS(imageData, Containers::arrayView(data),
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -122,10 +123,6 @@ void BufferImageGLTest::constructGeneric() {
BufferImage2D a{PixelStorage{}.setAlignment(1), BufferImage2D a{PixelStorage{}.setAlignment(1),
Magnum::PixelFormat::R8Unorm, {1, 3}, data, BufferUsage::StaticDraw}; Magnum::PixelFormat::R8Unorm, {1, 3}, data, BufferUsage::StaticDraw};
#ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(a.storage().alignment(), 1); CORRADE_COMPARE(a.storage().alignment(), 1);
@ -134,8 +131,9 @@ void BufferImageGLTest::constructGeneric() {
CORRADE_COMPARE(a.size(), Vector2i(1, 3)); CORRADE_COMPARE(a.size(), Vector2i(1, 3));
CORRADE_COMPARE(a.dataSize(), 3); CORRADE_COMPARE(a.dataSize(), 3);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES const auto imageData = DebugTools::bufferData(a.buffer());
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(imageData, Containers::arrayView(data), CORRADE_COMPARE_AS(imageData, Containers::arrayView(data),
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -150,10 +148,6 @@ void BufferImageGLTest::constructCompressed() {
CompressedPixelFormat::RGBAS3tcDxt1, CompressedPixelFormat::RGBAS3tcDxt1,
{4, 4}, data, BufferUsage::StaticDraw}; {4, 4}, data, BufferUsage::StaticDraw};
#ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -163,8 +157,9 @@ void BufferImageGLTest::constructCompressed() {
CORRADE_COMPARE(a.size(), Vector2i(4, 4)); CORRADE_COMPARE(a.size(), Vector2i(4, 4));
CORRADE_COMPARE(a.dataSize(), 8); CORRADE_COMPARE(a.dataSize(), 8);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES const auto imageData = DebugTools::bufferData(a.buffer());
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(imageData, Containers::arrayView(data), CORRADE_COMPARE_AS(imageData, Containers::arrayView(data),
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -179,10 +174,6 @@ void BufferImageGLTest::constructCompressedGeneric() {
Magnum::CompressedPixelFormat::Bc1RGBAUnorm, Magnum::CompressedPixelFormat::Bc1RGBAUnorm,
{4, 4}, data, BufferUsage::StaticDraw}; {4, 4}, data, BufferUsage::StaticDraw};
#ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -192,8 +183,9 @@ void BufferImageGLTest::constructCompressedGeneric() {
CORRADE_COMPARE(a.size(), Vector2i(4, 4)); CORRADE_COMPARE(a.size(), Vector2i(4, 4));
CORRADE_COMPARE(a.dataSize(), 8); CORRADE_COMPARE(a.dataSize(), 8);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES const auto imageData = DebugTools::bufferData(a.buffer());
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(imageData, Containers::arrayView(data), CORRADE_COMPARE_AS(imageData, Containers::arrayView(data),
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -208,10 +200,6 @@ void BufferImageGLTest::constructBuffer() {
BufferImage2D a{PixelStorage{}.setAlignment(1), BufferImage2D a{PixelStorage{}.setAlignment(1),
PixelFormat::Red, PixelType::UnsignedByte, {1, 3}, std::move(buffer), sizeof(data)}; PixelFormat::Red, PixelType::UnsignedByte, {1, 3}, std::move(buffer), sizeof(data)};
#ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(!buffer.id()); CORRADE_VERIFY(!buffer.id());
@ -222,8 +210,9 @@ void BufferImageGLTest::constructBuffer() {
CORRADE_COMPARE(a.size(), Vector2i(1, 3)); CORRADE_COMPARE(a.size(), Vector2i(1, 3));
CORRADE_COMPARE(a.dataSize(), 3); CORRADE_COMPARE(a.dataSize(), 3);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES const auto imageData = DebugTools::bufferData(a.buffer());
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(imageData, Containers::arrayView(data), CORRADE_COMPARE_AS(imageData, Containers::arrayView(data),
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -238,10 +227,6 @@ void BufferImageGLTest::constructBufferGeneric() {
BufferImage2D a{PixelStorage{}.setAlignment(1), BufferImage2D a{PixelStorage{}.setAlignment(1),
Magnum::PixelFormat::R8Unorm, {1, 3}, std::move(buffer), sizeof(data)}; Magnum::PixelFormat::R8Unorm, {1, 3}, std::move(buffer), sizeof(data)};
#ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(!buffer.id()); CORRADE_VERIFY(!buffer.id());
@ -252,8 +237,9 @@ void BufferImageGLTest::constructBufferGeneric() {
CORRADE_COMPARE(a.size(), Vector2i(1, 3)); CORRADE_COMPARE(a.size(), Vector2i(1, 3));
CORRADE_COMPARE(a.dataSize(), 3); CORRADE_COMPARE(a.dataSize(), 3);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES const auto imageData = DebugTools::bufferData(a.buffer());
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(imageData, Containers::arrayView(data), CORRADE_COMPARE_AS(imageData, Containers::arrayView(data),
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -272,10 +258,6 @@ void BufferImageGLTest::constructBufferCompressed() {
CompressedPixelFormat::RGBAS3tcDxt1, CompressedPixelFormat::RGBAS3tcDxt1,
{4, 4}, std::move(buffer), sizeof(data)}; {4, 4}, std::move(buffer), sizeof(data)};
#ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -287,8 +269,9 @@ void BufferImageGLTest::constructBufferCompressed() {
CORRADE_COMPARE(a.size(), Vector2i(4, 4)); CORRADE_COMPARE(a.size(), Vector2i(4, 4));
CORRADE_COMPARE(a.dataSize(), 8); CORRADE_COMPARE(a.dataSize(), 8);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES const auto imageData = DebugTools::bufferData(a.buffer());
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(imageData, Containers::arrayView(data), CORRADE_COMPARE_AS(imageData, Containers::arrayView(data),
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -307,10 +290,6 @@ void BufferImageGLTest::constructBufferCompressedGeneric() {
Magnum::CompressedPixelFormat::Bc1RGBAUnorm, Magnum::CompressedPixelFormat::Bc1RGBAUnorm,
{4, 4}, std::move(buffer), sizeof(data)}; {4, 4}, std::move(buffer), sizeof(data)};
#ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -322,8 +301,9 @@ void BufferImageGLTest::constructBufferCompressedGeneric() {
CORRADE_COMPARE(a.size(), Vector2i(4, 4)); CORRADE_COMPARE(a.size(), Vector2i(4, 4));
CORRADE_COMPARE(a.dataSize(), 8); CORRADE_COMPARE(a.dataSize(), 8);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES const auto imageData = DebugTools::bufferData(a.buffer());
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(imageData, Containers::arrayView(data), CORRADE_COMPARE_AS(imageData, Containers::arrayView(data),
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -487,10 +467,6 @@ void BufferImageGLTest::setData() {
const UnsignedShort data2[2*4] = { 1, 2, 3, 4, 5, 6, 7, 8 }; const UnsignedShort data2[2*4] = { 1, 2, 3, 4, 5, 6, 7, 8 };
a.setData(PixelFormat::RGBA, PixelType::UnsignedShort, {1, 2}, data2, BufferUsage::StaticDraw); a.setData(PixelFormat::RGBA, PixelType::UnsignedShort, {1, 2}, data2, BufferUsage::StaticDraw);
#ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(a.storage().alignment(), 4); CORRADE_COMPARE(a.storage().alignment(), 4);
@ -499,8 +475,9 @@ void BufferImageGLTest::setData() {
CORRADE_COMPARE(a.size(), Vector2i(1, 2)); CORRADE_COMPARE(a.size(), Vector2i(1, 2));
CORRADE_COMPARE(a.dataSize(), 16); CORRADE_COMPARE(a.dataSize(), 16);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES const auto imageData = DebugTools::bufferData(a.buffer());
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedShort>(imageData), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedShort>(imageData),
Containers::arrayView(data2), Containers::arrayView(data2),
TestSuite::Compare::Container); TestSuite::Compare::Container);
@ -515,10 +492,6 @@ void BufferImageGLTest::setDataGeneric() {
const UnsignedShort data2[2*4] = { 1, 2, 3, 4, 5, 6, 7, 8 }; const UnsignedShort data2[2*4] = { 1, 2, 3, 4, 5, 6, 7, 8 };
a.setData(Magnum::PixelFormat::RGBA16Unorm, {1, 2}, data2, BufferUsage::StaticDraw); a.setData(Magnum::PixelFormat::RGBA16Unorm, {1, 2}, data2, BufferUsage::StaticDraw);
#ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(a.storage().alignment(), 4); CORRADE_COMPARE(a.storage().alignment(), 4);
@ -527,8 +500,9 @@ void BufferImageGLTest::setDataGeneric() {
CORRADE_COMPARE(a.size(), Vector2i(1, 2)); CORRADE_COMPARE(a.size(), Vector2i(1, 2));
CORRADE_COMPARE(a.dataSize(), 16); CORRADE_COMPARE(a.dataSize(), 16);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES const auto imageData = DebugTools::bufferData(a.buffer());
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedShort>(imageData), CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedShort>(imageData),
Containers::arrayView(data2), Containers::arrayView(data2),
TestSuite::Compare::Container); TestSuite::Compare::Container);
@ -546,10 +520,6 @@ void BufferImageGLTest::setDataCompressed() {
#endif #endif
CompressedPixelFormat::RGBAS3tcDxt3, {8, 4}, data2, BufferUsage::StaticDraw); CompressedPixelFormat::RGBAS3tcDxt3, {8, 4}, data2, BufferUsage::StaticDraw);
#ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -559,8 +529,9 @@ void BufferImageGLTest::setDataCompressed() {
CORRADE_COMPARE(a.size(), Vector2i(8, 4)); CORRADE_COMPARE(a.size(), Vector2i(8, 4));
CORRADE_COMPARE(a.dataSize(), 16); CORRADE_COMPARE(a.dataSize(), 16);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES const auto imageData = DebugTools::bufferData(a.buffer());
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(imageData, Containers::arrayView(data2), CORRADE_COMPARE_AS(imageData, Containers::arrayView(data2),
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif
@ -577,10 +548,6 @@ void BufferImageGLTest::setDataCompressedGeneric() {
#endif #endif
Magnum::CompressedPixelFormat::Bc2RGBAUnorm, {8, 4}, data2, BufferUsage::StaticDraw); Magnum::CompressedPixelFormat::Bc2RGBAUnorm, {8, 4}, data2, BufferUsage::StaticDraw);
#ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
@ -590,8 +557,9 @@ void BufferImageGLTest::setDataCompressedGeneric() {
CORRADE_COMPARE(a.size(), Vector2i(8, 4)); CORRADE_COMPARE(a.size(), Vector2i(8, 4));
CORRADE_COMPARE(a.dataSize(), 16); CORRADE_COMPARE(a.dataSize(), 16);
/** @todo How to verify the contents in ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES const auto imageData = DebugTools::bufferData(a.buffer());
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(imageData, Containers::arrayView(data2), CORRADE_COMPARE_AS(imageData, Containers::arrayView(data2),
TestSuite::Compare::Container); TestSuite::Compare::Container);
#endif #endif

16
src/Magnum/GL/Test/CMakeLists.txt

@ -75,9 +75,7 @@ if(BUILD_GL_TESTS)
find_package(Corrade REQUIRED PluginManager) find_package(Corrade REQUIRED PluginManager)
corrade_add_test(GLAbstractTextureGLTest AbstractTextureGLTest.cpp LIBRARIES MagnumOpenGLTesterTestLib) corrade_add_test(GLAbstractTextureGLTest AbstractTextureGLTest.cpp LIBRARIES MagnumOpenGLTesterTestLib)
corrade_add_test(GLBufferGLTest BufferGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(GLCubeMapTextureGLTest CubeMapTextureGLTest.cpp LIBRARIES MagnumOpenGLTesterTestLib) corrade_add_test(GLCubeMapTextureGLTest CubeMapTextureGLTest.cpp LIBRARIES MagnumOpenGLTesterTestLib)
corrade_add_test(GLFramebufferGLTest FramebufferGLTest.cpp LIBRARIES MagnumOpenGLTesterTestLib)
corrade_add_test(GLMeshGLTest MeshGLTest.cpp LIBRARIES MagnumOpenGLTesterTestLib) corrade_add_test(GLMeshGLTest MeshGLTest.cpp LIBRARIES MagnumOpenGLTesterTestLib)
corrade_add_test(GLRenderbufferGLTest RenderbufferGLTest.cpp LIBRARIES MagnumOpenGLTester) corrade_add_test(GLRenderbufferGLTest RenderbufferGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(GLTextureGLTest TextureGLTest.cpp LIBRARIES MagnumOpenGLTesterTestLib) corrade_add_test(GLTextureGLTest TextureGLTest.cpp LIBRARIES MagnumOpenGLTesterTestLib)
@ -89,6 +87,16 @@ if(BUILD_GL_TESTS)
${GLAbstractShaderProgramGLTest_RES} ${GLAbstractShaderProgramGLTest_RES}
LIBRARIES MagnumOpenGLTester) LIBRARIES MagnumOpenGLTester)
corrade_add_test(GLBufferGLTest BufferGLTest.cpp LIBRARIES MagnumOpenGLTester)
if(NOT MAGNUM_TARGET_GLES2)
target_link_libraries(GLBufferGLTest PRIVATE MagnumDebugTools)
endif()
corrade_add_test(GLFramebufferGLTest FramebufferGLTest.cpp LIBRARIES MagnumOpenGLTesterTestLib)
if(NOT MAGNUM_TARGET_GLES2)
target_link_libraries(GLFramebufferGLTest PRIVATE MagnumDebugTools)
endif()
corrade_add_test(GLContextGLTest ContextGLTest.cpp LIBRARIES MagnumOpenGLTester) corrade_add_test(GLContextGLTest ContextGLTest.cpp LIBRARIES MagnumOpenGLTester)
if(NOT CORRADE_TARGET_EMSCRIPTEN) if(NOT CORRADE_TARGET_EMSCRIPTEN)
set(THREADS_PREFER_PTHREAD_FLAG TRUE) set(THREADS_PREFER_PTHREAD_FLAG TRUE)
@ -162,10 +170,10 @@ if(BUILD_GL_TESTS)
endif() endif()
if(NOT MAGNUM_TARGET_GLES2) if(NOT MAGNUM_TARGET_GLES2)
corrade_add_test(GLBufferImageGLTest BufferImageGLTest.cpp LIBRARIES MagnumOpenGLTesterTestLib) corrade_add_test(GLBufferImageGLTest BufferImageGLTest.cpp LIBRARIES MagnumOpenGLTesterTestLib MagnumDebugTools)
corrade_add_test(GLPrimitiveQueryGLTest PrimitiveQueryGLTest.cpp LIBRARIES MagnumOpenGLTester) corrade_add_test(GLPrimitiveQueryGLTest PrimitiveQueryGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(GLTextureArrayGLTest TextureArrayGLTest.cpp LIBRARIES MagnumOpenGLTester) corrade_add_test(GLTextureArrayGLTest TextureArrayGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(GLTransformFeedbackGLTest TransformFeedbackGLTest.cpp LIBRARIES MagnumOpenGLTester) corrade_add_test(GLTransformFeedbackGLTest TransformFeedbackGLTest.cpp LIBRARIES MagnumOpenGLTester MagnumDebugTools)
endif() endif()
if(NOT MAGNUM_TARGET_GLES2 AND NOT MAGNUM_TARGET_WEBGL) if(NOT MAGNUM_TARGET_GLES2 AND NOT MAGNUM_TARGET_WEBGL)

10
src/Magnum/GL/Test/FramebufferGLTest.cpp

@ -58,6 +58,10 @@
#include "Magnum/GL/RectangleTexture.h" #include "Magnum/GL/RectangleTexture.h"
#endif #endif
#ifndef MAGNUM_TARGET_GLES2
#include "Magnum/DebugTools/BufferData.h"
#endif
namespace Magnum { namespace GL { namespace Test { namespace { namespace Magnum { namespace GL { namespace Test { namespace {
struct FramebufferGLTest: OpenGLTester { struct FramebufferGLTest: OpenGLTester {
@ -1742,9 +1746,9 @@ void FramebufferGLTest::readBuffer() {
CORRADE_COMPARE(colorImage.size(), Vector2i(8, 16)); CORRADE_COMPARE(colorImage.size(), Vector2i(8, 16));
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
auto colorData = colorImage.buffer().data(); auto colorData = DebugTools::bufferData(colorImage.buffer());
CORRADE_COMPARE(colorData.size(), (DataOffset + 8*16)*sizeof(Color4ub)); CORRADE_COMPARE(colorData.size(), (DataOffset + 8*16)*sizeof(Color4ub));
CORRADE_COMPARE(Containers::arrayCast<Color4ub>(colorData)[DataOffset], Color4ub(128, 64, 32, 17)); CORRADE_COMPARE(Containers::arrayCast<Color4ub>(colorData)[DataOffset], Color4ub(128, 64, 32, 17));
#endif #endif

77
src/Magnum/GL/Test/TransformFeedbackGLTest.cpp

@ -24,8 +24,11 @@
*/ */
#include <tuple> #include <tuple>
#include <Corrade/Containers/Array.h>
#include <Corrade/Containers/Reference.h> #include <Corrade/Containers/Reference.h>
#include <Corrade/TestSuite/Compare/Container.h>
#include "Magnum/DebugTools/BufferData.h"
#include "Magnum/Image.h" #include "Magnum/Image.h"
#include "Magnum/GL/AbstractShaderProgram.h" #include "Magnum/GL/AbstractShaderProgram.h"
#include "Magnum/GL/Buffer.h" #include "Magnum/GL/Buffer.h"
@ -307,14 +310,11 @@ void TransformFeedbackGLTest::attachBase() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
#ifdef MAGNUM_TARGET_WEBGL auto data = DebugTools::bufferData(output);
CORRADE_SKIP("Can't map buffers on WebGL."); MAGNUM_VERIFY_NO_GL_ERROR();
#else CORRADE_COMPARE_AS(Containers::arrayCast<Vector2>(data),
auto data = Containers::arrayCast<const Vector2>(output.mapRead(0, 2*sizeof(Vector2))); Containers::arrayView<Vector2>({{1.0f, -1.0f}, {0.0f, 0.0f}}),
CORRADE_COMPARE(data[0], Vector2(1.0f, -1.0f)); TestSuite::Compare::Container);
CORRADE_COMPARE(data[1], Vector2(0.0f, 0.0f));
output.unmap();
#endif
} }
void TransformFeedbackGLTest::attachRange() { void TransformFeedbackGLTest::attachRange() {
@ -354,14 +354,11 @@ void TransformFeedbackGLTest::attachRange() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
#ifdef MAGNUM_TARGET_WEBGL auto data = DebugTools::bufferSubData(output, 256, 2*sizeof(Vector2));
CORRADE_SKIP("Can't map buffers on WebGL."); MAGNUM_VERIFY_NO_GL_ERROR();
#else CORRADE_COMPARE_AS(Containers::arrayCast<Vector2>(data),
auto data = Containers::arrayCast<const Vector2>(output.mapRead(256, 2*sizeof(Vector2))); Containers::arrayView<Vector2>({{1.0f, -1.0f}, {0.0f, 0.0f}}),
CORRADE_COMPARE(data[0], Vector2(1.0f, -1.0f)); TestSuite::Compare::Container);
CORRADE_COMPARE(data[1], Vector2(0.0f, 0.0f));
output.unmap();
#endif
} }
struct XfbMultiShader: AbstractShaderProgram { struct XfbMultiShader: AbstractShaderProgram {
@ -445,19 +442,17 @@ void TransformFeedbackGLTest::attachBases() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
#ifdef MAGNUM_TARGET_WEBGL auto data1 = DebugTools::bufferData(output1);
CORRADE_SKIP("Can't map buffers on WebGL."); MAGNUM_VERIFY_NO_GL_ERROR();
#else CORRADE_COMPARE_AS(Containers::arrayCast<Vector2>(data1),
auto data1 = Containers::arrayCast<const Vector2>(output1.mapRead(0, 2*sizeof(Vector2))); Containers::arrayView<Vector2>({{1.0f, -1.0f}, {0.0f, 0.0f}}),
CORRADE_COMPARE(data1[0], Vector2(1.0f, -1.0f)); TestSuite::Compare::Container);
CORRADE_COMPARE(data1[1], Vector2(0.0f, 0.0f));
output1.unmap(); auto data2 = DebugTools::bufferData(output2);
MAGNUM_VERIFY_NO_GL_ERROR();
auto data2 = Containers::arrayCast<const Float>(output2.mapRead(0, 2*sizeof(Float))); CORRADE_COMPARE_AS(Containers::arrayCast<Float>(data2),
CORRADE_COMPARE(data2[0], 0.0f); Containers::arrayView({0.0f, -2.0f}),
CORRADE_COMPARE(data2[1], -2.0f); TestSuite::Compare::Container);
output2.unmap();
#endif
} }
void TransformFeedbackGLTest::attachRanges() { void TransformFeedbackGLTest::attachRanges() {
@ -502,19 +497,17 @@ void TransformFeedbackGLTest::attachRanges() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
#ifdef MAGNUM_TARGET_WEBGL auto data1 = DebugTools::bufferSubData(output1, 256, 2*sizeof(Vector2));
CORRADE_SKIP("Can't map buffers on WebGL."); MAGNUM_VERIFY_NO_GL_ERROR();
#else CORRADE_COMPARE_AS(Containers::arrayCast<Vector2>(data1),
auto data1 = Containers::arrayCast<const Vector2>(output1.mapRead(256, 2*sizeof(Vector2))); Containers::arrayView<Vector2>({{1.0f, -1.0f}, {0.0f, 0.0f}}),
CORRADE_COMPARE(data1[0], Vector2(1.0f, -1.0f)); TestSuite::Compare::Container);
CORRADE_COMPARE(data1[1], Vector2(0.0f, 0.0f));
output1.unmap(); auto data2 = DebugTools::bufferSubData(output2, 512, 2*sizeof(Float));
MAGNUM_VERIFY_NO_GL_ERROR();
auto data2 = Containers::arrayCast<const Float>(output2.mapRead(512, 2*sizeof(Float))); CORRADE_COMPARE_AS(Containers::arrayCast<Float>(data2),
CORRADE_COMPARE(data2[0], 0.0f); Containers::arrayView({0.0f, -2.0f}),
CORRADE_COMPARE(data2[1], -2.0f); TestSuite::Compare::Container);
output2.unmap();
#endif
} }
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES

3
src/Magnum/Text/Test/CMakeLists.txt

@ -53,4 +53,7 @@ if(TARGET_GL AND BUILD_GL_TESTS)
corrade_add_test(TextDistanceFieldGlyphCacheGLTest DistanceFieldGlyphCacheGLTest.cpp LIBRARIES MagnumText MagnumOpenGLTester) corrade_add_test(TextDistanceFieldGlyphCacheGLTest DistanceFieldGlyphCacheGLTest.cpp LIBRARIES MagnumText MagnumOpenGLTester)
corrade_add_test(TextGlyphCacheGLTest GlyphCacheGLTest.cpp LIBRARIES MagnumText MagnumOpenGLTester) corrade_add_test(TextGlyphCacheGLTest GlyphCacheGLTest.cpp LIBRARIES MagnumText MagnumOpenGLTester)
corrade_add_test(TextRendererGLTest RendererGLTest.cpp LIBRARIES MagnumText MagnumOpenGLTester) corrade_add_test(TextRendererGLTest RendererGLTest.cpp LIBRARIES MagnumText MagnumOpenGLTester)
if(NOT MAGNUM_TARGET_GLES2)
target_link_libraries(TextRendererGLTest PRIVATE MagnumDebugTools)
endif()
endif() endif()

35
src/Magnum/Text/Test/RendererGLTest.cpp

@ -32,6 +32,10 @@
#include "Magnum/Text/AbstractFont.h" #include "Magnum/Text/AbstractFont.h"
#include "Magnum/Text/Renderer.h" #include "Magnum/Text/Renderer.h"
#ifndef MAGNUM_TARGET_GLES2
#include "Magnum/DebugTools/BufferData.h"
#endif
namespace Magnum { namespace Text { namespace Test { namespace { namespace Magnum { namespace Text { namespace Test { namespace {
struct RendererGLTest: GL::OpenGLTester { struct RendererGLTest: GL::OpenGLTester {
@ -187,10 +191,9 @@ void RendererGLTest::renderMesh() {
/* Bounds */ /* Bounds */
CORRADE_COMPARE(bounds, Range2D({0.0f, -0.5f}, {5.0f, 1.0f}).translated(offset)); CORRADE_COMPARE(bounds, Range2D({0.0f, -0.5f}, {5.0f, 1.0f}).translated(offset));
/** @todo How to verify this on ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES
/* Vertex buffer contents */ /* Vertex buffer contents */
Containers::Array<char> vertices = vertexBuffer.data(); Containers::Array<char> vertices = DebugTools::bufferData(vertexBuffer);
CORRADE_COMPARE_AS(Containers::arrayCast<const Float>(vertices), CORRADE_COMPARE_AS(Containers::arrayCast<const Float>(vertices),
Containers::arrayView<Float>({ Containers::arrayView<Float>({
0.0f + offset.x(), 0.5f + offset.y(), 0.0f, 10.0f, 0.0f + offset.x(), 0.5f + offset.y(), 0.0f, 10.0f,
@ -208,8 +211,8 @@ void RendererGLTest::renderMesh() {
5.0f + offset.x(), 1.0f + offset.y(), 18.0f, 10.0f, 5.0f + offset.x(), 1.0f + offset.y(), 18.0f, 10.0f,
5.0f + offset.x(), -0.5f + offset.y(), 18.0f, 0.0f 5.0f + offset.x(), -0.5f + offset.y(), 18.0f, 0.0f
}), TestSuite::Compare::Container); }), TestSuite::Compare::Container);
/* Index buffer contents */
Containers::Array<char> indices = indexBuffer.data(); Containers::Array<char> indices = DebugTools::bufferData(indexBuffer);
CORRADE_COMPARE_AS(Containers::arrayCast<const UnsignedByte>(indices), CORRADE_COMPARE_AS(Containers::arrayCast<const UnsignedByte>(indices),
Containers::arrayView<UnsignedByte>({ Containers::arrayView<UnsignedByte>({
0, 1, 2, 1, 3, 2, 0, 1, 2, 1, 3, 2,
@ -220,10 +223,11 @@ void RendererGLTest::renderMesh() {
} }
void RendererGLTest::renderMeshIndexType() { void RendererGLTest::renderMeshIndexType() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
TestFont font; TestFont font;
GL::Mesh mesh{NoCreate}; GL::Mesh mesh{NoCreate};
GL::Buffer vertexBuffer, indexBuffer; GL::Buffer vertexBuffer{GL::Buffer::TargetHint::Array};
GL::Buffer indexBuffer{GL::Buffer::TargetHint::ElementArray};
/* Sizes: four vertices per glyph, each vertex has 2D position and 2D /* Sizes: four vertices per glyph, each vertex has 2D position and 2D
texture coordinates, each float is four bytes; six indices per glyph. */ texture coordinates, each float is four bytes; six indices per glyph. */
@ -232,7 +236,7 @@ void RendererGLTest::renderMeshIndexType() {
std::tie(mesh, std::ignore) = Text::Renderer3D::render(font, nullGlyphCache, std::tie(mesh, std::ignore) = Text::Renderer3D::render(font, nullGlyphCache,
1.0f, std::string(64, 'a'), vertexBuffer, indexBuffer, GL::BufferUsage::StaticDraw); 1.0f, std::string(64, 'a'), vertexBuffer, indexBuffer, GL::BufferUsage::StaticDraw);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
Containers::Array<char> indicesByte = indexBuffer.data(); Containers::Array<char> indicesByte = DebugTools::bufferData(indexBuffer);
CORRADE_COMPARE(vertexBuffer.size(), 256*(2 + 2)*4); CORRADE_COMPARE(vertexBuffer.size(), 256*(2 + 2)*4);
CORRADE_COMPARE(indicesByte.size(), 64*6); CORRADE_COMPARE(indicesByte.size(), 64*6);
CORRADE_COMPARE_AS(Containers::arrayCast<const UnsignedByte>(indicesByte).prefix(18), CORRADE_COMPARE_AS(Containers::arrayCast<const UnsignedByte>(indicesByte).prefix(18),
@ -246,7 +250,7 @@ void RendererGLTest::renderMeshIndexType() {
std::tie(mesh, std::ignore) = Text::Renderer3D::render(font, nullGlyphCache, std::tie(mesh, std::ignore) = Text::Renderer3D::render(font, nullGlyphCache,
1.0f, std::string(65, 'a'), vertexBuffer, indexBuffer, GL::BufferUsage::StaticDraw); 1.0f, std::string(65, 'a'), vertexBuffer, indexBuffer, GL::BufferUsage::StaticDraw);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
Containers::Array<char> indicesShort = indexBuffer.data(); Containers::Array<char> indicesShort = DebugTools::bufferData(indexBuffer);
CORRADE_COMPARE(vertexBuffer.size(), 260*(2 + 2)*4); CORRADE_COMPARE(vertexBuffer.size(), 260*(2 + 2)*4);
CORRADE_COMPARE(indicesShort.size(), 65*6*2); CORRADE_COMPARE(indicesShort.size(), 65*6*2);
CORRADE_COMPARE_AS(Containers::arrayCast<const UnsignedShort>(indicesShort).prefix(18), CORRADE_COMPARE_AS(Containers::arrayCast<const UnsignedShort>(indicesShort).prefix(18),
@ -256,7 +260,7 @@ void RendererGLTest::renderMeshIndexType() {
8, 9, 10, 9, 11, 10 8, 9, 10, 9, 11, 10
}), TestSuite::Compare::Container); }), TestSuite::Compare::Container);
#else #else
CORRADE_SKIP("Can't verify buffer contents on OpenGL ES."); CORRADE_SKIP("Can't verify buffer contents on OpenGL ES 2.0.");
#endif #endif
} }
@ -280,9 +284,9 @@ void RendererGLTest::mutableText() {
renderer.reserve(4, GL::BufferUsage::DynamicDraw, GL::BufferUsage::DynamicDraw); renderer.reserve(4, GL::BufferUsage::DynamicDraw, GL::BufferUsage::DynamicDraw);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(renderer.capacity(), 4); CORRADE_COMPARE(renderer.capacity(), 4);
/** @todo How to verify this on ES? */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Containers::Array<char> indices = renderer.indexBuffer().data(); Containers::Array<char> indices = DebugTools::bufferData(renderer.indexBuffer());
CORRADE_COMPARE_AS(Containers::arrayCast<const UnsignedByte>(indices).prefix(24), CORRADE_COMPARE_AS(Containers::arrayCast<const UnsignedByte>(indices).prefix(24),
Containers::arrayView<UnsignedByte>({ Containers::arrayView<UnsignedByte>({
0, 1, 2, 1, 3, 2, 0, 1, 2, 1, 3, 2,
@ -301,9 +305,8 @@ void RendererGLTest::mutableText() {
/* Aligned to line/left, no offset needed */ /* Aligned to line/left, no offset needed */
/** @todo How to verify this on ES? */ #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES Containers::Array<char> vertices = DebugTools::bufferData(renderer.vertexBuffer());
Containers::Array<char> vertices = renderer.vertexBuffer().data();
CORRADE_COMPARE_AS(Containers::arrayCast<const Float>(vertices).prefix(48), CORRADE_COMPARE_AS(Containers::arrayCast<const Float>(vertices).prefix(48),
Containers::arrayView<Float>({ Containers::arrayView<Float>({
0.0f, 0.5f, 0.0f, 10.0f, 0.0f, 0.5f, 0.0f, 10.0f,

Loading…
Cancel
Save