Browse Source

Split the OpenGL layer out, pt 17: adapted GL tests.

Now the library compiles together with tests w/o deprecation warnings
... except for documentation snippets.
pull/233/head
Vladimír Vondruš 8 years ago
parent
commit
6c06bb5718
  1. 24
      src/Magnum/GL/Test/AbstractObjectGLTest.cpp
  2. 42
      src/Magnum/GL/Test/AbstractQueryGLTest.cpp
  3. 99
      src/Magnum/GL/Test/AbstractShaderProgramGLTest.cpp
  4. 8
      src/Magnum/GL/Test/AbstractShaderProgramTest.cpp
  5. 30
      src/Magnum/GL/Test/AbstractTextureGLTest.cpp
  6. 8
      src/Magnum/GL/Test/AttributeTest.cpp
  7. 106
      src/Magnum/GL/Test/BufferGLTest.cpp
  8. 51
      src/Magnum/GL/Test/BufferImageGLTest.cpp
  9. 8
      src/Magnum/GL/Test/BufferImageTest.cpp
  10. 8
      src/Magnum/GL/Test/BufferTest.cpp
  11. 100
      src/Magnum/GL/Test/BufferTextureGLTest.cpp
  12. 8
      src/Magnum/GL/Test/BufferTextureTest.cpp
  13. 54
      src/Magnum/GL/Test/ContextGLTest.cpp
  14. 10
      src/Magnum/GL/Test/ContextTest.cpp
  15. 418
      src/Magnum/GL/Test/CubeMapTextureArrayGLTest.cpp
  16. 8
      src/Magnum/GL/Test/CubeMapTextureArrayTest.cpp
  17. 360
      src/Magnum/GL/Test/CubeMapTextureGLTest.cpp
  18. 8
      src/Magnum/GL/Test/CubeMapTextureTest.cpp
  19. 66
      src/Magnum/GL/Test/DebugOutputGLTest.cpp
  20. 8
      src/Magnum/GL/Test/DebugOutputTest.cpp
  21. 8
      src/Magnum/GL/Test/DefaultFramebufferTest.cpp
  22. 574
      src/Magnum/GL/Test/FramebufferGLTest.cpp
  23. 8
      src/Magnum/GL/Test/FramebufferTest.cpp
  24. 225
      src/Magnum/GL/Test/MeshGLTest.cpp
  25. 170
      src/Magnum/GL/Test/MultisampleTextureGLTest.cpp
  26. 8
      src/Magnum/GL/Test/MultisampleTextureTest.cpp
  27. 78
      src/Magnum/GL/Test/PixelStorageGLTest.cpp
  28. 70
      src/Magnum/GL/Test/PrimitiveQueryGLTest.cpp
  29. 8
      src/Magnum/GL/Test/PrimitiveQueryTest.cpp
  30. 195
      src/Magnum/GL/Test/RectangleTextureGLTest.cpp
  31. 8
      src/Magnum/GL/Test/RectangleTextureTest.cpp
  32. 64
      src/Magnum/GL/Test/RenderbufferGLTest.cpp
  33. 8
      src/Magnum/GL/Test/RenderbufferTest.cpp
  34. 8
      src/Magnum/GL/Test/RendererTest.cpp
  35. 52
      src/Magnum/GL/Test/SampleQueryGLTest.cpp
  36. 8
      src/Magnum/GL/Test/SampleQueryTest.cpp
  37. 28
      src/Magnum/GL/Test/ShaderGLTest.cpp
  38. 8
      src/Magnum/GL/Test/ShaderTest.cpp
  39. 536
      src/Magnum/GL/Test/TextureArrayGLTest.cpp
  40. 8
      src/Magnum/GL/Test/TextureArrayTest.cpp
  41. 674
      src/Magnum/GL/Test/TextureGLTest.cpp
  42. 8
      src/Magnum/GL/Test/TextureTest.cpp
  43. 40
      src/Magnum/GL/Test/TimeQueryGLTest.cpp
  44. 8
      src/Magnum/GL/Test/TimeQueryTest.cpp
  45. 132
      src/Magnum/GL/Test/TransformFeedbackGLTest.cpp
  46. 8
      src/Magnum/GL/Test/TransformFeedbackTest.cpp
  47. 8
      src/Magnum/GL/Test/VersionTest.cpp

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

@ -23,12 +23,12 @@
DEALINGS IN THE SOFTWARE.
*/
#include "Magnum/Buffer.h"
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/GL/Buffer.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/OpenGLTester.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct AbstractObjectGLTest: OpenGLTester {
explicit AbstractObjectGLTest();
@ -41,17 +41,17 @@ AbstractObjectGLTest::AbstractObjectGLTest() {
}
void AbstractObjectGLTest::labelNoOp() {
if(Context::current().isExtensionSupported<Extensions::GL::KHR::debug>())
CORRADE_SKIP(Extensions::GL::KHR::debug::string() + std::string(" is supported."));
if(Context::current().isExtensionSupported<Extensions::GL::EXT::debug_label>())
CORRADE_SKIP(Extensions::GL::EXT::debug_label::string() + std::string(" is supported."));
if(Context::current().isExtensionSupported<GL::Extensions::KHR::debug>())
CORRADE_SKIP(GL::Extensions::KHR::debug::string() + std::string(" is supported."));
if(Context::current().isExtensionSupported<GL::Extensions::EXT::debug_label>())
CORRADE_SKIP(GL::Extensions::EXT::debug_label::string() + std::string(" is supported."));
Buffer buffer;
buffer.setLabel("MyBuffer");
CORRADE_COMPARE(buffer.label(), "");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::AbstractObjectGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::AbstractObjectGLTest)

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

@ -23,12 +23,12 @@
DEALINGS IN THE SOFTWARE.
*/
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/SampleQuery.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/OpenGLTester.h"
#include "Magnum/GL/SampleQuery.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct AbstractQueryGLTest: OpenGLTester {
explicit AbstractQueryGLTest();
@ -55,8 +55,8 @@ AbstractQueryGLTest::AbstractQueryGLTest() {
void AbstractQueryGLTest::construct() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::occlusion_query_boolean>())
CORRADE_SKIP(Extensions::GL::EXT::occlusion_query_boolean::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::occlusion_query_boolean>())
CORRADE_SKIP(Extensions::EXT::occlusion_query_boolean::string() + std::string(" is not supported."));
#endif
{
@ -66,11 +66,11 @@ void AbstractQueryGLTest::construct() {
const SampleQuery query{SampleQuery::Target::AnySamplesPassed};
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(query.id() > 0);
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void AbstractQueryGLTest::constructCopy() {
@ -80,8 +80,8 @@ void AbstractQueryGLTest::constructCopy() {
void AbstractQueryGLTest::constructMove() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::occlusion_query_boolean>())
CORRADE_SKIP(Extensions::GL::EXT::occlusion_query_boolean::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::occlusion_query_boolean>())
CORRADE_SKIP(Extensions::EXT::occlusion_query_boolean::string() + std::string(" is not supported."));
#endif
#ifndef MAGNUM_TARGET_GLES
@ -91,7 +91,7 @@ void AbstractQueryGLTest::constructMove() {
#endif
const Int id = a.id();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0);
SampleQuery b(std::move(a));
@ -107,7 +107,7 @@ void AbstractQueryGLTest::constructMove() {
const Int cId = c.id();
c = std::move(b);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0);
CORRADE_COMPARE(b.id(), cId);
CORRADE_COMPARE(c.id(), id);
@ -116,13 +116,13 @@ void AbstractQueryGLTest::constructMove() {
#ifndef MAGNUM_TARGET_WEBGL
void AbstractQueryGLTest::label() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::occlusion_query_boolean>())
CORRADE_SKIP(Extensions::GL::EXT::occlusion_query_boolean::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::occlusion_query_boolean>())
CORRADE_SKIP(Extensions::EXT::occlusion_query_boolean::string() + std::string(" is not supported."));
#endif
/* No-Op version is tested in AbstractObjectGLTest */
if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>() &&
!Context::current().isExtensionSupported<Extensions::GL::EXT::debug_label>())
if(!Context::current().isExtensionSupported<Extensions::KHR::debug>() &&
!Context::current().isExtensionSupported<Extensions::EXT::debug_label>())
CORRADE_SKIP("Required extension is not available");
#ifndef MAGNUM_TARGET_GLES
@ -132,7 +132,7 @@ void AbstractQueryGLTest::label() {
#endif
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::direct_state_access>())
if(!Context::current().isExtensionSupported<Extensions::ARB::direct_state_access>())
#endif
{
query.begin(); query.end();
@ -146,10 +146,10 @@ void AbstractQueryGLTest::label() {
query.setLabel("MyQuery");
CORRADE_COMPARE(query.label(), "MyQuery");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::AbstractQueryGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::AbstractQueryGLTest)

99
src/Magnum/GL/Test/AbstractShaderProgramGLTest.cpp

@ -27,24 +27,23 @@
#include <Corrade/Utility/Resource.h>
#include <Corrade/TestSuite/Compare/Container.h>
#include "Magnum/AbstractShaderProgram.h"
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/Image.h"
#include "Magnum/ImageView.h"
#include "Magnum/GL/AbstractShaderProgram.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#ifndef MAGNUM_TARGET_GLES2
#include "Magnum/ImageFormat.h"
#include "Magnum/GL/ImageFormat.h"
#endif
#include "Magnum/PixelFormat.h"
#include "Magnum/Shader.h"
#include "Magnum/Texture.h"
#include "Magnum/TextureFormat.h"
#include "Magnum/GL/PixelFormat.h"
#include "Magnum/GL/Shader.h"
#include "Magnum/GL/Texture.h"
#include "Magnum/GL/TextureFormat.h"
#include "Magnum/GL/OpenGLTester.h"
#include "Magnum/Math/Matrix.h"
#include "Magnum/Math/Vector4.h"
#include "Magnum/Math/Color.h"
#include "Magnum/OpenGLTester.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct AbstractShaderProgramGLTest: OpenGLTester {
explicit AbstractShaderProgramGLTest();
@ -120,11 +119,11 @@ void AbstractShaderProgramGLTest::construct() {
{
const DummyShader shader;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(shader.id() > 0);
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void AbstractShaderProgramGLTest::constructCopy() {
@ -136,7 +135,7 @@ void AbstractShaderProgramGLTest::constructMove() {
DummyShader a;
const Int id = a.id();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0);
DummyShader b(std::move(a));
@ -148,7 +147,7 @@ void AbstractShaderProgramGLTest::constructMove() {
const Int cId = c.id();
c = std::move(b);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0);
CORRADE_COMPARE(b.id(), cId);
CORRADE_COMPARE(c.id(), id);
@ -157,8 +156,8 @@ void AbstractShaderProgramGLTest::constructMove() {
#ifndef MAGNUM_TARGET_WEBGL
void AbstractShaderProgramGLTest::label() {
/* No-Op version is tested in AbstractObjectGLTest */
if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>() &&
!Context::current().isExtensionSupported<Extensions::GL::EXT::debug_label>())
if(!Context::current().isExtensionSupported<Extensions::KHR::debug>() &&
!Context::current().isExtensionSupported<Extensions::EXT::debug_label>())
CORRADE_SKIP("Required extension is not available");
DummyShader shader;
@ -167,7 +166,7 @@ void AbstractShaderProgramGLTest::label() {
shader.setLabel("DummyShader");
CORRADE_COMPARE(shader.label(), "DummyShader");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
@ -218,20 +217,20 @@ void AbstractShaderProgramGLTest::create() {
frag.addSource(rs.get("MyShader.frag"));
const bool fragCompiled = frag.compile();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(vertCompiled);
CORRADE_VERIFY(fragCompiled);
MyPublicShader program;
program.attachShaders({vert, frag});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
program.bindAttributeLocation(0, "position");
const bool linked = program.link();
const bool valid = program.validate().first;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(linked);
{
#ifdef CORRADE_TARGET_APPLE
@ -245,7 +244,7 @@ void AbstractShaderProgramGLTest::create() {
const Int colorUniform = program.uniformLocation("color");
const Int additionsUniform = program.uniformLocation("additions");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(matrixUniform >= 0);
CORRADE_VERIFY(multiplierUniform >= 0);
CORRADE_VERIFY(colorUniform >= 0);
@ -276,14 +275,14 @@ void AbstractShaderProgramGLTest::createMultipleOutputs() {
frag.addSource(rs.get("MyShaderFragmentOutputs.frag"));
const bool fragCompiled = frag.compile();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(vertCompiled);
CORRADE_VERIFY(fragCompiled);
MyPublicShader program;
program.attachShaders({vert, frag});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
program.bindAttributeLocation(0, "position");
program.bindFragmentDataLocation(0, "first");
@ -291,7 +290,7 @@ void AbstractShaderProgramGLTest::createMultipleOutputs() {
const bool linked = program.link();
const bool valid = program.validate().first;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(linked);
{
#ifdef CORRADE_TARGET_APPLE
@ -330,14 +329,14 @@ void AbstractShaderProgramGLTest::createMultipleOutputsIndexed() {
frag.addSource(rs.get("MyShaderFragmentOutputs.frag"));
const bool fragCompiled = frag.compile();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(vertCompiled);
CORRADE_VERIFY(fragCompiled);
MyPublicShader program;
program.attachShaders({vert, frag});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
program.bindAttributeLocation(0, "position");
program.bindFragmentDataLocationIndexed(0, 0, "first");
@ -345,7 +344,7 @@ void AbstractShaderProgramGLTest::createMultipleOutputsIndexed() {
const bool linked = program.link();
const bool valid = program.validate().first;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(linked);
{
#ifdef CORRADE_TARGET_APPLE
@ -463,37 +462,37 @@ MyShader::MyShader() {
void AbstractShaderProgramGLTest::uniform() {
MyShader shader;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
shader.setUniform(shader.multiplierUniform, 0.35f);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void AbstractShaderProgramGLTest::uniformVector() {
MyShader shader;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
shader.setUniform(shader.colorUniform, Vector4(0.3f, 0.7f, 1.0f, 0.25f));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void AbstractShaderProgramGLTest::uniformMatrix() {
MyShader shader;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
shader.setUniform(shader.matrixUniform, Matrix4x4::fromDiagonal({0.3f, 0.7f, 1.0f, 0.25f}));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void AbstractShaderProgramGLTest::uniformArray() {
MyShader shader;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/* Testing also implicit conversion to base type (Vector4[] -> Math::Vector<4, Float>[]) */
#ifndef CORRADE_MSVC2015_COMPATIBILITY /* Causes ICE */
@ -506,7 +505,7 @@ void AbstractShaderProgramGLTest::uniformArray() {
};
shader.setUniform(shader.additionsUniform, values);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#ifndef MAGNUM_TARGET_GLES2
@ -533,19 +532,19 @@ void AbstractShaderProgramGLTest::createUniformBlocks() {
frag.addSource(rs.get("UniformBlockShader.frag"));
const bool fragCompiled = frag.compile();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(vertCompiled);
CORRADE_VERIFY(fragCompiled);
MyPublicShader program;
program.attachShaders({vert, frag});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const bool linked = program.link();
const bool valid = program.validate().first;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(linked);
{
#ifdef CORRADE_TARGET_APPLE
@ -557,7 +556,7 @@ void AbstractShaderProgramGLTest::createUniformBlocks() {
const Int matricesUniformBlock = program.uniformBlockIndex("matrices");
const Int materialUniformBlock = program.uniformBlockIndex("material");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(matricesUniformBlock >= 0);
CORRADE_VERIFY(materialUniformBlock >= 0);
}
@ -641,18 +640,18 @@ UniformBlockShader::UniformBlockShader() {
void AbstractShaderProgramGLTest::uniformBlock() {
UniformBlockShader shader;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
shader.setUniformBlockBinding(shader.matricesUniformBlock, 0);
shader.setUniformBlockBinding(shader.materialUniformBlock, 1);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void AbstractShaderProgramGLTest::compute() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::compute_shader>())
CORRADE_SKIP(Extensions::GL::ARB::compute_shader::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::compute_shader>())
CORRADE_SKIP(Extensions::ARB::compute_shader::string() + std::string(" is not supported."));
#else
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 is not supported.");
@ -683,7 +682,7 @@ void AbstractShaderProgramGLTest::compute() {
}
} shader;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const Color4ub inData[] = {
{ 10, 20, 30, 40},
@ -708,18 +707,18 @@ void AbstractShaderProgramGLTest::compute() {
Texture2D out;
out.setStorage(1, TextureFormat::RGBA8UI, {2, 2});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
shader.setImages(in, out)
.dispatchCompute({1, 1, 1});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo Test on ES */
#ifndef MAGNUM_TARGET_GLES
const auto data = out.image(0, {PixelFormat::RGBAInteger, PixelType::UnsignedByte}).release();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(Containers::arrayCast<const Color4ub>(data),
Containers::arrayView(outData),
@ -728,6 +727,6 @@ void AbstractShaderProgramGLTest::compute() {
}
#endif
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::AbstractShaderProgramGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::AbstractShaderProgramGLTest)

8
src/Magnum/GL/Test/AbstractShaderProgramTest.cpp

@ -25,9 +25,9 @@
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/AbstractShaderProgram.h"
#include "Magnum/GL/AbstractShaderProgram.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct AbstractShaderProgramTest: TestSuite::Tester {
explicit AbstractShaderProgramTest();
@ -55,6 +55,6 @@ void AbstractShaderProgramTest::constructNoCreate() {
CORRADE_VERIFY(true);
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::AbstractShaderProgramTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::AbstractShaderProgramTest)

30
src/Magnum/GL/Test/AbstractTextureGLTest.cpp

@ -23,12 +23,12 @@
DEALINGS IN THE SOFTWARE.
*/
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/Texture.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/Texture.h"
#include "Magnum/GL/OpenGLTester.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct AbstractTextureGLTest: OpenGLTester {
explicit AbstractTextureGLTest();
@ -57,11 +57,11 @@ void AbstractTextureGLTest::construct() {
{
const Texture2D texture;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(texture.id() > 0);
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void AbstractTextureGLTest::constructCopy() {
@ -73,7 +73,7 @@ void AbstractTextureGLTest::constructMove() {
Texture2D a;
const Int id = a.id();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0);
Texture2D b(std::move(a));
@ -85,7 +85,7 @@ void AbstractTextureGLTest::constructMove() {
const Int cId = c.id();
c = std::move(b);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0);
CORRADE_COMPARE(b.id(), cId);
CORRADE_COMPARE(c.id(), id);
@ -94,22 +94,22 @@ void AbstractTextureGLTest::constructMove() {
#ifndef MAGNUM_TARGET_WEBGL
void AbstractTextureGLTest::label() {
/* No-Op version is tested in AbstractObjectGLTest */
if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>() &&
!Context::current().isExtensionSupported<Extensions::GL::EXT::debug_label>())
if(!Context::current().isExtensionSupported<Extensions::KHR::debug>() &&
!Context::current().isExtensionSupported<Extensions::EXT::debug_label>())
CORRADE_SKIP("Required extension is not available");
Texture2D texture;
CORRADE_COMPARE(texture.label(), "");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
texture.setLabel("MyTexture");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.label(), "MyTexture");
}
#endif
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::AbstractTextureGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::AbstractTextureGLTest)

8
src/Magnum/GL/Test/AttributeTest.cpp

@ -26,9 +26,9 @@
#include <sstream>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/AbstractShaderProgram.h"
#include "Magnum/GL/AbstractShaderProgram.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct AttributeTest: TestSuite::Tester {
explicit AttributeTest();
@ -463,6 +463,6 @@ void AttributeTest::debugDataTypeVector4() {
CORRADE_COMPARE(out.str(), "GL::Attribute::DataType::HalfFloat GL::Attribute::DataType(0xdead)\n");
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::AttributeTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::AttributeTest)

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

@ -28,12 +28,12 @@
#include <Corrade/Containers/Array.h>
#include <Corrade/TestSuite/Compare/Container.h>
#include "Magnum/Buffer.h"
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/GL/Buffer.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/OpenGLTester.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct BufferGLTest: OpenGLTester {
explicit BufferGLTest();
@ -95,13 +95,13 @@ void BufferGLTest::construct() {
{
Buffer buffer;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(buffer.id() > 0);
CORRADE_COMPARE(buffer.targetHint(), Buffer::TargetHint::Array);
CORRADE_COMPARE(buffer.size(), 0);
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void BufferGLTest::constructCopy() {
@ -113,7 +113,7 @@ void BufferGLTest::constructMove() {
Buffer a;
const Int id = a.id();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0);
Buffer b(std::move(a));
@ -125,7 +125,7 @@ void BufferGLTest::constructMove() {
const Int cId = c.id();
c = std::move(b);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0);
CORRADE_COMPARE(b.id(), cId);
CORRADE_COMPARE(c.id(), id);
@ -149,17 +149,17 @@ void BufferGLTest::wrap() {
#ifndef MAGNUM_TARGET_WEBGL
void BufferGLTest::label() {
/* No-Op version is tested in AbstractObjectGLTest */
if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>() &&
!Context::current().isExtensionSupported<Extensions::GL::EXT::debug_label>())
if(!Context::current().isExtensionSupported<Extensions::KHR::debug>() &&
!Context::current().isExtensionSupported<Extensions::EXT::debug_label>())
CORRADE_SKIP("Required extension is not available");
Buffer buffer;
CORRADE_COMPARE(buffer.label(), "");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
buffer.setLabel("MyBuffer");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(buffer.label(), "MyBuffer");
}
@ -168,32 +168,32 @@ void BufferGLTest::label() {
#ifndef MAGNUM_TARGET_GLES2
void BufferGLTest::bindBase() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::uniform_buffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::uniform_buffer_object::string() + std::string{" is not supported."});
if(!Context::current().isExtensionSupported<Extensions::ARB::uniform_buffer_object>())
CORRADE_SKIP(Extensions::ARB::uniform_buffer_object::string() + std::string{" is not supported."});
#endif
Buffer buffer;
buffer.bind(Buffer::Target::Uniform, 15);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
Buffer::unbind(Buffer::Target::Uniform, 15);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
Buffer::bind(Buffer::Target::Uniform, 7, {&buffer, nullptr, &buffer});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
Buffer::unbind(Buffer::Target::Uniform, 7, 3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void BufferGLTest::bindRange() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::uniform_buffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::uniform_buffer_object::string() + std::string{" is not supported."});
if(!Context::current().isExtensionSupported<Extensions::ARB::uniform_buffer_object>())
CORRADE_SKIP(Extensions::ARB::uniform_buffer_object::string() + std::string{" is not supported."});
#endif
/* Check that we have correct offset alignment */
@ -203,14 +203,14 @@ void BufferGLTest::bindRange() {
buffer.setData({nullptr, 1024}, BufferUsage::StaticDraw)
.bind(Buffer::Target::Uniform, 15, 256, 13);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo C++14: get rid of std::make_tuple */
Buffer::bind(Buffer::Target::Uniform, 7, {
std::make_tuple(&buffer, 256, 13), {},
std::make_tuple(&buffer, 768, 64)});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
@ -220,25 +220,25 @@ void BufferGLTest::data() {
/* Plain array */
constexpr Int data[] = {2, 7, 5, 13, 25};
buffer.setData({data, 5}, BufferUsage::StaticDraw);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(buffer.size(), 5*4);
/* STL vector */
std::vector<Int> data2{2, 7, 5, 13, 25};
buffer.setData(data2, BufferUsage::StaticDraw);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(buffer.size(), 5*4);
/* STL array */
std::array<Int, 5> data3{{2, 7, 5, 13, 25}};
buffer.setData(data3, BufferUsage::StaticDraw);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(buffer.size(), 5*4);
/** @todo How to verify the contents in ES? */
#ifndef MAGNUM_TARGET_GLES
auto contents = buffer.data();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(Containers::arrayCast<Int>(contents),
Containers::arrayView(data),
TestSuite::Compare::Container);
@ -247,25 +247,25 @@ void BufferGLTest::data() {
/* Plain array */
constexpr Int subData[] = {125, 3, 15};
buffer.setSubData(4, {subData, 3});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(buffer.size(), 5*4);
/* STL vector */
std::vector<Int> subData2{125, 3, 15};
buffer.setSubData(4, subData2);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(buffer.size(), 5*4);
/* STL array */
std::array<Int, 3> subData3{{125, 3, 15}};
buffer.setSubData(4, subData3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(buffer.size(), 5*4);
/** @todo How to verify the contents in ES? */
#ifndef MAGNUM_TARGET_GLES
auto subContents = buffer.subData(4, 3*4);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(Containers::arrayCast<Int>(subContents),
Containers::arrayView(subData),
TestSuite::Compare::Container);
@ -275,8 +275,8 @@ void BufferGLTest::data() {
#ifndef MAGNUM_TARGET_WEBGL
void BufferGLTest::map() {
#ifdef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::OES::mapbuffer>())
CORRADE_SKIP(Extensions::GL::OES::mapbuffer::string() + std::string(" is not supported"));
if(!Context::current().isExtensionSupported<Extensions::OES::mapbuffer>())
CORRADE_SKIP(Extensions::OES::mapbuffer::string() + std::string(" is not supported"));
#endif
Buffer buffer;
@ -290,7 +290,7 @@ void BufferGLTest::map() {
Buffer::MapAccess::WriteOnly
#endif
);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(contents);
#ifndef MAGNUM_TARGET_GLES2
@ -299,7 +299,7 @@ void BufferGLTest::map() {
contents[3] = 107;
CORRADE_VERIFY(buffer.unmap());
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to verify the contents in ES? */
#ifndef MAGNUM_TARGET_GLES
@ -311,11 +311,11 @@ void BufferGLTest::map() {
void BufferGLTest::mapRange() {
#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"));
if(!Context::current().isExtensionSupported<Extensions::ARB::map_buffer_range>())
CORRADE_SKIP(Extensions::ARB::map_buffer_range::string() + std::string(" is not supported"));
#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"));
if(!Context::current().isExtensionSupported<Extensions::EXT::map_buffer_range>())
CORRADE_SKIP(Extensions::EXT::map_buffer_range::string() + std::string(" is not supported"));
#endif
constexpr char data[] = {2, 7, 5, 13, 25};
@ -323,7 +323,7 @@ void BufferGLTest::mapRange() {
buffer.setData(data, BufferUsage::StaticDraw);
Containers::ArrayView<char> contents = buffer.map(1, 4, Buffer::MapFlag::Read|Buffer::MapFlag::Write);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(contents);
CORRADE_COMPARE(contents.size(), 4);
@ -331,7 +331,7 @@ void BufferGLTest::mapRange() {
contents[3] = 107;
CORRADE_VERIFY(buffer.unmap());
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to verify the contents in ES? */
#ifndef MAGNUM_TARGET_GLES
@ -343,11 +343,11 @@ void BufferGLTest::mapRange() {
void BufferGLTest::mapRangeExplicitFlush() {
#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"));
if(!Context::current().isExtensionSupported<Extensions::ARB::map_buffer_range>())
CORRADE_SKIP(Extensions::ARB::map_buffer_range::string() + std::string(" is not supported"));
#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"));
if(!Context::current().isExtensionSupported<Extensions::EXT::map_buffer_range>())
CORRADE_SKIP(Extensions::EXT::map_buffer_range::string() + std::string(" is not supported"));
#endif
constexpr char data[] = {2, 7, 5, 13, 25};
@ -359,7 +359,7 @@ void BufferGLTest::mapRangeExplicitFlush() {
CORRADE_VERIFY(contents);
contents[2] = 99;
CORRADE_VERIFY(buffer.unmap());
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/* Unflushed range _might_ not be changed, thus nothing to test */
@ -368,9 +368,9 @@ void BufferGLTest::mapRangeExplicitFlush() {
CORRADE_VERIFY(contents);
contents[3] = 107;
buffer.flushMappedRange(3, 1);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(buffer.unmap());
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/* Flushed range should be changed */
/** @todo How to verify the contents in ES? */
@ -392,7 +392,7 @@ void BufferGLTest::copy() {
buffer2.setData({nullptr, 5}, BufferUsage::StaticRead);
Buffer::copy(buffer1, buffer2, 1, 2, 3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to verify the contents in ES? */
#ifndef MAGNUM_TARGET_GLES
@ -411,12 +411,12 @@ void BufferGLTest::invalidate() {
/* Just test that no errors are emitted */
buffer.invalidateSubData(3, 2);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
buffer.invalidateData();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::BufferGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::BufferGLTest)

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

@ -27,11 +27,12 @@
#include <Corrade/Containers/Array.h>
#include <Corrade/TestSuite/Compare/Container.h>
#include "Magnum/BufferImage.h"
#include "Magnum/PixelFormat.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/GL/BufferImage.h"
#include "Magnum/GL/PixelFormat.h"
#include "Magnum/GL/OpenGLTester.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct BufferImageGLTest: OpenGLTester {
explicit BufferImageGLTest();
@ -104,7 +105,7 @@ void BufferImageGLTest::construct() {
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(a.storage().alignment(), 1);
CORRADE_COMPARE(a.format(), GL::PixelFormat::Red);
@ -127,7 +128,7 @@ void BufferImageGLTest::constructGeneric() {
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(a.storage().alignment(), 1);
CORRADE_COMPARE(a.format(), GL::PixelFormat::Red);
@ -154,7 +155,7 @@ void BufferImageGLTest::constructCompressed() {
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
CORRADE_COMPARE(a.storage().compressedBlockSize(), Vector3i{4});
@ -183,7 +184,7 @@ void BufferImageGLTest::constructCompressedGeneric() {
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
CORRADE_COMPARE(a.storage().compressedBlockSize(), Vector3i{4});
@ -212,7 +213,7 @@ void BufferImageGLTest::constructBuffer() {
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(!buffer.id());
CORRADE_COMPARE(a.buffer().id(), id);
@ -241,7 +242,7 @@ void BufferImageGLTest::constructBufferGeneric() {
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(!buffer.id());
CORRADE_COMPARE(a.buffer().id(), id);
@ -274,7 +275,7 @@ void BufferImageGLTest::constructBufferCompressed() {
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
CORRADE_COMPARE(a.storage().compressedBlockSize(), Vector3i{4});
@ -309,7 +310,7 @@ void BufferImageGLTest::constructBufferCompressedGeneric() {
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
CORRADE_COMPARE(a.storage().compressedBlockSize(), Vector3i{4});
@ -332,7 +333,7 @@ void BufferImageGLTest::constructInvalidSize() {
Error redirectError{&out};
/* Doesn't consider alignment */
BufferImage2D{PixelFormat::RGB8Unorm, {1, 3}, Containers::Array<char>{3*3}, BufferUsage::StaticDraw};
BufferImage2D{Magnum::PixelFormat::RGB8Unorm, {1, 3}, Containers::Array<char>{3*3}, BufferUsage::StaticDraw};
CORRADE_COMPARE(out.str(), "GL::BufferImage::BufferImage(): data too small, got 9 but expected at least 12 bytes\n");
}
@ -343,14 +344,14 @@ void BufferImageGLTest::constructCompressedInvalidSize() {
{
std::ostringstream out;
Error redirectError{&out};
CompressedBufferImage2D{CompressedPixelFormat::Bc2RGBAUnorm, {4, 4}, Containers::Array<char>{2}, BufferUsage::StaticDraw};
CompressedBufferImage2D{Magnum::CompressedPixelFormat::Bc2RGBAUnorm, {4, 4}, Containers::Array<char>{2}, BufferUsage::StaticDraw};
CORRADE_COMPARE(out.str(), "GL::CompressedBufferImage::CompressedBufferImage(): data too small, got 2 but expected at least 4 bytes\n");
/* Size should be rounded up even if the image size is not full block */
} {
std::ostringstream out;
Error redirectError{&out};
CompressedBufferImage2D{CompressedPixelFormat::Bc2RGBAUnorm, {2, 2}, Containers::Array<char>{2}, BufferUsage::StaticDraw};
CompressedBufferImage2D{Magnum::CompressedPixelFormat::Bc2RGBAUnorm, {2, 2}, Containers::Array<char>{2}, BufferUsage::StaticDraw};
CORRADE_COMPARE(out.str(), "GL::CompressedBufferImage::CompressedBufferImage(): data too small, got 2 but expected at least 4 bytes\n");
}
}
@ -370,7 +371,7 @@ void BufferImageGLTest::constructMove() {
BufferImage2D a{PixelFormat::Red, PixelType::UnsignedByte, {4, 1}, data, BufferUsage::StaticDraw};
const Int id = a.buffer().id();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0);
BufferImage2D b(std::move(a));
@ -390,7 +391,7 @@ void BufferImageGLTest::constructMove() {
const Int cId = c.buffer().id();
c = std::move(b);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0);
CORRADE_COMPARE(b.buffer().id(), cId);
@ -408,7 +409,7 @@ void BufferImageGLTest::constructMoveCompressed() {
CompressedBufferImage2D a{CompressedPixelFormat::RGBAS3tcDxt1, {4, 4}, data, BufferUsage::StaticDraw};
const Int id = a.buffer().id();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0);
CompressedBufferImage2D b{std::move(a)};
@ -434,7 +435,7 @@ void BufferImageGLTest::constructMoveCompressed() {
const Int cId = c.buffer().id();
c = std::move(b);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0);
CORRADE_COMPARE(b.buffer().id(), cId);
@ -470,7 +471,7 @@ void BufferImageGLTest::dataPropertiesCompressed() {
.setCompressedBlockDataSize(16)
.setImageHeight(12)
.setSkip({5, 8, 11}),
CompressedPixelFormat::Bc1RGBAUnorm, {2, 8, 11}, data, BufferUsage::StaticDraw};
Magnum::CompressedPixelFormat::Bc1RGBAUnorm, {2, 8, 11}, data, BufferUsage::StaticDraw};
CORRADE_COMPARE(image.dataProperties(),
(std::pair<Math::Vector3<std::size_t>, Math::Vector3<std::size_t>>{{2*16, 2*16, 9*16}, {1, 3, 3}}));
}
@ -487,7 +488,7 @@ void BufferImageGLTest::setData() {
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(a.storage().alignment(), 4);
CORRADE_COMPARE(a.format(), GL::PixelFormat::RGBA);
@ -514,7 +515,7 @@ void BufferImageGLTest::setDataGeneric() {
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(a.storage().alignment(), 4);
CORRADE_COMPARE(a.format(), GL::PixelFormat::RGBA);
@ -544,7 +545,7 @@ void BufferImageGLTest::setDataCompressed() {
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
CORRADE_COMPARE(a.storage().compressedBlockSize(), Vector3i{4});
@ -575,7 +576,7 @@ void BufferImageGLTest::setDataCompressedGeneric() {
const auto imageData = a.buffer().data();
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
CORRADE_COMPARE(a.storage().compressedBlockSize(), Vector3i{4});
@ -611,6 +612,6 @@ void BufferImageGLTest::releaseCompressed() {
CORRADE_COMPARE(b.id(), id);
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::BufferImageGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::BufferImageGLTest)

8
src/Magnum/GL/Test/BufferImageTest.cpp

@ -25,9 +25,9 @@
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/BufferImage.h"
#include "Magnum/GL/BufferImage.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct BufferImageTest: TestSuite::Tester {
explicit BufferImageTest();
@ -59,6 +59,6 @@ void BufferImageTest::constructNoCreateCompressed() {
CORRADE_VERIFY(true);
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::BufferImageTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::BufferImageTest)

8
src/Magnum/GL/Test/BufferTest.cpp

@ -27,9 +27,9 @@
#include <sstream>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Buffer.h"
#include "Magnum/GL/Buffer.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct BufferTest: TestSuite::Tester {
explicit BufferTest();
@ -75,6 +75,6 @@ void BufferTest::debugTarget() {
}
#endif
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::BufferTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::BufferTest)

100
src/Magnum/GL/Test/BufferTextureGLTest.cpp

@ -25,15 +25,15 @@
#include <Corrade/TestSuite/Compare/Container.h>
#include "Magnum/Buffer.h"
#include "Magnum/BufferTexture.h"
#include "Magnum/BufferTextureFormat.h"
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/ImageFormat.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/GL/Buffer.h"
#include "Magnum/GL/BufferTexture.h"
#include "Magnum/GL/BufferTextureFormat.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/ImageFormat.h"
#include "Magnum/GL/OpenGLTester.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct BufferTextureGLTest: OpenGLTester {
explicit BufferTextureGLTest();
@ -61,30 +61,30 @@ BufferTextureGLTest::BufferTextureGLTest() {
void BufferTextureGLTest::construct() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_buffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::texture_buffer_object::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_buffer_object>())
CORRADE_SKIP(Extensions::ARB::texture_buffer_object::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_buffer>())
CORRADE_SKIP(Extensions::GL::EXT::texture_buffer::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_buffer>())
CORRADE_SKIP(Extensions::EXT::texture_buffer::string() + std::string(" is not supported."));
#endif
{
BufferTexture texture;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(texture.id() > 0);
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void BufferTextureGLTest::wrap() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_buffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::texture_buffer_object::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_buffer_object>())
CORRADE_SKIP(Extensions::ARB::texture_buffer_object::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_buffer>())
CORRADE_SKIP(Extensions::GL::EXT::texture_buffer::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_buffer>())
CORRADE_SKIP(Extensions::EXT::texture_buffer::string() + std::string(" is not supported."));
#endif
GLuint id;
@ -103,40 +103,40 @@ void BufferTextureGLTest::wrap() {
void BufferTextureGLTest::bind() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_buffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::texture_buffer_object::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_buffer_object>())
CORRADE_SKIP(Extensions::ARB::texture_buffer_object::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_buffer>())
CORRADE_SKIP(Extensions::GL::EXT::texture_buffer::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_buffer>())
CORRADE_SKIP(Extensions::EXT::texture_buffer::string() + std::string(" is not supported."));
#endif
BufferTexture texture;
texture.bind(15);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbind(15);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::bind(7, {&texture, nullptr, &texture});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbind(7, 3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void BufferTextureGLTest::bindImage() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_buffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::texture_buffer_object::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::shader_image_load_store>())
CORRADE_SKIP(Extensions::GL::ARB::shader_image_load_store::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_buffer_object>())
CORRADE_SKIP(Extensions::ARB::texture_buffer_object::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::shader_image_load_store>())
CORRADE_SKIP(Extensions::ARB::shader_image_load_store::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_buffer>())
CORRADE_SKIP(Extensions::GL::EXT::texture_buffer::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_buffer>())
CORRADE_SKIP(Extensions::EXT::texture_buffer::string() + std::string(" is not supported."));
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 is not supported.");
#endif
@ -148,30 +148,30 @@ void BufferTextureGLTest::bindImage() {
texture.setBuffer(BufferTextureFormat::RGBA8, buffer)
.bindImage(2, ImageAccess::ReadWrite, ImageFormat::RGBA8);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbindImage(2);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
AbstractTexture::bindImages(1, {&texture, nullptr, &texture});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbindImages(1, 3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#endif
}
void BufferTextureGLTest::setBuffer() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_buffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::texture_buffer_object::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_buffer_object>())
CORRADE_SKIP(Extensions::ARB::texture_buffer_object::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_buffer>())
CORRADE_SKIP(Extensions::GL::EXT::texture_buffer::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_buffer>())
CORRADE_SKIP(Extensions::EXT::texture_buffer::string() + std::string(" is not supported."));
#endif
BufferTexture texture;
@ -183,18 +183,18 @@ void BufferTextureGLTest::setBuffer() {
buffer.setData(data, BufferUsage::StaticDraw);
texture.setBuffer(BufferTextureFormat::R8UI, buffer);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void BufferTextureGLTest::setBufferOffset() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_buffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::texture_buffer_object::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_buffer_range>())
CORRADE_SKIP(Extensions::GL::ARB::texture_buffer_range::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_buffer_object>())
CORRADE_SKIP(Extensions::ARB::texture_buffer_object::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_buffer_range>())
CORRADE_SKIP(Extensions::ARB::texture_buffer_range::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_buffer>())
CORRADE_SKIP(Extensions::GL::EXT::texture_buffer::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_buffer>())
CORRADE_SKIP(Extensions::EXT::texture_buffer::string() + std::string(" is not supported."));
#endif
/* Check that we have correct offset alignment */
@ -212,9 +212,9 @@ void BufferTextureGLTest::setBufferOffset() {
buffer.setSubData(256 - 16, data);
texture.setBuffer(BufferTextureFormat::R8UI, buffer, 256, 8);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::BufferTextureGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::BufferTextureGLTest)

8
src/Magnum/GL/Test/BufferTextureTest.cpp

@ -25,9 +25,9 @@
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/BufferTexture.h"
#include "Magnum/GL/BufferTexture.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct BufferTextureTest: TestSuite::Tester {
explicit BufferTextureTest();
@ -48,6 +48,6 @@ void BufferTextureTest::constructNoCreate() {
CORRADE_VERIFY(true);
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::BufferTextureTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::BufferTextureTest)

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

@ -25,11 +25,11 @@
#include <algorithm>
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/OpenGLTester.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct ContextGLTest: OpenGLTester {
explicit ContextGLTest();
@ -72,14 +72,14 @@ void ContextGLTest::isVersionSupported() {
CORRADE_VERIFY(!Context::current().isVersionSupported(Version(Int(v)+1)));
/* No assertions should be fired */
MAGNUM_ASSERT_VERSION_SUPPORTED(v);
MAGNUM_ASSERT_VERSION_SUPPORTED(Version(Int(v)-1));
MAGNUM_ASSERT_GL_VERSION_SUPPORTED(v);
MAGNUM_ASSERT_GL_VERSION_SUPPORTED(Version(Int(v)-1));
}
#ifndef MAGNUM_TARGET_GLES
void ContextGLTest::isVersionSupportedES() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::ES2_compatibility>())
CORRADE_SKIP(Extensions::GL::ARB::ES2_compatibility::string() + std::string(" extension should not be supported, can't test"));
if(!Context::current().isExtensionSupported<Extensions::ARB::ES2_compatibility>())
CORRADE_SKIP(Extensions::ARB::ES2_compatibility::string() + std::string(" extension should not be supported, can't test"));
/* No assertions should be fired */
CORRADE_VERIFY(Context::current().isVersionSupported(Version::GLES200));
@ -96,25 +96,25 @@ void ContextGLTest::supportedVersion() {
void ContextGLTest::isExtensionSupported() {
#ifndef MAGNUM_TARGET_GLES
if(Context::current().isExtensionSupported<Extensions::GL::GREMEDY::string_marker>())
CORRADE_SKIP(Extensions::GL::GREMEDY::string_marker::string() + std::string(" extension should not be supported, can't test"));
if(Context::current().isExtensionSupported<Extensions::GREMEDY::string_marker>())
CORRADE_SKIP(Extensions::GREMEDY::string_marker::string() + std::string(" extension should not be supported, can't test"));
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_filter_anisotropic>())
CORRADE_SKIP(Extensions::GL::EXT::texture_filter_anisotropic::string() + std::string(" extension should be supported, can't test"));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_filter_anisotropic>())
CORRADE_SKIP(Extensions::EXT::texture_filter_anisotropic::string() + std::string(" extension should be supported, can't test"));
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::explicit_attrib_location>())
CORRADE_SKIP(Extensions::GL::ARB::explicit_attrib_location::string() + std::string(" extension should be supported, can't test"));
if(!Context::current().isExtensionSupported<Extensions::ARB::explicit_attrib_location>())
CORRADE_SKIP(Extensions::ARB::explicit_attrib_location::string() + std::string(" extension should be supported, can't test"));
/* Test that we have proper extension list parser */
std::vector<std::string> extensions = Context::current().extensionStrings();
CORRADE_VERIFY(std::find(extensions.begin(), extensions.end(),
Extensions::GL::EXT::texture_filter_anisotropic::string()) != extensions.end());
Extensions::EXT::texture_filter_anisotropic::string()) != extensions.end());
CORRADE_VERIFY(std::find(extensions.begin(), extensions.end(),
Extensions::GL::GREMEDY::string_marker::string()) == extensions.end());
Extensions::GREMEDY::string_marker::string()) == extensions.end());
/* This is disabled in GL < 3.2 to work around GLSL compiler bugs */
CORRADE_VERIFY(!Context::current().isExtensionSupported<Extensions::GL::ARB::explicit_attrib_location>(Version::GL310));
CORRADE_VERIFY(Context::current().isExtensionSupported<Extensions::GL::ARB::explicit_attrib_location>(Version::GL320));
CORRADE_VERIFY(!Context::current().isExtensionSupported<Extensions::ARB::explicit_attrib_location>(Version::GL310));
CORRADE_VERIFY(Context::current().isExtensionSupported<Extensions::ARB::explicit_attrib_location>(Version::GL320));
#else
CORRADE_SKIP("No useful extensions to test on OpenGL ES");
#endif
@ -122,23 +122,23 @@ void ContextGLTest::isExtensionSupported() {
void ContextGLTest::isExtensionDisabled() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::vertex_array_object>())
CORRADE_SKIP(Extensions::GL::ARB::vertex_array_object::string() + std::string(" extension should be supported, can't test"));
if(!Context::current().isExtensionSupported<Extensions::ARB::vertex_array_object>())
CORRADE_SKIP(Extensions::ARB::vertex_array_object::string() + std::string(" extension should be supported, can't test"));
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::explicit_attrib_location>())
CORRADE_SKIP(Extensions::GL::ARB::explicit_attrib_location::string() + std::string(" extension should be supported, can't test"));
if(!Context::current().isExtensionSupported<Extensions::ARB::explicit_attrib_location>())
CORRADE_SKIP(Extensions::ARB::explicit_attrib_location::string() + std::string(" extension should be supported, can't test"));
/* This is not disabled anywhere */
CORRADE_VERIFY(!Context::current().isExtensionDisabled<Extensions::GL::ARB::vertex_array_object>());
CORRADE_VERIFY(!Context::current().isExtensionDisabled<Extensions::ARB::vertex_array_object>());
/* This is disabled in GL < 3.2 to work around GLSL compiler bugs */
CORRADE_VERIFY(Context::current().isExtensionDisabled<Extensions::GL::ARB::explicit_attrib_location>(Version::GL310));
CORRADE_VERIFY(!Context::current().isExtensionDisabled<Extensions::GL::ARB::explicit_attrib_location>(Version::GL320));
CORRADE_VERIFY(Context::current().isExtensionDisabled<Extensions::ARB::explicit_attrib_location>(Version::GL310));
CORRADE_VERIFY(!Context::current().isExtensionDisabled<Extensions::ARB::explicit_attrib_location>(Version::GL320));
#else
CORRADE_SKIP("No useful extensions to test on OpenGL ES");
#endif
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::ContextGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::ContextGLTest)

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

@ -26,10 +26,10 @@
#include <sstream>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Context.h"
#include "Magnum/Version.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Version.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct ContextTest: TestSuite::Tester {
explicit ContextTest();
@ -142,6 +142,6 @@ void ContextTest::debugDetectedDrivers() {
#endif
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::ContextTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::ContextTest)

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

@ -25,19 +25,19 @@
#include <Corrade/TestSuite/Compare/Container.h>
#include "Magnum/BufferImage.h"
#include "Magnum/CubeMapTextureArray.h"
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/Image.h"
#include "Magnum/ImageFormat.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/PixelFormat.h"
#include "Magnum/TextureFormat.h"
#include "Magnum/GL/BufferImage.h"
#include "Magnum/GL/CubeMapTextureArray.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/ImageFormat.h"
#include "Magnum/GL/OpenGLTester.h"
#include "Magnum/GL/PixelFormat.h"
#include "Magnum/GL/TextureFormat.h"
#include "Magnum/Math/Color.h"
#include "Magnum/Math/Range.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct CubeMapTextureArrayGLTest: OpenGLTester {
explicit CubeMapTextureArrayGLTest();
@ -323,30 +323,30 @@ CubeMapTextureArrayGLTest::CubeMapTextureArrayGLTest() {
void CubeMapTextureArrayGLTest::construct() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
{
CubeMapTextureArray texture;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(texture.id() > 0);
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void CubeMapTextureArrayGLTest::wrap() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
GLuint id;
@ -365,40 +365,40 @@ void CubeMapTextureArrayGLTest::wrap() {
void CubeMapTextureArrayGLTest::bind() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
CubeMapTextureArray texture;
texture.bind(15);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbind(15);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::bind(7, {&texture, nullptr, &texture});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbind(7, 3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void CubeMapTextureArrayGLTest::bindImage() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::shader_image_load_store>())
CORRADE_SKIP(Extensions::GL::ARB::shader_image_load_store::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::shader_image_load_store>())
CORRADE_SKIP(Extensions::ARB::shader_image_load_store::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 is not supported.");
#endif
@ -407,23 +407,23 @@ void CubeMapTextureArrayGLTest::bindImage() {
texture.setStorage(1, TextureFormat::RGBA8, {32, 32, 12})
.bindImage(2, 0, 1, ImageAccess::ReadWrite, ImageFormat::RGBA8);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
texture.bindImageLayered(3, 0, ImageAccess::ReadWrite, ImageFormat::RGBA8);
AbstractTexture::unbindImage(2);
AbstractTexture::unbindImage(3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
AbstractTexture::bindImages(1, {&texture, nullptr, &texture});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbindImages(1, 3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#endif
}
@ -432,11 +432,11 @@ template<class T> void CubeMapTextureArrayGLTest::sampling() {
"sampling<GenericSampler>" : "sampling<GLSampler>");
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
CubeMapTextureArray texture;
@ -456,114 +456,114 @@ template<class T> void CubeMapTextureArrayGLTest::sampling() {
.setWrapping(T::Wrapping::ClampToEdge)
#endif
.setMaxAnisotropy(Sampler::maxMaxAnisotropy())
.setCompareMode(Sampler::CompareMode::CompareRefToTexture)
.setCompareFunction(Sampler::CompareFunction::GreaterOrEqual);
.setCompareMode(SamplerCompareMode::CompareRefToTexture)
.setCompareFunction(SamplerCompareFunction::GreaterOrEqual);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void CubeMapTextureArrayGLTest::samplingSRGBDecode() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_sRGB_decode>())
CORRADE_SKIP(Extensions::GL::EXT::texture_sRGB_decode::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_sRGB_decode>())
CORRADE_SKIP(Extensions::EXT::texture_sRGB_decode::string() + std::string(" is not supported."));
CubeMapTextureArray texture;
texture.setSRGBDecode(false);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void CubeMapTextureArrayGLTest::samplingBorderInteger() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_integer>())
CORRADE_SKIP(Extensions::GL::EXT::texture_integer::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_integer>())
CORRADE_SKIP(Extensions::EXT::texture_integer::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_border_clamp>())
CORRADE_SKIP(Extensions::GL::EXT::texture_border_clamp::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_border_clamp>())
CORRADE_SKIP(Extensions::EXT::texture_border_clamp::string() + std::string(" is not supported."));
#endif
CubeMapTextureArray a;
a.setWrapping(Sampler::Wrapping::ClampToBorder)
a.setWrapping(SamplerWrapping::ClampToBorder)
.setBorderColor(Vector4i(1, 56, 78, -2));
CubeMapTextureArray b;
b.setWrapping(Sampler::Wrapping::ClampToBorder)
b.setWrapping(SamplerWrapping::ClampToBorder)
.setBorderColor(Vector4ui(35, 56, 78, 15));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void CubeMapTextureArrayGLTest::samplingSwizzle() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_swizzle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_swizzle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_swizzle>())
CORRADE_SKIP(Extensions::ARB::texture_swizzle::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
CubeMapTextureArray texture;
texture.setSwizzle<'b', 'g', 'r', '0'>();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void CubeMapTextureArrayGLTest::samplingDepthStencilMode() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::stencil_texturing>())
CORRADE_SKIP(Extensions::GL::ARB::stencil_texturing::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::stencil_texturing>())
CORRADE_SKIP(Extensions::ARB::stencil_texturing::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
CubeMapTextureArray texture;
texture.setDepthStencilMode(Sampler::DepthStencilMode::StencilIndex);
texture.setDepthStencilMode(SamplerDepthStencilMode::StencilIndex);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#ifdef MAGNUM_TARGET_GLES
void CubeMapTextureArrayGLTest::samplingBorder() {
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_border_clamp>())
CORRADE_SKIP(Extensions::GL::EXT::texture_border_clamp::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_border_clamp>())
CORRADE_SKIP(Extensions::EXT::texture_border_clamp::string() + std::string(" is not supported."));
CubeMapTextureArray texture;
texture.setWrapping(Sampler::Wrapping::ClampToBorder)
texture.setWrapping(SamplerWrapping::ClampToBorder)
.setBorderColor(Color3(0.5f));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
void CubeMapTextureArrayGLTest::storage() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
CubeMapTextureArray texture;
texture.setStorage(5, TextureFormat::RGBA8, {32, 32, 24});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.imageSize(0), Vector3i(32, 32, 24));
CORRADE_COMPARE(texture.imageSize(1), Vector3i(16, 16, 24));
@ -572,18 +572,18 @@ void CubeMapTextureArrayGLTest::storage() {
CORRADE_COMPARE(texture.imageSize(4), Vector3i( 2, 2, 24));
CORRADE_COMPARE(texture.imageSize(5), Vector3i(0)); /* not available */
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void CubeMapTextureArrayGLTest::image() {
setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name);
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
CubeMapTextureArray texture;
@ -592,13 +592,13 @@ void CubeMapTextureArrayGLTest::image() {
PixelFormat::RGBA, PixelType::UnsignedByte, {2, 2, 6},
PixelStorageData[testCaseInstanceId()].dataSparse});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
Image3D image = texture.image(0, {PixelStorageData[testCaseInstanceId()].storage, PixelFormat::RGBA, PixelType::UnsignedByte});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset),
@ -611,11 +611,11 @@ void CubeMapTextureArrayGLTest::imageBuffer() {
setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name);
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
CubeMapTextureArray texture;
@ -625,7 +625,7 @@ void CubeMapTextureArrayGLTest::imageBuffer() {
PixelStorageData[testCaseInstanceId()].dataSparse,
BufferUsage::StaticDraw});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
@ -633,7 +633,7 @@ void CubeMapTextureArrayGLTest::imageBuffer() {
PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorageData[testCaseInstanceId()].offset),
@ -646,18 +646,18 @@ void CubeMapTextureArrayGLTest::compressedImage() {
setTestCaseDescription(CompressedPixelStorageData[testCaseInstanceId()].name);
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
#ifndef MAGNUM_TARGET_GLES
if(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::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() + std::string(" is not supported."));
#endif
CubeMapTextureArray texture;
@ -668,12 +668,12 @@ void CubeMapTextureArrayGLTest::compressedImage() {
CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 6},
CompressedPixelStorageData[testCaseInstanceId()].dataSparse});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
CompressedImage3D image = texture.compressedImage(0, {CompressedPixelStorageData[testCaseInstanceId()].storage});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 6}));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorageData[testCaseInstanceId()].offset),
@ -686,18 +686,18 @@ void CubeMapTextureArrayGLTest::compressedImageBuffer() {
setTestCaseDescription(CompressedPixelStorageData[testCaseInstanceId()].name);
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
#ifndef MAGNUM_TARGET_GLES
if(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::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() + std::string(" is not supported."));
#endif
CubeMapTextureArray texture;
@ -709,14 +709,14 @@ void CubeMapTextureArrayGLTest::compressedImageBuffer() {
CompressedPixelStorageData[testCaseInstanceId()].dataSparse,
BufferUsage::StaticDraw});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
CompressedBufferImage3D image = texture.compressedImage(0, {CompressedPixelStorageData[testCaseInstanceId()].storage}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 6}));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(CompressedPixelStorageData[testCaseInstanceId()].offset),
@ -766,11 +766,11 @@ void CubeMapTextureArrayGLTest::subImage() {
setTestCaseDescription(SubPixelStorageData[testCaseInstanceId()].name);
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
CubeMapTextureArray texture;
@ -781,13 +781,13 @@ void CubeMapTextureArrayGLTest::subImage() {
PixelFormat::RGBA, PixelType::UnsignedByte, {2, 2, 4},
SubPixelStorageData[testCaseInstanceId()].dataSparse});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
Image3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(4, 4, 6));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()),
@ -799,11 +799,11 @@ void CubeMapTextureArrayGLTest::subImageBuffer() {
setTestCaseDescription(SubPixelStorageData[testCaseInstanceId()].name);
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
CubeMapTextureArray texture;
@ -815,14 +815,14 @@ void CubeMapTextureArrayGLTest::subImageBuffer() {
SubPixelStorageData[testCaseInstanceId()].dataSparse,
BufferUsage::StaticDraw});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
BufferImage3D image = texture.image(0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(4, 4, 6));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData),
@ -835,22 +835,22 @@ void CubeMapTextureArrayGLTest::subImageBuffer() {
void CubeMapTextureArrayGLTest::subImageQuery() {
setTestCaseDescription(SubPixelStorageData[testCaseInstanceId()].name);
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
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::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::get_texture_sub_image>())
CORRADE_SKIP(Extensions::ARB::get_texture_sub_image::string() + std::string(" is not supported."));
CubeMapTextureArray texture;
texture.setStorage(1, TextureFormat::RGBA8, {4, 4, 6})
.setSubImage(0, {}, ImageView3D{PixelFormat::RGBA, PixelType::UnsignedByte, {4, 4, 6}, SubDataComplete});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
Image3D image = texture.subImage(0, Range3Di::fromSize(Vector3i{1}, {2, 2, 4}),
{SubPixelStorageData[testCaseInstanceId()].storage,
PixelFormat::RGBA, PixelType::UnsignedByte});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 4));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(SubPixelStorageData[testCaseInstanceId()].offset),
@ -861,23 +861,23 @@ void CubeMapTextureArrayGLTest::subImageQuery() {
void CubeMapTextureArrayGLTest::subImageQueryBuffer() {
setTestCaseDescription(SubPixelStorageData[testCaseInstanceId()].name);
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
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::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::get_texture_sub_image>())
CORRADE_SKIP(Extensions::ARB::get_texture_sub_image::string() + std::string(" is not supported."));
CubeMapTextureArray texture;
texture.setStorage(1, TextureFormat::RGBA8, {4, 4, 6})
.setSubImage(0, {}, ImageView3D{PixelFormat::RGBA, PixelType::UnsignedByte, {4, 4, 6}, SubDataComplete});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
BufferImage3D image = texture.subImage(0, Range3Di::fromSize(Vector3i{1}, {2, 2, 4}),
{SubPixelStorageData[testCaseInstanceId()].storage,
PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 4));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(SubPixelStorageData[testCaseInstanceId()].offset),
@ -958,18 +958,18 @@ void CubeMapTextureArrayGLTest::compressedSubImage() {
setTestCaseDescription(CompressedSubPixelStorageData[testCaseInstanceId()].name);
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
#ifndef MAGNUM_TARGET_GLES
if(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::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() + std::string(" is not supported."));
#endif
CubeMapTextureArray texture;
@ -982,12 +982,12 @@ void CubeMapTextureArrayGLTest::compressedSubImage() {
CompressedPixelFormat::RGBAS3tcDxt3, Vector3i{4},
CompressedSubPixelStorageData[testCaseInstanceId()].dataSparse});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
CompressedImage3D image = texture.compressedImage(0, {});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{12, 12, 6}));
@ -1006,18 +1006,18 @@ void CubeMapTextureArrayGLTest::compressedSubImageBuffer() {
setTestCaseDescription(CompressedSubPixelStorageData[testCaseInstanceId()].name);
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
#ifndef MAGNUM_TARGET_GLES
if(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::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() + std::string(" is not supported."));
#endif
CubeMapTextureArray texture;
@ -1031,14 +1031,14 @@ void CubeMapTextureArrayGLTest::compressedSubImageBuffer() {
CompressedSubPixelStorageData[testCaseInstanceId()].dataSparse,
BufferUsage::StaticDraw});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
CompressedBufferImage3D image = texture.compressedImage(0, {}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{12, 12, 6}));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData), Containers::arrayView(CompressedSubDataComplete),
@ -1050,26 +1050,26 @@ void CubeMapTextureArrayGLTest::compressedSubImageBuffer() {
void CubeMapTextureArrayGLTest::compressedSubImageQuery() {
setTestCaseDescription(CompressedSubPixelStorageData[testCaseInstanceId()].name);
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
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."));
if(CompressedSubPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported."));
if(CompressedSubPixelStorageData[testCaseInstanceId()].storage == CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::internalformat_query2>())
CORRADE_SKIP(Extensions::GL::ARB::internalformat_query2::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::get_texture_sub_image>())
CORRADE_SKIP(Extensions::ARB::get_texture_sub_image::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
if(CompressedSubPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported."));
if(CompressedSubPixelStorageData[testCaseInstanceId()].storage == CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::ARB::internalformat_query2>())
CORRADE_SKIP(Extensions::ARB::internalformat_query2::string() + std::string(" is not supported."));
CubeMapTextureArray texture;
texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, {12, 12, 6})
.setCompressedSubImage(0, {}, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, {12, 12, 6}, CompressedSubDataComplete});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CompressedImage3D image = texture.compressedSubImage(0, Range3Di::fromSize({4, 4, 1}, Vector3i{4}), {CompressedSubPixelStorageData[testCaseInstanceId()].storage});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedSubPixelStorageData[testCaseInstanceId()].offset),
@ -1080,27 +1080,27 @@ void CubeMapTextureArrayGLTest::compressedSubImageQuery() {
void CubeMapTextureArrayGLTest::compressedSubImageQueryBuffer() {
setTestCaseDescription(CompressedSubPixelStorageData[testCaseInstanceId()].name);
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
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."));
if(CompressedSubPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported."));
if(CompressedSubPixelStorageData[testCaseInstanceId()].storage == CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::internalformat_query2>())
CORRADE_SKIP(Extensions::GL::ARB::internalformat_query2::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::get_texture_sub_image>())
CORRADE_SKIP(Extensions::ARB::get_texture_sub_image::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
if(CompressedSubPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported."));
if(CompressedSubPixelStorageData[testCaseInstanceId()].storage == CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::ARB::internalformat_query2>())
CORRADE_SKIP(Extensions::ARB::internalformat_query2::string() + std::string(" is not supported."));
CubeMapTextureArray texture;
texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, {12, 12, 6})
.setCompressedSubImage(0, {}, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, {12, 12, 6}, CompressedSubDataComplete});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CompressedBufferImage3D image = texture.compressedSubImage(0, Range3Di::fromSize({4, 4, 1}, Vector3i{4}), {CompressedSubPixelStorageData[testCaseInstanceId()].storage}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(CompressedSubPixelStorageData[testCaseInstanceId()].offset),
@ -1111,13 +1111,13 @@ void CubeMapTextureArrayGLTest::compressedSubImageQueryBuffer() {
void CubeMapTextureArrayGLTest::generateMipmap() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::framebuffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::framebuffer_object>())
CORRADE_SKIP(Extensions::ARB::framebuffer_object::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
CubeMapTextureArray texture;
@ -1129,7 +1129,7 @@ void CubeMapTextureArrayGLTest::generateMipmap() {
texture.generateMipmap();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.imageSize(0), Vector3i(32, 32, 24));
CORRADE_COMPARE(texture.imageSize(1), Vector3i(16, 16, 24));
@ -1138,41 +1138,41 @@ void CubeMapTextureArrayGLTest::generateMipmap() {
CORRADE_COMPARE(texture.imageSize(4), Vector3i( 2, 2, 24));
CORRADE_COMPARE(texture.imageSize(5), Vector3i( 1, 1, 24));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void CubeMapTextureArrayGLTest::invalidateImage() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
CubeMapTextureArray texture;
texture.setStorage(2, TextureFormat::RGBA8, {32, 32, 24});
texture.invalidateImage(1);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void CubeMapTextureArrayGLTest::invalidateSubImage() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_cube_map_array>())
CORRADE_SKIP(Extensions::EXT::texture_cube_map_array::string() + std::string(" is not supported."));
#endif
CubeMapTextureArray texture;
texture.setStorage(2, TextureFormat::RGBA8, {32, 32, 24});
texture.invalidateSubImage(1, Vector3i(2), Vector3i(8));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::CubeMapTextureArrayGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::CubeMapTextureArrayGLTest)

8
src/Magnum/GL/Test/CubeMapTextureArrayTest.cpp

@ -25,9 +25,9 @@
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/CubeMapTextureArray.h"
#include "Magnum/GL/CubeMapTextureArray.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct CubeMapTextureArrayTest: TestSuite::Tester {
explicit CubeMapTextureArrayTest();
@ -48,6 +48,6 @@ void CubeMapTextureArrayTest::constructNoCreate() {
CORRADE_VERIFY(true);
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::CubeMapTextureArrayTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::CubeMapTextureArrayTest)

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

@ -25,23 +25,23 @@
#include <Corrade/TestSuite/Compare/Container.h>
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/Image.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#ifndef MAGNUM_TARGET_GLES2
#include "Magnum/BufferImage.h"
#include "Magnum/GL/BufferImage.h"
#endif
#include "Magnum/CubeMapTexture.h"
#include "Magnum/Image.h"
#include "Magnum/GL/CubeMapTexture.h"
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#include "Magnum/ImageFormat.h"
#include "Magnum/GL/ImageFormat.h"
#endif
#include "Magnum/OpenGLTester.h"
#include "Magnum/PixelFormat.h"
#include "Magnum/TextureFormat.h"
#include "Magnum/GL/OpenGLTester.h"
#include "Magnum/GL/PixelFormat.h"
#include "Magnum/GL/TextureFormat.h"
#include "Magnum/Math/Color.h"
#include "Magnum/Math/Range.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct CubeMapTextureGLTest: OpenGLTester {
explicit CubeMapTextureGLTest();
@ -389,11 +389,11 @@ void CubeMapTextureGLTest::construct() {
{
CubeMapTexture texture;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(texture.id() > 0);
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void CubeMapTextureGLTest::wrap() {
@ -415,26 +415,26 @@ void CubeMapTextureGLTest::bind() {
CubeMapTexture texture;
texture.bind(15);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbind(15);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::bind(7, {&texture, nullptr, &texture});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbind(7, 3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void CubeMapTextureGLTest::bindImage() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::shader_image_load_store>())
CORRADE_SKIP(Extensions::GL::ARB::shader_image_load_store::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::shader_image_load_store>())
CORRADE_SKIP(Extensions::ARB::shader_image_load_store::string() + std::string(" is not supported."));
#else
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 is not supported.");
@ -444,23 +444,23 @@ void CubeMapTextureGLTest::bindImage() {
texture.setStorage(1, TextureFormat::RGBA8, Vector2i{32})
.bindImage(2, 0, CubeMapCoordinate::NegativeX, ImageAccess::ReadWrite, ImageFormat::RGBA8);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
texture.bindImageLayered(3, 0, ImageAccess::ReadWrite, ImageFormat::RGBA8);
AbstractTexture::unbindImage(2);
AbstractTexture::unbindImage(3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
AbstractTexture::bindImages(1, {&texture, nullptr, &texture});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbindImages(1, 3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#endif
}
#endif
@ -489,115 +489,115 @@ template<class T> void CubeMapTextureGLTest::sampling() {
#endif
.setMaxAnisotropy(Sampler::maxMaxAnisotropy())
#ifndef MAGNUM_TARGET_GLES2
.setCompareMode(Sampler::CompareMode::CompareRefToTexture)
.setCompareFunction(Sampler::CompareFunction::GreaterOrEqual)
.setCompareMode(SamplerCompareMode::CompareRefToTexture)
.setCompareFunction(SamplerCompareFunction::GreaterOrEqual)
#endif
;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#ifndef MAGNUM_TARGET_WEBGL
void CubeMapTextureGLTest::samplingSRGBDecode() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::sRGB>())
CORRADE_SKIP(Extensions::GL::EXT::sRGB::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::sRGB>())
CORRADE_SKIP(Extensions::EXT::sRGB::string() + std::string(" is not supported."));
#endif
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_sRGB_decode>())
CORRADE_SKIP(Extensions::GL::EXT::texture_sRGB_decode::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_sRGB_decode>())
CORRADE_SKIP(Extensions::EXT::texture_sRGB_decode::string() + std::string(" is not supported."));
CubeMapTexture texture;
texture.setSRGBDecode(false);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
#ifndef MAGNUM_TARGET_GLES2
void CubeMapTextureGLTest::samplingSwizzle() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_swizzle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_swizzle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_swizzle>())
CORRADE_SKIP(Extensions::ARB::texture_swizzle::string() + std::string(" is not supported."));
#endif
CubeMapTexture texture;
texture.setSwizzle<'b', 'g', 'r', '0'>();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#elif !defined(MAGNUM_TARGET_WEBGL)
void CubeMapTextureGLTest::samplingMaxLevel() {
if(!Context::current().isExtensionSupported<Extensions::GL::APPLE::texture_max_level>())
CORRADE_SKIP(Extensions::GL::APPLE::texture_max_level::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::APPLE::texture_max_level>())
CORRADE_SKIP(Extensions::APPLE::texture_max_level::string() + std::string(" is not supported."));
CubeMapTexture texture;
texture.setMaxLevel(750);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void CubeMapTextureGLTest::samplingCompare() {
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::shadow_samplers>() ||
!Context::current().isExtensionSupported<Extensions::GL::NV::shadow_samplers_cube>())
CORRADE_SKIP(Extensions::GL::NV::shadow_samplers_cube::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::shadow_samplers>() ||
!Context::current().isExtensionSupported<Extensions::NV::shadow_samplers_cube>())
CORRADE_SKIP(Extensions::NV::shadow_samplers_cube::string() + std::string(" is not supported."));
CubeMapTexture texture;
texture.setCompareMode(Sampler::CompareMode::CompareRefToTexture)
.setCompareFunction(Sampler::CompareFunction::GreaterOrEqual);
texture.setCompareMode(SamplerCompareMode::CompareRefToTexture)
.setCompareFunction(SamplerCompareFunction::GreaterOrEqual);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void CubeMapTextureGLTest::samplingBorderInteger() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_integer>())
CORRADE_SKIP(Extensions::GL::EXT::texture_integer::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_integer>())
CORRADE_SKIP(Extensions::EXT::texture_integer::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_border_clamp>())
CORRADE_SKIP(Extensions::GL::EXT::texture_border_clamp::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_border_clamp>())
CORRADE_SKIP(Extensions::EXT::texture_border_clamp::string() + std::string(" is not supported."));
#endif
CubeMapTexture a;
a.setWrapping(Sampler::Wrapping::ClampToBorder)
a.setWrapping(SamplerWrapping::ClampToBorder)
.setBorderColor(Vector4i(1, 56, 78, -2));
CubeMapTexture b;
b.setWrapping(Sampler::Wrapping::ClampToBorder)
b.setWrapping(SamplerWrapping::ClampToBorder)
.setBorderColor(Vector4ui(35, 56, 78, 15));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
#ifndef MAGNUM_TARGET_GLES2
void CubeMapTextureGLTest::samplingDepthStencilMode() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::stencil_texturing>())
CORRADE_SKIP(Extensions::GL::ARB::stencil_texturing::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::stencil_texturing>())
CORRADE_SKIP(Extensions::ARB::stencil_texturing::string() + std::string(" is not supported."));
#else
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 not supported.");
#endif
CubeMapTexture texture;
texture.setDepthStencilMode(Sampler::DepthStencilMode::StencilIndex);
texture.setDepthStencilMode(SamplerDepthStencilMode::StencilIndex);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
void CubeMapTextureGLTest::samplingBorder() {
if(!Context::current().isExtensionSupported<Extensions::GL::NV::texture_border_clamp>() &&
!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_border_clamp>())
if(!Context::current().isExtensionSupported<Extensions::NV::texture_border_clamp>() &&
!Context::current().isExtensionSupported<Extensions::EXT::texture_border_clamp>())
CORRADE_SKIP("No required extension is supported.");
CubeMapTexture texture;
texture.setWrapping(Sampler::Wrapping::ClampToBorder)
texture.setWrapping(SamplerWrapping::ClampToBorder)
.setBorderColor(Color3(0.5f));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
@ -611,7 +611,7 @@ void CubeMapTextureGLTest::storage() {
#endif
Vector2i(32));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES2
#ifdef MAGNUM_TARGET_GLES
@ -627,7 +627,7 @@ void CubeMapTextureGLTest::storage() {
/* Not available */
CORRADE_COMPARE(texture.imageSize(5), Vector2i(0));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#endif
}
@ -640,8 +640,8 @@ void CubeMapTextureGLTest::image() {
#ifdef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_WEBGL
if(PixelStorageData[testCaseInstanceId()].storage != PixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::EXT::unpack_subimage>())
CORRADE_SKIP(Extensions::GL::EXT::unpack_subimage::string() + std::string(" is not supported."));
if(PixelStorageData[testCaseInstanceId()].storage != PixelStorage{} && !Context::current().isExtensionSupported<Extensions::EXT::unpack_subimage>())
CORRADE_SKIP(Extensions::EXT::unpack_subimage::string() + std::string(" is not supported."));
#else
if(PixelStorageData[testCaseInstanceId()].storage != PixelStorage{})
CORRADE_SKIP("Image unpack is not supported in WebGL 1.");
@ -669,7 +669,7 @@ void CubeMapTextureGLTest::image() {
texture.setImage(CubeMapCoordinate::NegativeZ, 0, format,
ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
@ -677,7 +677,7 @@ void CubeMapTextureGLTest::image() {
{PixelStorageData[testCaseInstanceId()].storage,
PixelFormat::RGBA, PixelType::UnsignedByte});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset),
@ -707,7 +707,7 @@ void CubeMapTextureGLTest::imageBuffer() {
texture.setImage(CubeMapCoordinate::NegativeZ, 0, TextureFormat::RGBA8,
ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), Zero});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
@ -715,7 +715,7 @@ void CubeMapTextureGLTest::imageBuffer() {
{PixelStorageData[testCaseInstanceId()].storage, PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorageData[testCaseInstanceId()].offset),
@ -741,8 +741,8 @@ void CubeMapTextureGLTest::subImage() {
#ifdef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_WEBGL
if(PixelStorageData[testCaseInstanceId()].storage != PixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::EXT::unpack_subimage>())
CORRADE_SKIP(Extensions::GL::EXT::unpack_subimage::string() + std::string(" is not supported."));
if(PixelStorageData[testCaseInstanceId()].storage != PixelStorage{} && !Context::current().isExtensionSupported<Extensions::EXT::unpack_subimage>())
CORRADE_SKIP(Extensions::EXT::unpack_subimage::string() + std::string(" is not supported."));
#else
if(PixelStorageData[testCaseInstanceId()].storage != PixelStorage{})
CORRADE_SKIP("Image unpack is not supported in WebGL 1.");
@ -773,13 +773,13 @@ void CubeMapTextureGLTest::subImage() {
PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2),
PixelStorageData[testCaseInstanceId()].dataSparse});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
Image2D image = texture.image(CubeMapCoordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(4));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()),
@ -810,14 +810,14 @@ void CubeMapTextureGLTest::subImageBuffer() {
PixelStorageData[testCaseInstanceId()].dataSparse,
BufferUsage::StaticDraw});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
BufferImage2D image = texture.image(CubeMapCoordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(4));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData),
@ -831,23 +831,23 @@ void CubeMapTextureGLTest::subImageBuffer() {
void CubeMapTextureGLTest::subImageQuery() {
setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name);
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::ARB::get_texture_sub_image>())
CORRADE_SKIP(Extensions::ARB::get_texture_sub_image::string() + std::string(" is not supported."));
/* I'm too lazy to call setSubImage() six times */
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::direct_state_access>())
CORRADE_SKIP(Extensions::GL::ARB::direct_state_access::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::direct_state_access>())
CORRADE_SKIP(Extensions::ARB::direct_state_access::string() + std::string(" is not supported."));
CubeMapTexture texture;
texture.setStorage(1, TextureFormat::RGBA8, Vector2i{4})
.setSubImage(0, {}, ImageView3D{PixelFormat::RGBA, PixelType::UnsignedByte, {4, 4, 1}, SubDataComplete});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
Image3D image = texture.subImage(0, Range3Di::fromSize({1, 1, 0}, {2, 2, 1}),
{PixelStorageData[testCaseInstanceId()].storage,
PixelFormat::RGBA, PixelType::UnsignedByte});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 1));
CORRADE_COMPARE_AS(Containers::arrayCast<const UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset),
@ -858,24 +858,24 @@ void CubeMapTextureGLTest::subImageQuery() {
void CubeMapTextureGLTest::subImageQueryBuffer() {
setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name);
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::ARB::get_texture_sub_image>())
CORRADE_SKIP(Extensions::ARB::get_texture_sub_image::string() + std::string(" is not supported."));
/* I'm too lazy to call setSubImage() six times */
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::direct_state_access>())
CORRADE_SKIP(Extensions::GL::ARB::direct_state_access::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::direct_state_access>())
CORRADE_SKIP(Extensions::ARB::direct_state_access::string() + std::string(" is not supported."));
CubeMapTexture texture;
texture.setStorage(1, TextureFormat::RGBA8, Vector2i{4})
.setSubImage(0, {}, ImageView3D{PixelFormat::RGBA, PixelType::UnsignedByte, {4, 4, 1}, SubDataComplete});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
BufferImage3D image = texture.subImage(0, Range3Di::fromSize({1, 1, 0}, {2, 2, 1}),
{PixelStorageData[testCaseInstanceId()].storage,
PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 1));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorageData[testCaseInstanceId()].offset),
@ -888,16 +888,16 @@ void CubeMapTextureGLTest::compressedImage() {
setTestCaseDescription(CompressedPixelStorageData[testCaseInstanceId()].name);
#ifndef MAGNUM_TARGET_WEBGL
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::WEBGL::compressed_texture_s3tc>())
CORRADE_SKIP(Extensions::GL::WEBGL::compressed_texture_s3tc::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::WEBGL::compressed_texture_s3tc>())
CORRADE_SKIP(Extensions::WEBGL::compressed_texture_s3tc::string() + std::string(" is not supported."));
#endif
#ifndef MAGNUM_TARGET_GLES
if(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::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() + std::string(" is not supported."));
#endif
const CompressedImageView2D view{
@ -915,12 +915,12 @@ void CubeMapTextureGLTest::compressedImage() {
.setCompressedImage(CubeMapCoordinate::PositiveZ, 0, view)
.setCompressedImage(CubeMapCoordinate::NegativeZ, 0, view);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
CompressedImage2D image = texture.compressedImage(CubeMapCoordinate::PositiveX, 0, {CompressedPixelStorageData[testCaseInstanceId()].storage});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorageData[testCaseInstanceId()].offset),
@ -934,16 +934,16 @@ void CubeMapTextureGLTest::compressedImageBuffer() {
setTestCaseDescription(CompressedPixelStorageData[testCaseInstanceId()].name);
#ifndef MAGNUM_TARGET_WEBGL
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::WEBGL::compressed_texture_s3tc>())
CORRADE_SKIP(Extensions::GL::WEBGL::compressed_texture_s3tc::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::WEBGL::compressed_texture_s3tc>())
CORRADE_SKIP(Extensions::WEBGL::compressed_texture_s3tc::string() + std::string(" is not supported."));
#endif
#ifndef MAGNUM_TARGET_GLES
if(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::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() + std::string(" is not supported."));
#endif
CompressedBufferImage2D buffer{
@ -962,14 +962,14 @@ void CubeMapTextureGLTest::compressedImageBuffer() {
.setCompressedImage(CubeMapCoordinate::PositiveZ, 0, buffer)
.setCompressedImage(CubeMapCoordinate::NegativeZ, 0, buffer);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
CompressedBufferImage2D image = texture.compressedImage(CubeMapCoordinate::PositiveX, 0,
{CompressedPixelStorageData[testCaseInstanceId()].storage}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(CompressedPixelStorageData[testCaseInstanceId()].offset),
@ -984,18 +984,18 @@ void CubeMapTextureGLTest::immutableCompressedImage() {
setTestCaseDescription(CompressedPixelStorageData[testCaseInstanceId()].name);
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_storage>())
CORRADE_SKIP(Extensions::GL::ARB::texture_storage::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_storage>())
CORRADE_SKIP(Extensions::ARB::texture_storage::string() + std::string(" is not supported."));
#elif defined(MAGNUM_TARGET_GLES2)
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_storage>())
CORRADE_SKIP(Extensions::GL::EXT::texture_storage::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_storage>())
CORRADE_SKIP(Extensions::EXT::texture_storage::string() + std::string(" is not supported."));
#endif
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
#ifndef MAGNUM_TARGET_GLES
if(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::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() + std::string(" is not supported."));
#endif
/* Testing that GL_TEXTURE_COMPRESSED_IMAGE_SIZE is consistent and returns
@ -1021,12 +1021,12 @@ void CubeMapTextureGLTest::immutableCompressedImage() {
.setCompressedSubImage(CubeMapCoordinate::PositiveZ, 0, {}, view)
.setCompressedSubImage(CubeMapCoordinate::NegativeZ, 0, {}, view);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
CompressedImage2D image = texture.compressedImage(CubeMapCoordinate::NegativeY, 0, {CompressedPixelStorageData[testCaseInstanceId()].storage});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{4});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorageData[testCaseInstanceId()].offset),
@ -1071,16 +1071,16 @@ void CubeMapTextureGLTest::compressedSubImage() {
setTestCaseDescription(CompressedPixelStorageData[testCaseInstanceId()].name);
#ifndef MAGNUM_TARGET_WEBGL
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::WEBGL::compressed_texture_s3tc>())
CORRADE_SKIP(Extensions::GL::WEBGL::compressed_texture_s3tc::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::WEBGL::compressed_texture_s3tc>())
CORRADE_SKIP(Extensions::WEBGL::compressed_texture_s3tc::string() + std::string(" is not supported."));
#endif
#ifndef MAGNUM_TARGET_GLES
if(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::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() + std::string(" is not supported."));
#endif
CubeMapTexture texture;
@ -1103,17 +1103,17 @@ void CubeMapTextureGLTest::compressedSubImage() {
CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4},
CompressedPixelStorageData[testCaseInstanceId()].dataSparse});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
CompressedImage2D image = texture.compressedImage(CubeMapCoordinate::PositiveX, 0, {});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{12});
{
CORRADE_EXPECT_FAIL_IF(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && Context::current().isExtensionSupported<Extensions::GL::ARB::direct_state_access>() && (Context::current().detectedDriver() & Context::DetectedDriver::NVidia),
CORRADE_EXPECT_FAIL_IF(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && Context::current().isExtensionSupported<Extensions::ARB::direct_state_access>() && (Context::current().detectedDriver() & Context::DetectedDriver::NVidia),
"Non-default compressed pixel storage for cube map textures behaves weirdly on NVidia for client-memory images when using ARB_direct_state_access");
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()),
@ -1128,16 +1128,16 @@ void CubeMapTextureGLTest::compressedSubImageBuffer() {
setTestCaseDescription(CompressedPixelStorageData[testCaseInstanceId()].name);
#ifndef MAGNUM_TARGET_WEBGL
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::GL::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::WEBGL::compressed_texture_s3tc>())
CORRADE_SKIP(Extensions::GL::WEBGL::compressed_texture_s3tc::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::WEBGL::compressed_texture_s3tc>())
CORRADE_SKIP(Extensions::WEBGL::compressed_texture_s3tc::string() + std::string(" is not supported."));
#endif
#ifndef MAGNUM_TARGET_GLES
if(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::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() + std::string(" is not supported."));
#endif
CubeMapTexture texture;
@ -1161,14 +1161,14 @@ void CubeMapTextureGLTest::compressedSubImageBuffer() {
CompressedPixelStorageData[testCaseInstanceId()].dataSparse,
BufferUsage::StaticDraw});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
CompressedBufferImage2D image = texture.compressedImage(CubeMapCoordinate::PositiveX, 0,
{}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{12});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData),
@ -1182,27 +1182,27 @@ void CubeMapTextureGLTest::compressedSubImageBuffer() {
void CubeMapTextureGLTest::compressedSubImageQuery() {
setTestCaseDescription(CompressedPixelStorageData[testCaseInstanceId()].name);
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::ARB::get_texture_sub_image>())
CORRADE_SKIP(Extensions::ARB::get_texture_sub_image::string() + std::string(" is not supported."));
/* I'm too lazy to call setSubImage() six times */
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::direct_state_access>())
CORRADE_SKIP(Extensions::GL::ARB::direct_state_access::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."));
if(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported."));
if(CompressedPixelStorageData[testCaseInstanceId()].storage == CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::internalformat_query2>())
CORRADE_SKIP(Extensions::GL::ARB::internalformat_query2::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::direct_state_access>())
CORRADE_SKIP(Extensions::ARB::direct_state_access::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() + std::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() + std::string(" is not supported."));
if(CompressedPixelStorageData[testCaseInstanceId()].storage == CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::ARB::internalformat_query2>())
CORRADE_SKIP(Extensions::ARB::internalformat_query2::string() + std::string(" is not supported."));
CubeMapTexture texture;
texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, Vector2i{12})
.setCompressedSubImage(0, {}, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, {12, 12, 1}, CompressedSubDataComplete});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CompressedImage3D image = texture.compressedSubImage(0, Range3Di::fromSize({4, 4, 0}, {4, 4, 1}), {CompressedPixelStorageData[testCaseInstanceId()].storage});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 1}));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedPixelStorageData[testCaseInstanceId()].offset),
@ -1213,28 +1213,28 @@ void CubeMapTextureGLTest::compressedSubImageQuery() {
void CubeMapTextureGLTest::compressedSubImageQueryBuffer() {
setTestCaseDescription(CompressedPixelStorageData[testCaseInstanceId()].name);
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::ARB::get_texture_sub_image>())
CORRADE_SKIP(Extensions::ARB::get_texture_sub_image::string() + std::string(" is not supported."));
/* I'm too lazy to call setSubImage() six times */
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::direct_state_access>())
CORRADE_SKIP(Extensions::GL::ARB::direct_state_access::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."));
if(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported."));
if(CompressedPixelStorageData[testCaseInstanceId()].storage == CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::internalformat_query2>())
CORRADE_SKIP(Extensions::GL::ARB::internalformat_query2::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::direct_state_access>())
CORRADE_SKIP(Extensions::ARB::direct_state_access::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() + std::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() + std::string(" is not supported."));
if(CompressedPixelStorageData[testCaseInstanceId()].storage == CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::ARB::internalformat_query2>())
CORRADE_SKIP(Extensions::ARB::internalformat_query2::string() + std::string(" is not supported."));
CubeMapTexture texture;
texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, Vector2i{12})
.setCompressedSubImage(0, {}, CompressedImageView3D{CompressedPixelFormat::RGBAS3tcDxt3, {12, 12, 1}, CompressedSubDataComplete});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CompressedBufferImage3D image = texture.compressedSubImage(0, Range3Di::fromSize({4, 4, 0}, {4, 4, 1}), {CompressedPixelStorageData[testCaseInstanceId()].storage}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 1}));
CORRADE_COMPARE_AS(
@ -1248,8 +1248,8 @@ void CubeMapTextureGLTest::compressedSubImageQueryBuffer() {
void CubeMapTextureGLTest::fullImageQuery() {
setTestCaseDescription(FullPixelStorageData[testCaseInstanceId()].name);
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::direct_state_access>())
CORRADE_SKIP(Extensions::GL::ARB::direct_state_access::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::direct_state_access>())
CORRADE_SKIP(Extensions::ARB::direct_state_access::string() + std::string(" is not supported."));
CubeMapTexture texture;
texture.setStorage(1, TextureFormat::RGBA8, Vector2i{2, 2})
@ -1257,12 +1257,12 @@ void CubeMapTextureGLTest::fullImageQuery() {
PixelFormat::RGBA, PixelType::UnsignedByte, {2, 2, 6},
FullPixelStorageData[testCaseInstanceId()].data});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
Image3D image = texture.image(0,
{FullPixelStorageData[testCaseInstanceId()].storage, PixelFormat::RGBA, PixelType::UnsignedByte});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(FullPixelStorageData[testCaseInstanceId()].offset),
@ -1273,8 +1273,8 @@ void CubeMapTextureGLTest::fullImageQuery() {
void CubeMapTextureGLTest::fullImageQueryBuffer() {
setTestCaseDescription(FullPixelStorageData[testCaseInstanceId()].name);
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::direct_state_access>())
CORRADE_SKIP(Extensions::GL::ARB::direct_state_access::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::direct_state_access>())
CORRADE_SKIP(Extensions::ARB::direct_state_access::string() + std::string(" is not supported."));
CubeMapTexture texture;
texture.setStorage(1, TextureFormat::RGBA8, Vector2i{2})
@ -1283,13 +1283,13 @@ void CubeMapTextureGLTest::fullImageQueryBuffer() {
FullPixelStorageData[testCaseInstanceId()].data,
BufferUsage::StaticDraw});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
BufferImage3D image = texture.image(0,
{FullPixelStorageData[testCaseInstanceId()].storage, PixelFormat::RGBA,
PixelType::UnsignedByte}, BufferUsage::StaticRead);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6));
const auto imageData = image.buffer().data();
@ -1300,12 +1300,12 @@ void CubeMapTextureGLTest::fullImageQueryBuffer() {
void CubeMapTextureGLTest::compressedFullImageQuery() {
setTestCaseDescription(CompressedFullPixelStorageData[testCaseInstanceId()].name);
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::direct_state_access>())
CORRADE_SKIP(Extensions::GL::ARB::direct_state_access::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."));
if(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::direct_state_access>())
CORRADE_SKIP(Extensions::ARB::direct_state_access::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() + std::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() + std::string(" is not supported."));
CubeMapTexture texture;
texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, Vector2i{4})
@ -1313,11 +1313,11 @@ void CubeMapTextureGLTest::compressedFullImageQuery() {
CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 6},
CompressedFullPixelStorageData[testCaseInstanceId()].data});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CompressedImage3D image = texture.compressedImage(0, {CompressedFullPixelStorageData[testCaseInstanceId()].storage});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 6}));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(CompressedFullPixelStorageData[testCaseInstanceId()].offset),
@ -1328,12 +1328,12 @@ void CubeMapTextureGLTest::compressedFullImageQuery() {
void CubeMapTextureGLTest::compressedFullImageQueryBuffer() {
setTestCaseDescription(CompressedFullPixelStorageData[testCaseInstanceId()].name);
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::direct_state_access>())
CORRADE_SKIP(Extensions::GL::ARB::direct_state_access::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."));
if(CompressedPixelStorageData[testCaseInstanceId()].storage != CompressedPixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::direct_state_access>())
CORRADE_SKIP(Extensions::ARB::direct_state_access::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_compression_s3tc>())
CORRADE_SKIP(Extensions::EXT::texture_compression_s3tc::string() + std::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() + std::string(" is not supported."));
CubeMapTexture texture;
texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, Vector2i{4})
@ -1342,11 +1342,11 @@ void CubeMapTextureGLTest::compressedFullImageQueryBuffer() {
CompressedFullPixelStorageData[testCaseInstanceId()].data,
BufferUsage::StaticDraw});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CompressedBufferImage3D image = texture.compressedImage(0, {CompressedFullPixelStorageData[testCaseInstanceId()].storage}, BufferUsage::StaticRead);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), (Vector3i{4, 4, 6}));
const auto imageData = image.buffer().data();
@ -1385,7 +1385,7 @@ void CubeMapTextureGLTest::generateMipmap() {
texture.generateMipmap();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
@ -1396,7 +1396,7 @@ void CubeMapTextureGLTest::generateMipmap() {
CORRADE_COMPARE(texture.imageSize(4), Vector2i( 2));
CORRADE_COMPARE(texture.imageSize(5), Vector2i( 1));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#endif
}
@ -1411,7 +1411,7 @@ void CubeMapTextureGLTest::invalidateImage() {
Vector2i(32));
texture.invalidateImage(1);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void CubeMapTextureGLTest::invalidateSubImage() {
@ -1435,10 +1435,10 @@ void CubeMapTextureGLTest::invalidateSubImage() {
"Broken on Mesa.");
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::CubeMapTextureGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::CubeMapTextureGLTest)

8
src/Magnum/GL/Test/CubeMapTextureTest.cpp

@ -25,9 +25,9 @@
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/CubeMapTexture.h"
#include "Magnum/GL/CubeMapTexture.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct CubeMapTextureTest: TestSuite::Tester {
explicit CubeMapTextureTest();
@ -48,6 +48,6 @@ void CubeMapTextureTest::constructNoCreate() {
CORRADE_VERIFY(true);
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::CubeMapTextureTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::CubeMapTextureTest)

66
src/Magnum/GL/Test/DebugOutputGLTest.cpp

@ -25,12 +25,12 @@
#include <sstream>
#include "Magnum/Context.h"
#include "Magnum/DebugOutput.h"
#include "Magnum/Extensions.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/DebugOutput.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/OpenGLTester.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct DebugOutputGLTest: OpenGLTester {
explicit DebugOutputGLTest();
@ -61,32 +61,32 @@ DebugOutputGLTest::DebugOutputGLTest() {
}
void DebugOutputGLTest::setCallback() {
if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>())
CORRADE_SKIP(Extensions::GL::KHR::debug::string() + std::string(" is not supported"));
if(!Context::current().isExtensionSupported<Extensions::KHR::debug>())
CORRADE_SKIP(Extensions::KHR::debug::string() + std::string(" is not supported"));
/* Need to be careful, because the test runner is using debug output too */
DebugOutput::setDefaultCallback();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void DebugOutputGLTest::setEnabled() {
if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>())
CORRADE_SKIP(Extensions::GL::KHR::debug::string() + std::string(" is not supported"));
if(!Context::current().isExtensionSupported<Extensions::KHR::debug>())
CORRADE_SKIP(Extensions::KHR::debug::string() + std::string(" is not supported"));
/* Try at least some combinations */
DebugOutput::setEnabled(DebugOutput::Source::Application, true);
DebugOutput::setEnabled(DebugOutput::Source::Application, DebugOutput::Type::UndefinedBehavior, {3168, 35487, 234487}, false);
DebugOutput::setEnabled(true);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void DebugOutputGLTest::messageNoOp() {
if(Context::current().isExtensionSupported<Extensions::GL::KHR::debug>() ||
Context::current().isExtensionSupported<Extensions::GL::EXT::debug_marker>()
if(Context::current().isExtensionSupported<Extensions::KHR::debug>() ||
Context::current().isExtensionSupported<Extensions::EXT::debug_marker>()
#ifndef MAGNUM_TARGET_GLES
|| Context::current().isExtensionSupported<Extensions::GL::GREMEDY::string_marker>()
|| Context::current().isExtensionSupported<Extensions::GREMEDY::string_marker>()
#endif
)
CORRADE_SKIP("The extensions are supported, cannot test.");
@ -94,12 +94,12 @@ void DebugOutputGLTest::messageNoOp() {
DebugMessage::insert(DebugMessage::Source::Application, DebugMessage::Type::Marker,
1337, DebugOutput::Severity::Notification, "Hello from OpenGL command stream!");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void DebugOutputGLTest::message() {
if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>())
CORRADE_SKIP(Extensions::GL::KHR::debug::string() + std::string(" is not supported"));
if(!Context::current().isExtensionSupported<Extensions::KHR::debug>())
CORRADE_SKIP(Extensions::KHR::debug::string() + std::string(" is not supported"));
/* Need to be careful, because the test runner is using debug output too */
std::ostringstream out;
@ -107,16 +107,16 @@ void DebugOutputGLTest::message() {
DebugMessage::insert(DebugMessage::Source::Application, DebugMessage::Type::Marker,
1337, DebugOutput::Severity::High, "Hello from OpenGL command stream!");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(out.str(),
"Debug output: high severity application marker (1337): Hello from OpenGL command stream!\n");
}
void DebugOutputGLTest::messageFallback() {
if(Context::current().isExtensionSupported<Extensions::GL::KHR::debug>() ||
(!Context::current().isExtensionSupported<Extensions::GL::EXT::debug_marker>()
if(Context::current().isExtensionSupported<Extensions::KHR::debug>() ||
(!Context::current().isExtensionSupported<Extensions::EXT::debug_marker>()
#ifndef MAGNUM_TARGET_GLES
&& !Context::current().isExtensionSupported<Extensions::GL::GREMEDY::string_marker>()
&& !Context::current().isExtensionSupported<Extensions::GREMEDY::string_marker>()
#endif
))
CORRADE_SKIP("No proper extension is supported");
@ -124,24 +124,24 @@ void DebugOutputGLTest::messageFallback() {
DebugMessage::insert(DebugMessage::Source::Application, DebugMessage::Type::Marker,
1337, DebugOutput::Severity::Notification, "Hello from OpenGL command stream!");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void DebugOutputGLTest::groupNoOp() {
if(Context::current().isExtensionSupported<Extensions::GL::KHR::debug>() ||
Context::current().isExtensionSupported<Extensions::GL::EXT::debug_marker>())
if(Context::current().isExtensionSupported<Extensions::KHR::debug>() ||
Context::current().isExtensionSupported<Extensions::EXT::debug_marker>())
CORRADE_SKIP("The extensions are supported, cannot test.");
{
DebugGroup g{DebugGroup::Source::Application, 1337, "Debug group"};
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void DebugOutputGLTest::group() {
if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>())
CORRADE_SKIP(Extensions::GL::KHR::debug::string() + std::string(" is not supported"));
if(!Context::current().isExtensionSupported<Extensions::KHR::debug>())
CORRADE_SKIP(Extensions::KHR::debug::string() + std::string(" is not supported"));
/* Need to be careful, because the test runner is using debug output too */
std::ostringstream out;
@ -153,7 +153,7 @@ void DebugOutputGLTest::group() {
g2.pop();
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(out.str(),
"Debug output: application debug group enter (42): Automatic debug group\n"
"Debug output: third party debug group enter (1337): Manual debug group\n"
@ -162,17 +162,17 @@ void DebugOutputGLTest::group() {
}
void DebugOutputGLTest::groupFallback() {
if(Context::current().isExtensionSupported<Extensions::GL::KHR::debug>() ||
!Context::current().isExtensionSupported<Extensions::GL::EXT::debug_marker>())
if(Context::current().isExtensionSupported<Extensions::KHR::debug>() ||
!Context::current().isExtensionSupported<Extensions::EXT::debug_marker>())
CORRADE_SKIP("No proper extension is supported");
{
DebugGroup g{DebugGroup::Source::Application, 1337, "Debug group"};
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::DebugOutputGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::DebugOutputGLTest)

8
src/Magnum/GL/Test/DebugOutputTest.cpp

@ -26,9 +26,9 @@
#include <sstream>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/DebugOutput.h"
#include "Magnum/GL/DebugOutput.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct DebugOutputTest: TestSuite::Tester {
explicit DebugOutputTest();
@ -90,6 +90,6 @@ void DebugOutputTest::debugGroupSource() {
CORRADE_COMPARE(o.str(), "GL::DebugGroup::Source::ThirdParty GL::DebugGroup::Source(0xdead)\n");
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::DebugOutputTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::DebugOutputTest)

8
src/Magnum/GL/Test/DefaultFramebufferTest.cpp

@ -26,9 +26,9 @@
#include <sstream>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/DefaultFramebuffer.h"
#include "Magnum/GL/DefaultFramebuffer.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct DefaultFramebufferTest: TestSuite::Tester {
explicit DefaultFramebufferTest();
@ -47,6 +47,6 @@ void DefaultFramebufferTest::debugStatus() {
CORRADE_COMPARE(out.str(), "GL::DefaultFramebuffer::Status::Complete GL::DefaultFramebuffer::Status(0xdead)\n");
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::DefaultFramebufferTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::DefaultFramebufferTest)

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

File diff suppressed because it is too large Load Diff

8
src/Magnum/GL/Test/FramebufferTest.cpp

@ -26,9 +26,9 @@
#include <sstream>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Framebuffer.h"
#include "Magnum/GL/Framebuffer.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct FramebufferTest: TestSuite::Tester {
explicit FramebufferTest();
@ -60,6 +60,6 @@ void FramebufferTest::debugStatus() {
CORRADE_COMPARE(out.str(), "GL::Framebuffer::Status::IncompleteMissingAttachment GL::Framebuffer::Status(0xdead)\n");
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::FramebufferTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::FramebufferTest)

225
src/Magnum/GL/Test/MeshGLTest.cpp

@ -23,19 +23,20 @@
DEALINGS IN THE SOFTWARE.
*/
#include "Magnum/AbstractShaderProgram.h"
#include "Magnum/Buffer.h"
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/Framebuffer.h"
#include "Magnum/Image.h"
#include "Magnum/Mesh.h"
#include "Magnum/MeshView.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/PixelFormat.h"
#include "Magnum/Renderbuffer.h"
#include "Magnum/RenderbufferFormat.h"
#include "Magnum/Shader.h"
#include "Magnum/GL/AbstractShaderProgram.h"
#include "Magnum/GL/Buffer.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/Framebuffer.h"
#include "Magnum/GL/Mesh.h"
#include "Magnum/GL/MeshView.h"
#include "Magnum/GL/OpenGLTester.h"
#include "Magnum/GL/PixelFormat.h"
#include "Magnum/GL/Renderbuffer.h"
#include "Magnum/GL/RenderbufferFormat.h"
#include "Magnum/GL/Shader.h"
#include "Magnum/Math/Color.h"
#include "Magnum/Math/Half.h"
#include "Magnum/Math/Matrix.h"
@ -264,7 +265,7 @@ void MeshGLTest::construct() {
{
const Mesh mesh;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
if(Context::current().isExtensionSupported<Extensions::ARB::vertex_array_object>())
@ -276,7 +277,7 @@ void MeshGLTest::construct() {
}
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void MeshGLTest::constructCopy() {
@ -288,7 +289,7 @@ void MeshGLTest::constructMove() {
Mesh a;
const Int id = a.id();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
if(Context::current().isExtensionSupported<Extensions::ARB::vertex_array_object>())
@ -308,7 +309,7 @@ void MeshGLTest::constructMove() {
const Int cId = c.id();
c = std::move(b);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
if(Context::current().isExtensionSupported<Extensions::ARB::vertex_array_object>())
@ -379,10 +380,10 @@ void MeshGLTest::label() {
Mesh mesh;
CORRADE_COMPARE(mesh.label(), "");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
mesh.setLabel("MyMesh");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(mesh.label(), "MyMesh");
}
@ -608,12 +609,12 @@ void MeshGLTest::addVertexBufferUnsignedInt() {
DynamicAttribute::DataType::UnsignedInt});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(IntegerShader("uint"), RenderbufferFormat::R32UI, mesh)
.get<UnsignedInt>(PixelFormat::RedInteger, PixelType::UnsignedInt);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 35681);
}
@ -641,12 +642,12 @@ void MeshGLTest::addVertexBufferInt() {
DynamicAttribute::DataType::Int});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(IntegerShader("int"), RenderbufferFormat::R32I, mesh)
.get<Int>(PixelFormat::RedInteger, PixelType::Int);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 27530);
}
#endif
@ -670,7 +671,7 @@ void MeshGLTest::addVertexBufferFloat() {
DynamicAttribute::DataType::Float});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(FloatShader("float", "vec4(valueInterpolated, 0.0, 0.0, 0.0)"),
#ifndef MAGNUM_TARGET_GLES2
@ -680,7 +681,7 @@ void MeshGLTest::addVertexBufferFloat() {
#endif
mesh).get<UnsignedByte>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 96);
}
@ -707,12 +708,12 @@ void MeshGLTest::addVertexBufferDouble() {
DynamicAttribute::DataType::Double});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(DoubleShader("double", "float", "float(value)"),
RenderbufferFormat::R16, mesh).get<UnsignedShort>(PixelFormat::Red, PixelType::UnsignedShort);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 45828);
}
#endif
@ -742,12 +743,12 @@ void MeshGLTest::addVertexBufferVectorNui() {
DynamicAttribute::DataType::UnsignedInt});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(IntegerShader("uvec3"), RenderbufferFormat::RGBA32UI, mesh)
.get<Vector3ui>(PixelFormat::RGBAInteger, PixelType::UnsignedInt);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, Vector3ui(27592, 157, 25));
}
@ -775,12 +776,12 @@ void MeshGLTest::addVertexBufferVectorNi() {
DynamicAttribute::DataType::Int});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(IntegerShader("ivec2"), RenderbufferFormat::RG32I, mesh)
.get<Vector2i>(PixelFormat::RGInteger, PixelType::Int);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, Vector2i(27592, -157));
}
#endif
@ -804,7 +805,7 @@ void MeshGLTest::addVertexBufferVectorN() {
DynamicAttribute::DataType::Float});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(FloatShader("vec3", "vec4(valueInterpolated, 0.0)"),
#ifndef MAGNUM_TARGET_GLES2
@ -814,7 +815,7 @@ void MeshGLTest::addVertexBufferVectorN() {
#endif
mesh).get<Color3ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, Color3ub(96, 24, 156));
}
@ -844,12 +845,12 @@ void MeshGLTest::addVertexBufferVectorNd() {
DynamicAttribute::DataType::Double});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(DoubleShader("dvec4", "vec4", "vec4(value)"),
RenderbufferFormat::RGBA16, mesh).get<Math::Vector4<UnsignedShort>>(PixelFormat::RGBA, PixelType::UnsignedShort);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, Math::Vector4<UnsignedShort>(315, 65201, 2576, 12));
}
#endif
@ -885,7 +886,7 @@ void MeshGLTest::addVertexBufferMatrixNxN() {
DynamicAttribute::DataType::Float});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(FloatShader("mat3",
"vec4(valueInterpolated[0][0], valueInterpolated[1][1], valueInterpolated[2][2], 0.0)"),
@ -896,7 +897,7 @@ void MeshGLTest::addVertexBufferMatrixNxN() {
#endif
mesh).get<Color3ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, Color3ub(96, 24, 156));
}
@ -935,13 +936,13 @@ void MeshGLTest::addVertexBufferMatrixNxNd() {
DynamicAttribute::DataType::Double});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(DoubleShader("dmat3", "vec4",
"vec4(value[0][0], value[1][1], value[2][2], 0.0)"),
RenderbufferFormat::RGBA16, mesh).get<Math::Vector3<UnsignedShort>>(PixelFormat::RGB, PixelType::UnsignedShort);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
{
CORRADE_EXPECT_FAIL_IF(Context::current().detectedDriver() & (Context::DetectedDriver::Amd|Context::DetectedDriver::NVidia), "Somehow only first two values are extracted");
@ -987,13 +988,13 @@ void MeshGLTest::addVertexBufferMatrixMxN() {
DynamicAttribute::DataType::Float});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(FloatShader("mat3x4",
"vec4(valueInterpolated[0][0], valueInterpolated[1][1], valueInterpolated[2][2], 0.0)"),
RenderbufferFormat::RGBA8, mesh).get<Color3ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, Color3ub(96, 24, 156));
}
#endif
@ -1033,13 +1034,13 @@ void MeshGLTest::addVertexBufferMatrixMxNd() {
DynamicAttribute::DataType::Double});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(DoubleShader("dmat3x4", "vec4",
"vec4(value[0][0], value[1][1], value[2][2], 0.0)"),
RenderbufferFormat::RGBA16, mesh).get<Math::Vector3<UnsignedShort>>(PixelFormat::RGB, PixelType::UnsignedShort);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
{
CORRADE_EXPECT_FAIL_IF(Context::current().detectedDriver() & (Context::DetectedDriver::Amd|Context::DetectedDriver::NVidia), "Somehow only first two values are extracted");
@ -1078,12 +1079,12 @@ void MeshGLTest::addVertexBufferUnsignedIntWithUnsignedShort() {
DynamicAttribute::DataType::UnsignedShort});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(IntegerShader("uint"), RenderbufferFormat::R16UI, mesh)
.get<UnsignedShort>(PixelFormat::RedInteger, PixelType::UnsignedShort);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 16583);
}
@ -1111,12 +1112,12 @@ void MeshGLTest::addVertexBufferUnsignedIntWithShort() {
DynamicAttribute::DataType::Short});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(IntegerShader("uint"), RenderbufferFormat::R16I, mesh)
.get<Short>(PixelFormat::RedInteger, PixelType::Short);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 16583);
}
@ -1144,12 +1145,12 @@ void MeshGLTest::addVertexBufferIntWithUnsignedShort() {
DynamicAttribute::DataType::UnsignedShort});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(IntegerShader("int"), RenderbufferFormat::R16UI, mesh)
.get<UnsignedShort>(PixelFormat::RedInteger, PixelType::UnsignedShort);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 16583);
}
@ -1177,12 +1178,12 @@ void MeshGLTest::addVertexBufferIntWithShort() {
DynamicAttribute::DataType::Short});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(IntegerShader("int"), RenderbufferFormat::R16I, mesh)
.get<Short>(PixelFormat::RedInteger, PixelType::Short);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, -16583);
}
#endif
@ -1217,12 +1218,12 @@ void MeshGLTest::addVertexBufferFloatWithHalfFloat() {
DynamicAttribute::DataType::HalfFloat});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(FloatShader("float", "vec4(valueInterpolated, 0.0, 0.0, 0.0)"),
RenderbufferFormat::RGBA8, mesh).get<UnsignedByte>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 186);
}
#endif
@ -1248,12 +1249,12 @@ void MeshGLTest::addVertexBufferFloatWithDouble() {
DynamicAttribute::DataType::Double});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(FloatShader("float", "vec4(valueInterpolated, 0.0, 0.0, 0.0)"),
RenderbufferFormat::RGBA8, mesh).get<UnsignedByte>(PixelFormat::RGBA, PixelType::UnsignedShort);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 186);
}
@ -1280,7 +1281,7 @@ void MeshGLTest::addVertexBufferVector3WithUnsignedInt10f11f11fRev() {
DynamicAttribute::DataType::UnsignedInt10f11f11fRev});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/* Won't test the actual values */
}
#endif
@ -1309,7 +1310,7 @@ void MeshGLTest::addVertexBufferVector4WithUnsignedInt2101010Rev() {
DynamicAttribute::DataType::UnsignedInt2101010Rev});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/* Won't test the actual values */
}
@ -1336,7 +1337,7 @@ void MeshGLTest::addVertexBufferVector4WithInt2101010Rev() {
DynamicAttribute::DataType::Int2101010Rev});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/* Won't test the actual values */
}
#endif
@ -1363,7 +1364,7 @@ void MeshGLTest::addVertexBufferLessVectorComponents() {
DynamicAttribute::DataType::Float});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(FloatShader("vec4", "valueInterpolated"),
#ifndef MAGNUM_TARGET_GLES2
@ -1373,7 +1374,7 @@ void MeshGLTest::addVertexBufferLessVectorComponents() {
#endif
mesh).get<Color4ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, Color4ub(96, 24, 156, 255));
}
@ -1397,7 +1398,7 @@ void MeshGLTest::addVertexBufferNormalized() {
DynamicAttribute::DataType::UnsignedByte});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(FloatShader("vec3", "vec4(valueInterpolated, 0.0)"),
#ifndef MAGNUM_TARGET_GLES2
@ -1407,7 +1408,7 @@ void MeshGLTest::addVertexBufferNormalized() {
#endif
mesh).get<Color3ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, Color3ub(32, 156, 228));
}
@ -1437,12 +1438,12 @@ void MeshGLTest::addVertexBufferBGRA() {
DynamicAttribute::DataType::UnsignedByte});
} else CORRADE_ASSERT_UNREACHABLE();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(FloatShader("vec4", "valueInterpolated"),
RenderbufferFormat::RGBA8, mesh).get<Color4ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, Color4ub(156, 24, 96, 225));
}
#endif
@ -1549,7 +1550,7 @@ void MeshGLTest::addVertexBufferMultiple() {
.addVertexBuffer(buffer, 1*4, MultipleShader::Position(),
MultipleShader::Normal(), MultipleShader::TextureCoordinates());
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(MultipleShader(),
#ifndef MAGNUM_TARGET_GLES2
@ -1559,7 +1560,7 @@ void MeshGLTest::addVertexBufferMultiple() {
#endif
mesh).get<Color4ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, Color4ub(64 + 15 + 97, 17 + 164 + 28, 56 + 17, 255));
}
@ -1592,7 +1593,7 @@ void MeshGLTest::addVertexBufferMultipleGaps() {
MultipleShader::Normal(), 1*4,
MultipleShader::TextureCoordinates(), 2*4);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(MultipleShader(),
#ifndef MAGNUM_TARGET_GLES2
@ -1602,7 +1603,7 @@ void MeshGLTest::addVertexBufferMultipleGaps() {
#endif
mesh).get<Color4ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, Color4ub(64 + 15 + 97, 17 + 164 + 28, 56 + 17, 255));
}
@ -1677,7 +1678,7 @@ template<class T> void MeshGLTest::setIndexBuffer() {
MultipleShader::Normal(), MultipleShader::TextureCoordinates())
.setIndexBuffer(indices, 2, T::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(mesh.indexType(), MeshIndexType::UnsignedByte);
CORRADE_COMPARE(mesh.indexTypeSize(), 1);
@ -1689,7 +1690,7 @@ template<class T> void MeshGLTest::setIndexBuffer() {
#endif
mesh).get<Color4ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, indexedResult);
}
@ -1710,7 +1711,7 @@ template<class T> void MeshGLTest::setIndexBufferRange() {
MultipleShader::Normal(), MultipleShader::TextureCoordinates())
.setIndexBuffer(indices, 2, T::UnsignedShort, 0, 1);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(mesh.indexType(), GL::MeshIndexType::UnsignedShort);
CORRADE_COMPARE(mesh.indexTypeSize(), 2);
@ -1722,7 +1723,7 @@ template<class T> void MeshGLTest::setIndexBufferRange() {
#endif
mesh).get<Color4ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, indexedResult);
}
@ -1742,9 +1743,9 @@ void MeshGLTest::setIndexBufferUnsignedInt() {
Mesh mesh;
mesh.addVertexBuffer(vertices, 1*4, MultipleShader::Position(),
MultipleShader::Normal(), MultipleShader::TextureCoordinates())
.setIndexBuffer(indices, 4, Mesh::IndexType::UnsignedInt);
.setIndexBuffer(indices, 4, MeshIndexType::UnsignedInt);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(mesh.indexType(), GL::MeshIndexType::UnsignedInt);
CORRADE_COMPARE(mesh.indexTypeSize(), 4);
@ -1756,7 +1757,7 @@ void MeshGLTest::setIndexBufferUnsignedInt() {
#endif
mesh).get<Color4ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, indexedResult);
}
@ -1784,13 +1785,13 @@ void MeshGLTest::unbindVAOWhenSettingIndexBufferData() {
Mesh mesh;
mesh.addVertexBuffer(buffer, 4, Attribute{})
.setIndexBuffer(indices, 0, Mesh::IndexType::UnsignedByte);
.setIndexBuffer(indices, 0, MeshIndexType::UnsignedByte);
/* This buffer should have no effect on the mesh above */
Buffer otherIndices{Buffer::TargetHint::ElementArray};
otherIndices.setData(std::vector<UnsignedByte>{100, 1}, BufferUsage::StaticDraw);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(FloatShader("float", "vec4(valueInterpolated, 0.0, 0.0, 0.0)"),
#ifndef MAGNUM_TARGET_GLES2
@ -1800,7 +1801,7 @@ void MeshGLTest::unbindVAOWhenSettingIndexBufferData() {
#endif
mesh).get<UnsignedByte>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 92);
}
@ -1824,7 +1825,7 @@ void MeshGLTest::unbindVAOBeforeEnteringExternalSection() {
Mesh mesh;
mesh.addVertexBuffer(buffer, 4, Attribute{})
.setIndexBuffer(indices, 0, Mesh::IndexType::UnsignedByte);
.setIndexBuffer(indices, 0, MeshIndexType::UnsignedByte);
{
/* Comment this out to watch the world burn */
@ -1836,7 +1837,7 @@ void MeshGLTest::unbindVAOBeforeEnteringExternalSection() {
Context::current().resetState(Context::State::ExitExternal);
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(FloatShader("float", "vec4(valueInterpolated, 0.0, 0.0, 0.0)"),
#ifndef MAGNUM_TARGET_GLES2
@ -1846,7 +1847,7 @@ void MeshGLTest::unbindVAOBeforeEnteringExternalSection() {
#endif
mesh).get<UnsignedByte>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 92);
}
@ -1866,14 +1867,14 @@ void MeshGLTest::setBaseVertex() {
mesh.setBaseVertex(2)
.addVertexBuffer(vertices, 2*4, MultipleShader::Position(),
MultipleShader::Normal(), MultipleShader::TextureCoordinates())
.setIndexBuffer(indices, 2, Mesh::IndexType::UnsignedShort);
.setIndexBuffer(indices, 2, MeshIndexType::UnsignedShort);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(MultipleShader{}, RenderbufferFormat::RGBA8,
mesh).get<Color4ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, indexedResult);
}
#endif
@ -1910,7 +1911,7 @@ void MeshGLTest::setInstanceCount() {
.setInstanceCount(3)
.addVertexBuffer(buffer, 4, Attribute());
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(FloatShader("float", "vec4(valueInterpolated, 0.0, 0.0, 0.0)"),
#ifndef MAGNUM_TARGET_GLES2
@ -1920,7 +1921,7 @@ void MeshGLTest::setInstanceCount() {
#endif
mesh).get<UnsignedByte>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 96);
}
@ -1956,9 +1957,9 @@ void MeshGLTest::setInstanceCountIndexed() {
mesh.setInstanceCount(3)
.addVertexBuffer(vertices, 1*4, MultipleShader::Position(),
MultipleShader::Normal(), MultipleShader::TextureCoordinates())
.setIndexBuffer(indices, 2, Mesh::IndexType::UnsignedShort);
.setIndexBuffer(indices, 2, MeshIndexType::UnsignedShort);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(MultipleShader{},
#ifndef MAGNUM_TARGET_GLES2
@ -1968,7 +1969,7 @@ void MeshGLTest::setInstanceCountIndexed() {
#endif
mesh).get<Color4ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, indexedResult);
}
@ -1996,13 +1997,13 @@ void MeshGLTest::setInstanceCountBaseInstance() {
.setBaseInstance(72)
.addVertexBuffer(buffer, 4, Attribute());
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(FloatShader("float", "vec4(valueInterpolated, 0.0, 0.0, 0.0)"),
RenderbufferFormat::RGBA8,
mesh).get<UnsignedByte>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 96);
}
@ -2029,14 +2030,14 @@ void MeshGLTest::setInstanceCountBaseInstanceIndexed() {
.setBaseInstance(72)
.addVertexBuffer(vertices, 1*4, MultipleShader::Position(),
MultipleShader::Normal(), MultipleShader::TextureCoordinates())
.setIndexBuffer(indices, 2, Mesh::IndexType::UnsignedShort);
.setIndexBuffer(indices, 2, MeshIndexType::UnsignedShort);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(MultipleShader{}, RenderbufferFormat::RGBA8,
mesh).get<Color4ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, indexedResult);
}
@ -2063,14 +2064,14 @@ void MeshGLTest::setInstanceCountBaseVertex() {
.setInstanceCount(3)
.addVertexBuffer(vertices, 2*4, MultipleShader::Position(),
MultipleShader::Normal(), MultipleShader::TextureCoordinates())
.setIndexBuffer(indices, 2, Mesh::IndexType::UnsignedShort);
.setIndexBuffer(indices, 2, MeshIndexType::UnsignedShort);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(MultipleShader{}, RenderbufferFormat::RGBA8,
mesh).get<Color4ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, indexedResult);
}
@ -2100,14 +2101,14 @@ void MeshGLTest::setInstanceCountBaseVertexBaseInstance() {
.setBaseInstance(72)
.addVertexBuffer(vertices, 2*4, MultipleShader::Position(),
MultipleShader::Normal(), MultipleShader::TextureCoordinates())
.setIndexBuffer(indices, 2, Mesh::IndexType::UnsignedShort);
.setIndexBuffer(indices, 2, MeshIndexType::UnsignedShort);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(MultipleShader{}, RenderbufferFormat::RGBA8,
mesh).get<Color4ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, indexedResult);
}
#endif
@ -2151,7 +2152,7 @@ void MeshGLTest::addVertexBufferInstancedFloat() {
mesh.setInstanceCount(3)
.addVertexBufferInstanced(buffer, 1, 4, Attribute{});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(FloatShader("float", "vec4(valueInterpolated, 0.0, 0.0, 0.0)"),
#ifndef MAGNUM_TARGET_GLES2
@ -2161,7 +2162,7 @@ void MeshGLTest::addVertexBufferInstancedFloat() {
#endif
mesh).get<UnsignedByte>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 96);
}
#endif
@ -2193,12 +2194,12 @@ void MeshGLTest::addVertexBufferInstancedInteger() {
mesh.setInstanceCount(3)
.addVertexBufferInstanced(buffer, 1, 4, Attribute{});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(IntegerShader("uint"), RenderbufferFormat::R32UI, mesh)
.get<UnsignedInt>(PixelFormat::RedInteger, PixelType::UnsignedInt);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 35681);
}
#endif
@ -2228,12 +2229,12 @@ void MeshGLTest::addVertexBufferInstancedDouble() {
mesh.setInstanceCount(3)
.addVertexBufferInstanced(buffer, 1, 8, Attribute{});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = Checker(DoubleShader("double", "float", "float(value)"),
RenderbufferFormat::R16, mesh).get<UnsignedShort>(PixelFormat::Red, PixelType::UnsignedShort);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 45828);
}
#endif
@ -2303,12 +2304,12 @@ void MeshGLTest::multiDraw() {
Mesh mesh;
mesh.addVertexBuffer(buffer, 4, Attribute());
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = MultiChecker(FloatShader("float", "vec4(valueInterpolated, 0.0, 0.0, 0.0)"),
mesh).get<UnsignedByte>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, 96);
}
@ -2328,13 +2329,13 @@ void MeshGLTest::multiDrawIndexed() {
Mesh mesh;
mesh.addVertexBuffer(vertices, 1*4, MultipleShader::Position(),
MultipleShader::Normal(), MultipleShader::TextureCoordinates())
.setIndexBuffer(indices, 2, Mesh::IndexType::UnsignedShort);
.setIndexBuffer(indices, 2, MeshIndexType::UnsignedShort);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = MultiChecker(MultipleShader{}, mesh).get<Color4ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, indexedResult);
}
@ -2354,13 +2355,13 @@ void MeshGLTest::multiDrawBaseVertex() {
mesh.setBaseVertex(2)
.addVertexBuffer(vertices, 2*4, MultipleShader::Position(),
MultipleShader::Normal(), MultipleShader::TextureCoordinates())
.setIndexBuffer(indices, 2, Mesh::IndexType::UnsignedShort);
.setIndexBuffer(indices, 2, MeshIndexType::UnsignedShort);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
const auto value = MultiChecker(MultipleShader{}, mesh).get<Color4ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(value, indexedResult);
}
#endif

170
src/Magnum/GL/Test/MultisampleTextureGLTest.cpp

@ -25,16 +25,16 @@
#include <Corrade/TestSuite/Compare/Container.h>
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/ImageFormat.h"
#include "Magnum/MultisampleTexture.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/TextureFormat.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/ImageFormat.h"
#include "Magnum/GL/MultisampleTexture.h"
#include "Magnum/GL/OpenGLTester.h"
#include "Magnum/GL/TextureFormat.h"
#include "Magnum/Math/Vector3.h"
#include "Magnum/Math/Functions.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct MultisampleTextureGLTest: OpenGLTester {
explicit MultisampleTextureGLTest();
@ -86,8 +86,8 @@ MultisampleTextureGLTest::MultisampleTextureGLTest() {
void MultisampleTextureGLTest::construct2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::ARB::texture_multisample::string() + std::string(" is not supported."));
#else
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 is not supported.");
@ -96,36 +96,36 @@ void MultisampleTextureGLTest::construct2D() {
{
MultisampleTexture2D texture;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(texture.id() > 0);
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void MultisampleTextureGLTest::construct2DArray() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::ARB::texture_multisample::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::GL::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported."));
#endif
{
MultisampleTexture2DArray texture;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(texture.id() > 0);
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void MultisampleTextureGLTest::wrap2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string{" is not supported."});
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::ARB::texture_multisample::string() + std::string{" is not supported."});
#else
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 is not supported.");
@ -147,11 +147,11 @@ void MultisampleTextureGLTest::wrap2D() {
void MultisampleTextureGLTest::wrap2DArray() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::ARB::texture_multisample::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::GL::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported."));
#endif
GLuint id;
@ -170,8 +170,8 @@ void MultisampleTextureGLTest::wrap2DArray() {
void MultisampleTextureGLTest::bind2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::ARB::texture_multisample::string() + std::string(" is not supported."));
#else
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 is not supported.");
@ -180,57 +180,57 @@ void MultisampleTextureGLTest::bind2D() {
MultisampleTexture2D texture;
texture.bind(15);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbind(15);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::bind(7, {&texture, nullptr, &texture});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbind(7, 3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void MultisampleTextureGLTest::bind2DArray() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::ARB::texture_multisample::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::GL::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported."));
#endif
MultisampleTexture2DArray texture;
texture.bind(15);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbind(15);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::bind(7, {&texture, nullptr, &texture});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbind(7, 3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void MultisampleTextureGLTest::bindImage2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::shader_image_load_store>())
CORRADE_SKIP(Extensions::GL::ARB::shader_image_load_store::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::ARB::texture_multisample::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::shader_image_load_store>())
CORRADE_SKIP(Extensions::ARB::shader_image_load_store::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::GL::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported."));
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 is not supported.");
#endif
@ -241,32 +241,32 @@ void MultisampleTextureGLTest::bindImage2D() {
TextureFormat::RGBA8, Vector2i{32})
.bindImage(2, ImageAccess::ReadWrite, ImageFormat::RGBA8);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbindImage(2);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
AbstractTexture::bindImages(1, {&texture, nullptr, &texture});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbindImages(1, 3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#endif
}
void MultisampleTextureGLTest::bindImage2DArray() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::shader_image_load_store>())
CORRADE_SKIP(Extensions::GL::ARB::shader_image_load_store::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::ARB::texture_multisample::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::shader_image_load_store>())
CORRADE_SKIP(Extensions::ARB::shader_image_load_store::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::GL::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported."));
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 is not supported.");
#endif
@ -277,30 +277,30 @@ void MultisampleTextureGLTest::bindImage2DArray() {
TextureFormat::RGBA8, {32, 32, 4})
.bindImage(2, 1, ImageAccess::ReadWrite, ImageFormat::RGBA8);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
texture.bindImageLayered(3, ImageAccess::ReadWrite, ImageFormat::RGBA8);
AbstractTexture::unbindImage(2);
AbstractTexture::unbindImage(3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES
AbstractTexture::bindImages(1, {&texture, nullptr, &texture});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbindImages(1, 3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
#endif
}
void MultisampleTextureGLTest::storage2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::ARB::texture_multisample::string() + std::string(" is not supported."));
#else
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 is not supported.");
@ -311,20 +311,20 @@ void MultisampleTextureGLTest::storage2D() {
texture.setStorage(Math::min(4, MultisampleTexture2D::maxColorSamples()),
TextureFormat::RGBA8, {16, 16});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.imageSize(), Vector2i(16, 16));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void MultisampleTextureGLTest::storage2DArray() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::ARB::texture_multisample::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::GL::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported."));
#endif
MultisampleTexture2DArray texture;
@ -332,17 +332,17 @@ void MultisampleTextureGLTest::storage2DArray() {
texture.setStorage(Math::min(4, MultisampleTexture2DArray::maxColorSamples()),
TextureFormat::RGBA8, {16, 16, 5});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.imageSize(), Vector3i(16, 16, 5));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void MultisampleTextureGLTest::invalidateImage2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::ARB::texture_multisample::string() + std::string(" is not supported."));
#else
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 is not supported.");
@ -354,16 +354,16 @@ void MultisampleTextureGLTest::invalidateImage2D() {
TextureFormat::RGBA8, {16, 16});
texture.invalidateImage();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void MultisampleTextureGLTest::invalidateImage2DArray() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::ARB::texture_multisample::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::GL::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported."));
#endif
MultisampleTexture2DArray texture;
@ -372,13 +372,13 @@ void MultisampleTextureGLTest::invalidateImage2DArray() {
TextureFormat::RGBA8, {16, 16, 5});
texture.invalidateImage();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void MultisampleTextureGLTest::invalidateSubImage2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::ARB::texture_multisample::string() + std::string(" is not supported."));
#else
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 is not supported.");
@ -390,16 +390,16 @@ void MultisampleTextureGLTest::invalidateSubImage2D() {
TextureFormat::RGBA8, {16, 16});
texture.invalidateSubImage({3, 4}, {5, 6});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void MultisampleTextureGLTest::invalidateSubImage2DArray() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::GL::ARB::texture_multisample::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_multisample>())
CORRADE_SKIP(Extensions::ARB::texture_multisample::string() + std::string(" is not supported."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::GL::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::OES::texture_storage_multisample_2d_array>())
CORRADE_SKIP(Extensions::OES::texture_storage_multisample_2d_array::string() + std::string(" is not supported."));
#endif
MultisampleTexture2DArray texture;
@ -408,9 +408,9 @@ void MultisampleTextureGLTest::invalidateSubImage2DArray() {
TextureFormat::RGBA8, {16, 16, 5});
texture.invalidateSubImage({3, 4, 1}, {5, 6, 3});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::MultisampleTextureGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::MultisampleTextureGLTest)

8
src/Magnum/GL/Test/MultisampleTextureTest.cpp

@ -25,9 +25,9 @@
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/MultisampleTexture.h"
#include "Magnum/GL/MultisampleTexture.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct MultisampleTextureTest: TestSuite::Tester {
explicit MultisampleTextureTest();
@ -59,6 +59,6 @@ void MultisampleTextureTest::construct2DArrayNoCreate() {
CORRADE_VERIFY(true);
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::MultisampleTextureTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::MultisampleTextureTest)

78
src/Magnum/GL/Test/PixelStorageGLTest.cpp

@ -25,22 +25,22 @@
#include <Corrade/TestSuite/Compare/Container.h>
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/Image.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/PixelFormat.h"
#include "Magnum/Texture.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/OpenGLTester.h"
#include "Magnum/GL/PixelFormat.h"
#include "Magnum/GL/Texture.h"
#ifndef MAGNUM_TARGET_GLES2
#include "Magnum/TextureArray.h"
#include "Magnum/GL/TextureArray.h"
#endif
#include "Magnum/TextureFormat.h"
#include "Magnum/GL/TextureFormat.h"
#ifdef MAGNUM_TARGET_GLES
#include "Magnum/Framebuffer.h"
#include "Magnum/GL/Framebuffer.h"
#endif
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct PixelStorageGLTest: OpenGLTester {
explicit PixelStorageGLTest();
@ -104,8 +104,8 @@ namespace {
void PixelStorageGLTest::unpack2D() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::unpack_subimage>())
CORRADE_SKIP(Extensions::GL::EXT::unpack_subimage::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::unpack_subimage>())
CORRADE_SKIP(Extensions::EXT::unpack_subimage::string() + std::string(" is not supported."));
#endif
PixelStorage storage;
@ -119,7 +119,7 @@ void PixelStorageGLTest::unpack2D() {
texture.setStorage(1, TextureFormat::RGB8, {2, 3})
.setSubImage(0, {}, image);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/* Read into zero-initialized array to avoid comparing random memory in
padding bytes (confirmed on NVidia 355.11, AMD 15.300.1025.0) */
@ -134,7 +134,7 @@ void PixelStorageGLTest::unpack2D() {
fb.read(fb.viewport(), actual);
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(actual.data(), Containers::arrayView(ActualData),
TestSuite::Compare::Container);
@ -142,8 +142,8 @@ void PixelStorageGLTest::unpack2D() {
void PixelStorageGLTest::pack2D() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::NV::pack_subimage>())
CORRADE_SKIP(Extensions::GL::NV::pack_subimage::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::NV::pack_subimage>())
CORRADE_SKIP(Extensions::NV::pack_subimage::string() + std::string(" is not supported."));
#endif
ImageView2D actual{PixelFormat::RGB, PixelType::UnsignedByte, {2, 3}, ActualData};
@ -152,7 +152,7 @@ void PixelStorageGLTest::pack2D() {
texture.setStorage(1, TextureFormat::RGB8, {2, 3})
.setSubImage(0, {}, actual);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/* Pre-allocate and zero out the data array so we can conveniently compare */
Image2D image{PixelStorage{}
@ -169,7 +169,7 @@ void PixelStorageGLTest::pack2D() {
fb.read(fb.viewport(), image);
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(image.data(), Containers::arrayView(Data2D),
TestSuite::Compare::Container);
@ -212,7 +212,7 @@ void PixelStorageGLTest::unpack3D() {
texture.setStorage(1, TextureFormat::RGB8, {2, 3, 1})
.setSubImage(0, {}, image);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/* Testing mainly image height here, which is not available as pack
parameter in ES */
@ -224,7 +224,7 @@ void PixelStorageGLTest::unpack3D() {
texture.image(0, actual);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/* Clear padding in the last row (the driver might leave them untouched,
confirmed on NVidia 358.16) */
@ -247,7 +247,7 @@ void PixelStorageGLTest::pack3D() {
texture.setStorage(1, TextureFormat::RGB8, {2, 3, 1})
.setSubImage(0, {}, actual);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
Image3D image{PixelStorage{}
.setAlignment(2)
@ -257,7 +257,7 @@ void PixelStorageGLTest::pack3D() {
PixelFormat::RGB, PixelType::UnsignedByte, {}, Containers::Array<char>{Containers::ValueInit, sizeof(Data3D)}};
texture.image(0, image);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(image.data(), Containers::arrayView(Data3D),
TestSuite::Compare::Container);
@ -290,8 +290,8 @@ namespace {
}
void PixelStorageGLTest::unpackCompressed2D() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported."));
CompressedPixelStorage storage;
storage.setCompressedBlockSize({4, 4, 1})
@ -305,11 +305,11 @@ void PixelStorageGLTest::unpackCompressed2D() {
texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, {4, 4})
.setCompressedSubImage(0, {}, image);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CompressedImage2D actual = texture.compressedImage(0, {});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(actual.data()),
Containers::arrayView(ActualCompressedData),
@ -317,8 +317,8 @@ void PixelStorageGLTest::unpackCompressed2D() {
}
void PixelStorageGLTest::packCompressed2D() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported."));
CompressedImageView2D actual{CompressedPixelFormat::RGBAS3tcDxt3, {4, 4}, ActualCompressedData};
@ -326,7 +326,7 @@ void PixelStorageGLTest::packCompressed2D() {
texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, {4, 4})
.setCompressedSubImage(0, {}, actual);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/* Pre-allocate and zero out the data array so we can conveniently compare */
CompressedImage2D image{CompressedPixelStorage{}
@ -337,7 +337,7 @@ void PixelStorageGLTest::packCompressed2D() {
CompressedPixelFormat::RGBAS3tcDxt3, {}, Containers::Array<char>{Containers::ValueInit, sizeof(CompressedData2D)}};
texture.compressedImage(0, image);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()),
Containers::arrayView(CompressedData2D),
@ -398,8 +398,8 @@ namespace {
}
void PixelStorageGLTest::unpackCompressed3D() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported."));
CompressedPixelStorage storage;
storage.setCompressedBlockSize({4, 4, 1})
@ -414,11 +414,11 @@ void PixelStorageGLTest::unpackCompressed3D() {
texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, {4, 4, 1})
.setCompressedSubImage(0, {}, image);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CompressedImage3D actual = texture.compressedImage(0, {});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(actual.data()),
Containers::arrayView(ActualCompressedData),
@ -426,8 +426,8 @@ void PixelStorageGLTest::unpackCompressed3D() {
}
void PixelStorageGLTest::packCompressed3D() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::GL::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::compressed_texture_pixel_storage>())
CORRADE_SKIP(Extensions::ARB::compressed_texture_pixel_storage::string() + std::string(" is not supported."));
CompressedImageView3D actual{CompressedPixelFormat::RGBAS3tcDxt3, {4, 4, 1}, ActualCompressedData};
@ -435,7 +435,7 @@ void PixelStorageGLTest::packCompressed3D() {
texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, {4, 4, 1})
.setCompressedSubImage(0, {}, actual);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
/* Pre-allocate and zero out the data array so we can conveniently compare */
CompressedImage3D image{CompressedPixelStorage{}
@ -447,7 +447,7 @@ void PixelStorageGLTest::packCompressed3D() {
CompressedPixelFormat::RGBAS3tcDxt3, {}, Containers::Array<char>{Containers::ValueInit, sizeof(CompressedData3D)}};
texture.compressedImage(0, image);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()),
Containers::arrayView(CompressedData3D),
@ -455,6 +455,6 @@ void PixelStorageGLTest::packCompressed3D() {
}
#endif
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::PixelStorageGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::PixelStorageGLTest)

70
src/Magnum/GL/Test/PrimitiveQueryGLTest.cpp

@ -26,21 +26,21 @@
#include <Corrade/Utility/Assert.h>
#include <Corrade/Utility/Resource.h>
#include "Magnum/AbstractShaderProgram.h"
#include "Magnum/Buffer.h"
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/Framebuffer.h"
#include "Magnum/Mesh.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/PrimitiveQuery.h"
#include "Magnum/Renderbuffer.h"
#include "Magnum/RenderbufferFormat.h"
#include "Magnum/Shader.h"
#include "Magnum/TransformFeedback.h"
#include "Magnum/GL/AbstractShaderProgram.h"
#include "Magnum/GL/Buffer.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/Framebuffer.h"
#include "Magnum/GL/Mesh.h"
#include "Magnum/GL/OpenGLTester.h"
#include "Magnum/GL/PrimitiveQuery.h"
#include "Magnum/GL/Renderbuffer.h"
#include "Magnum/GL/RenderbufferFormat.h"
#include "Magnum/GL/Shader.h"
#include "Magnum/GL/TransformFeedback.h"
#include "Magnum/Math/Vector2.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct PrimitiveQueryGLTest: OpenGLTester {
explicit PrimitiveQueryGLTest();
@ -77,8 +77,8 @@ PrimitiveQueryGLTest::PrimitiveQueryGLTest() {
void PrimitiveQueryGLTest::wrap() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::GL::ARB::transform_feedback2::string() + std::string(" is not available."));
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::ARB::transform_feedback2::string() + std::string(" is not available."));
#endif
GLuint id;
@ -98,11 +98,11 @@ void PrimitiveQueryGLTest::wrap() {
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void PrimitiveQueryGLTest::primitivesGenerated() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::transform_feedback>())
CORRADE_SKIP(Extensions::GL::EXT::transform_feedback::string() + std::string(" is not available."));
if(!Context::current().isExtensionSupported<Extensions::EXT::transform_feedback>())
CORRADE_SKIP(Extensions::EXT::transform_feedback::string() + std::string(" is not available."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::geometry_shader>())
CORRADE_SKIP(Extensions::GL::EXT::geometry_shader::string() + std::string(" is not available."));
if(!Context::current().isExtensionSupported<Extensions::EXT::geometry_shader>())
CORRADE_SKIP(Extensions::EXT::geometry_shader::string() + std::string(" is not available."));
#endif
/* Bind some FB to avoid errors on contexts w/o default FB */
@ -155,7 +155,7 @@ void PrimitiveQueryGLTest::primitivesGenerated() {
.setCount(9)
.addVertexBuffer(vertices, 0, MyShader::Position());
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
PrimitiveQuery q{PrimitiveQuery::Target::PrimitivesGenerated};
q.begin();
@ -168,7 +168,7 @@ void PrimitiveQueryGLTest::primitivesGenerated() {
const UnsignedInt count = q.result<UnsignedInt>();
const bool availableAfter = q.resultAvailable();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(!availableBefore);
CORRADE_VERIFY(availableAfter);
CORRADE_COMPARE(count, 3);
@ -177,8 +177,8 @@ void PrimitiveQueryGLTest::primitivesGenerated() {
#ifndef MAGNUM_TARGET_GLES
void PrimitiveQueryGLTest::primitivesGeneratedIndexed() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback3>())
CORRADE_SKIP(Extensions::GL::ARB::transform_feedback3::string() + std::string(" is not available."));
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback3>())
CORRADE_SKIP(Extensions::ARB::transform_feedback3::string() + std::string(" is not available."));
/* Bind some FB to avoid errors on contexts w/o default FB */
Renderbuffer color;
@ -222,7 +222,7 @@ void PrimitiveQueryGLTest::primitivesGeneratedIndexed() {
.setCount(9)
.addVertexBuffer(vertices, 0, MyShader::Position());
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
PrimitiveQuery q{PrimitiveQuery::Target::PrimitivesGenerated};
q.begin(0);
@ -233,15 +233,15 @@ void PrimitiveQueryGLTest::primitivesGeneratedIndexed() {
q.end();
const UnsignedInt count = q.result<UnsignedInt>();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(count, 3);
}
#endif
void PrimitiveQueryGLTest::transformFeedbackPrimitivesWritten() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::GL::ARB::transform_feedback2::string() + std::string(" is not available."));
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::ARB::transform_feedback2::string() + std::string(" is not available."));
#endif
/* Bind some FB to avoid errors on contexts w/o default FB */
@ -294,7 +294,7 @@ void PrimitiveQueryGLTest::transformFeedbackPrimitivesWritten() {
mesh.setPrimitive(MeshPrimitive::Triangles)
.setCount(9);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
TransformFeedback feedback;
feedback.attachBuffer(0, output);
@ -312,15 +312,15 @@ void PrimitiveQueryGLTest::transformFeedbackPrimitivesWritten() {
q.end();
const UnsignedInt count = q.result<UnsignedInt>();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(count, 3); /* Three triangles (9 vertices) */
}
#ifndef MAGNUM_TARGET_GLES
void PrimitiveQueryGLTest::transformFeedbackOverflow() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback_overflow_query>())
CORRADE_SKIP(Extensions::GL::ARB::transform_feedback_overflow_query::string() + std::string(" is not available."));
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback_overflow_query>())
CORRADE_SKIP(Extensions::ARB::transform_feedback_overflow_query::string() + std::string(" is not available."));
#endif
/* Bind some FB to avoid errors on contexts w/o default FB */
@ -373,7 +373,7 @@ void PrimitiveQueryGLTest::transformFeedbackOverflow() {
mesh.setPrimitive(MeshPrimitive::Triangles)
.setCount(9);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
TransformFeedback feedback;
/* Deliberately one vertex smaller to not fit two of them */
@ -395,12 +395,12 @@ void PrimitiveQueryGLTest::transformFeedbackOverflow() {
const bool overflown1 = q1.result<bool>();
const bool overflown2 = q2.result<bool>();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(!overflown1);
CORRADE_VERIFY(overflown2); /* Got space for only 17 vertices instead of 2*9 */
}
#endif
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::PrimitiveQueryGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::PrimitiveQueryGLTest)

8
src/Magnum/GL/Test/PrimitiveQueryTest.cpp

@ -25,9 +25,9 @@
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/PrimitiveQuery.h"
#include "Magnum/GL/PrimitiveQuery.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct PrimitiveQueryTest: TestSuite::Tester {
explicit PrimitiveQueryTest();
@ -48,6 +48,6 @@ void PrimitiveQueryTest::constructNoCreate() {
CORRADE_VERIFY(true);
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::PrimitiveQueryTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::PrimitiveQueryTest)

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

@ -26,20 +26,19 @@
#include <Corrade/Containers/Array.h>
#include <Corrade/TestSuite/Compare/Container.h>
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/BufferImage.h"
#include "Magnum/Image.h"
#include "Magnum/ImageFormat.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/PixelFormat.h"
#include "Magnum/RectangleTexture.h"
#include "Magnum/TextureFormat.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/BufferImage.h"
#include "Magnum/GL/ImageFormat.h"
#include "Magnum/GL/OpenGLTester.h"
#include "Magnum/GL/PixelFormat.h"
#include "Magnum/GL/RectangleTexture.h"
#include "Magnum/GL/TextureFormat.h"
#include "Magnum/Math/Color.h"
#include "Magnum/Math/Range.h"
#include "Magnum/OpenGLTester.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct RectangleTextureGLTest: OpenGLTester {
explicit RectangleTextureGLTest();
@ -147,22 +146,22 @@ RectangleTextureGLTest::RectangleTextureGLTest() {
}
void RectangleTextureGLTest::construct() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
{
RectangleTexture texture;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(texture.id() > 0);
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void RectangleTextureGLTest::wrap() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
GLuint id;
glGenTextures(1, &id);
@ -179,58 +178,58 @@ void RectangleTextureGLTest::wrap() {
}
void RectangleTextureGLTest::bind() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
RectangleTexture texture;
texture.bind(15);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbind(15);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::bind(7, {&texture, nullptr, &texture});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbind(7, 3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void RectangleTextureGLTest::bindImage() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::shader_image_load_store>())
CORRADE_SKIP(Extensions::GL::ARB::shader_image_load_store::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::shader_image_load_store>())
CORRADE_SKIP(Extensions::ARB::shader_image_load_store::string() + std::string(" is not supported."));
RectangleTexture texture;
texture.setStorage(TextureFormat::RGBA8, Vector2i{32})
.bindImage(2, ImageAccess::ReadWrite, ImageFormat::RGBA8);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbindImage(2);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::bindImages(1, {&texture, nullptr, &texture});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
AbstractTexture::unbindImages(1, 3);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
template<class T> void RectangleTextureGLTest::sampling() {
setTestCaseName(std::is_same<T, GenericSampler>::value ?
"sampling<GenericSampler>" : "sampling<GLSampler>");
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
RectangleTexture texture;
texture.setMinificationFilter(T::Filter::Linear)
@ -238,83 +237,83 @@ template<class T> void RectangleTextureGLTest::sampling() {
.setWrapping(T::Wrapping::ClampToBorder)
.setBorderColor(Color3(0.5f))
.setMaxAnisotropy(Sampler::maxMaxAnisotropy())
.setCompareMode(Sampler::CompareMode::CompareRefToTexture)
.setCompareFunction(Sampler::CompareFunction::GreaterOrEqual);
.setCompareMode(SamplerCompareMode::CompareRefToTexture)
.setCompareFunction(SamplerCompareFunction::GreaterOrEqual);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void RectangleTextureGLTest::samplingSRGBDecode() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_sRGB_decode>())
CORRADE_SKIP(Extensions::GL::EXT::texture_sRGB_decode::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_sRGB_decode>())
CORRADE_SKIP(Extensions::EXT::texture_sRGB_decode::string() + std::string(" is not supported."));
RectangleTexture texture;
texture.setSRGBDecode(false);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void RectangleTextureGLTest::samplingBorderInteger() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_integer>())
CORRADE_SKIP(Extensions::GL::EXT::texture_integer::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_integer>())
CORRADE_SKIP(Extensions::EXT::texture_integer::string() + std::string(" is not supported."));
RectangleTexture a;
a.setWrapping(Sampler::Wrapping::ClampToBorder)
a.setWrapping(SamplerWrapping::ClampToBorder)
.setBorderColor(Vector4i(1, 56, 78, -2));
RectangleTexture b;
b.setWrapping(Sampler::Wrapping::ClampToBorder)
b.setWrapping(SamplerWrapping::ClampToBorder)
.setBorderColor(Vector4ui(35, 56, 78, 15));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void RectangleTextureGLTest::samplingSwizzle() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_swizzle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_swizzle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_swizzle>())
CORRADE_SKIP(Extensions::ARB::texture_swizzle::string() + std::string(" is not supported."));
RectangleTexture texture;
texture.setSwizzle<'b', 'g', 'r', '0'>();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void RectangleTextureGLTest::samplingDepthStencilMode() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::stencil_texturing>())
CORRADE_SKIP(Extensions::GL::ARB::stencil_texturing::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::stencil_texturing>())
CORRADE_SKIP(Extensions::ARB::stencil_texturing::string() + std::string(" is not supported."));
RectangleTexture texture;
texture.setDepthStencilMode(Sampler::DepthStencilMode::StencilIndex);
texture.setDepthStencilMode(SamplerDepthStencilMode::StencilIndex);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void RectangleTextureGLTest::storage() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
RectangleTexture texture;
texture.setStorage(TextureFormat::RGBA8, Vector2i(32));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(texture.imageSize(), Vector2i(32));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void RectangleTextureGLTest::image() {
setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name);
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
RectangleTexture texture;
texture.setImage(TextureFormat::RGBA8, ImageView2D{
@ -322,12 +321,12 @@ void RectangleTextureGLTest::image() {
PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2),
PixelStorageData[testCaseInstanceId()].dataSparse});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
Image2D image = texture.image({PixelStorageData[testCaseInstanceId()].storage,
PixelFormat::RGBA, PixelType::UnsignedByte});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset),
@ -338,8 +337,8 @@ void RectangleTextureGLTest::image() {
void RectangleTextureGLTest::imageBuffer() {
setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name);
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
RectangleTexture texture;
texture.setImage(TextureFormat::RGBA8, BufferImage2D{
@ -348,13 +347,13 @@ void RectangleTextureGLTest::imageBuffer() {
PixelStorageData[testCaseInstanceId()].dataSparse,
BufferUsage::StaticDraw});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
BufferImage2D image = texture.image({PixelStorageData[testCaseInstanceId()].storage,
PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(2));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorageData[testCaseInstanceId()].offset),
@ -375,8 +374,8 @@ namespace {
void RectangleTextureGLTest::subImage() {
setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name);
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
RectangleTexture texture;
texture.setImage(TextureFormat::RGBA8,
@ -386,11 +385,11 @@ void RectangleTextureGLTest::subImage() {
PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2),
PixelStorageData[testCaseInstanceId()].dataSparse});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
Image2D image = texture.image({PixelFormat::RGBA, PixelType::UnsignedByte});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(4));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()),
@ -400,8 +399,8 @@ void RectangleTextureGLTest::subImage() {
void RectangleTextureGLTest::subImageBuffer() {
setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name);
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
RectangleTexture texture;
texture.setImage(TextureFormat::RGBA8,
@ -412,12 +411,12 @@ void RectangleTextureGLTest::subImageBuffer() {
PixelStorageData[testCaseInstanceId()].dataSparse,
BufferUsage::StaticDraw});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
BufferImage2D image = texture.image({PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i(4));
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData),
@ -428,22 +427,22 @@ void RectangleTextureGLTest::subImageBuffer() {
void RectangleTextureGLTest::subImageQuery() {
setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name);
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
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::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::get_texture_sub_image>())
CORRADE_SKIP(Extensions::ARB::get_texture_sub_image::string() + std::string(" is not supported."));
RectangleTexture texture;
texture.setStorage(TextureFormat::RGBA8, Vector2i{4})
.setSubImage({}, ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{4}, SubDataComplete});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
Image2D image = texture.subImage(Range2Di::fromSize(Vector2i{1}, Vector2i{2}),
{PixelStorageData[testCaseInstanceId()].storage,
PixelFormat::RGBA, PixelType::UnsignedByte});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{2});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(image.data()).suffix(PixelStorageData[testCaseInstanceId()].offset),
@ -454,23 +453,23 @@ void RectangleTextureGLTest::subImageQuery() {
void RectangleTextureGLTest::subImageQueryBuffer() {
setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name);
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
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::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::get_texture_sub_image>())
CORRADE_SKIP(Extensions::ARB::get_texture_sub_image::string() + std::string(" is not supported."));
RectangleTexture texture;
texture.setStorage(TextureFormat::RGBA8, Vector2i{4})
.setSubImage({}, ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{4}, SubDataComplete});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
BufferImage2D image = texture.subImage(Range2Di::fromSize(Vector2i{1}, Vector2i{2}),
{PixelStorageData[testCaseInstanceId()].storage,
PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(image.size(), Vector2i{2});
CORRADE_COMPARE_AS(Containers::arrayCast<UnsignedByte>(imageData).suffix(PixelStorageData[testCaseInstanceId()].offset),
@ -503,27 +502,27 @@ void RectangleTextureGLTest::compressedSubImageQueryBuffer() {
}
void RectangleTextureGLTest::invalidateImage() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
RectangleTexture texture;
texture.setStorage(TextureFormat::RGBA8, Vector2i(32));
texture.invalidateImage();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void RectangleTextureGLTest::invalidateSubImage() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::GL::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
RectangleTexture texture;
texture.setStorage(TextureFormat::RGBA8, Vector2i(32));
texture.invalidateSubImage(Vector2i(4), Vector2i(16));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::RectangleTextureGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::RectangleTextureGLTest)

8
src/Magnum/GL/Test/RectangleTextureTest.cpp

@ -25,9 +25,9 @@
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/RectangleTexture.h"
#include "Magnum/GL/RectangleTexture.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct RectangleTextureTest: TestSuite::Tester {
explicit RectangleTextureTest();
@ -48,6 +48,6 @@ void RectangleTextureTest::constructNoCreate() {
CORRADE_VERIFY(true);
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::RectangleTextureTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::RectangleTextureTest)

64
src/Magnum/GL/Test/RenderbufferGLTest.cpp

@ -23,14 +23,14 @@
DEALINGS IN THE SOFTWARE.
*/
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/OpenGLTester.h"
#include "Magnum/GL/Renderbuffer.h"
#include "Magnum/GL/RenderbufferFormat.h"
#include "Magnum/Math/Vector2.h"
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/Renderbuffer.h"
#include "Magnum/RenderbufferFormat.h"
#include "Magnum/OpenGLTester.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct RenderbufferGLTest: OpenGLTester {
explicit RenderbufferGLTest();
@ -70,18 +70,18 @@ RenderbufferGLTest::RenderbufferGLTest() {
void RenderbufferGLTest::construct() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::framebuffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available."));
if(!Context::current().isExtensionSupported<Extensions::ARB::framebuffer_object>())
CORRADE_SKIP(Extensions::ARB::framebuffer_object::string() + std::string(" is not available."));
#endif
{
const Renderbuffer renderbuffer;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(renderbuffer.id() > 0);
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void RenderbufferGLTest::constructCopy() {
@ -91,14 +91,14 @@ void RenderbufferGLTest::constructCopy() {
void RenderbufferGLTest::constructMove() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::framebuffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available."));
if(!Context::current().isExtensionSupported<Extensions::ARB::framebuffer_object>())
CORRADE_SKIP(Extensions::ARB::framebuffer_object::string() + std::string(" is not available."));
#endif
Renderbuffer a;
const Int id = a.id();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0);
Renderbuffer b(std::move(a));
@ -110,7 +110,7 @@ void RenderbufferGLTest::constructMove() {
const Int cId = c.id();
c = std::move(b);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0);
CORRADE_COMPARE(b.id(), cId);
CORRADE_COMPARE(c.id(), id);
@ -118,8 +118,8 @@ void RenderbufferGLTest::constructMove() {
void RenderbufferGLTest::wrap() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::framebuffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available."));
if(!Context::current().isExtensionSupported<Extensions::ARB::framebuffer_object>())
CORRADE_SKIP(Extensions::ARB::framebuffer_object::string() + std::string(" is not available."));
#endif
GLuint id;
@ -139,20 +139,20 @@ void RenderbufferGLTest::wrap() {
#ifndef MAGNUM_TARGET_WEBGL
void RenderbufferGLTest::label() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::framebuffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available."));
if(!Context::current().isExtensionSupported<Extensions::ARB::framebuffer_object>())
CORRADE_SKIP(Extensions::ARB::framebuffer_object::string() + std::string(" is not available."));
#endif
if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>() &&
!Context::current().isExtensionSupported<Extensions::GL::EXT::debug_label>())
if(!Context::current().isExtensionSupported<Extensions::KHR::debug>() &&
!Context::current().isExtensionSupported<Extensions::EXT::debug_label>())
CORRADE_SKIP("Required extension is not available");
Renderbuffer renderbuffer;
CORRADE_COMPARE(renderbuffer.label(), "");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
renderbuffer.setLabel("MyRenderbuffer");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(renderbuffer.label(), "MyRenderbuffer");
}
@ -160,8 +160,8 @@ void RenderbufferGLTest::label() {
void RenderbufferGLTest::setStorage() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::framebuffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available."));
if(!Context::current().isExtensionSupported<Extensions::ARB::framebuffer_object>())
CORRADE_SKIP(Extensions::ARB::framebuffer_object::string() + std::string(" is not available."));
#endif
Renderbuffer renderbuffer;
@ -172,17 +172,17 @@ void RenderbufferGLTest::setStorage() {
renderbuffer.setStorage(RenderbufferFormat::RGBA4, {128, 128});
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void RenderbufferGLTest::setStorageMultisample() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::framebuffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available."));
if(!Context::current().isExtensionSupported<Extensions::ARB::framebuffer_object>())
CORRADE_SKIP(Extensions::ARB::framebuffer_object::string() + std::string(" is not available."));
#elif defined(MAGNUM_TARGET_GLES2)
if(!Context::current().isExtensionSupported<Extensions::GL::ANGLE::framebuffer_multisample>() &&
!Context::current().isExtensionSupported<Extensions::GL::NV::framebuffer_multisample>())
if(!Context::current().isExtensionSupported<Extensions::ANGLE::framebuffer_multisample>() &&
!Context::current().isExtensionSupported<Extensions::NV::framebuffer_multisample>())
CORRADE_SKIP("Required extension is not available.");
#endif
@ -194,10 +194,10 @@ void RenderbufferGLTest::setStorageMultisample() {
renderbuffer.setStorageMultisample(Renderbuffer::maxSamples(), RenderbufferFormat::RGBA4, {128, 128});
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::RenderbufferGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::RenderbufferGLTest)

8
src/Magnum/GL/Test/RenderbufferTest.cpp

@ -25,9 +25,9 @@
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Renderbuffer.h"
#include "Magnum/GL/Renderbuffer.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct RenderbufferTest: TestSuite::Tester {
explicit RenderbufferTest();
@ -48,6 +48,6 @@ void RenderbufferTest::constructNoCreate() {
CORRADE_VERIFY(true);
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::RenderbufferTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::RenderbufferTest)

8
src/Magnum/GL/Test/RendererTest.cpp

@ -26,9 +26,9 @@
#include <sstream>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Renderer.h"
#include "Magnum/GL/Renderer.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct RendererTest: TestSuite::Tester {
explicit RendererTest();
@ -72,6 +72,6 @@ void RendererTest::debugGraphicsResetStatus() {
}
#endif
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::RendererTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::RendererTest)

52
src/Magnum/GL/Test/SampleQueryGLTest.cpp

@ -26,19 +26,19 @@
#include <Corrade/Utility/Assert.h>
#include <Corrade/Utility/Resource.h>
#include "Magnum/AbstractShaderProgram.h"
#include "Magnum/Buffer.h"
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/Framebuffer.h"
#include "Magnum/Mesh.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/Renderbuffer.h"
#include "Magnum/RenderbufferFormat.h"
#include "Magnum/SampleQuery.h"
#include "Magnum/Shader.h"
namespace Magnum { namespace Test {
#include "Magnum/GL/AbstractShaderProgram.h"
#include "Magnum/GL/Buffer.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/Framebuffer.h"
#include "Magnum/GL/Mesh.h"
#include "Magnum/GL/OpenGLTester.h"
#include "Magnum/GL/Renderbuffer.h"
#include "Magnum/GL/RenderbufferFormat.h"
#include "Magnum/GL/SampleQuery.h"
#include "Magnum/GL/Shader.h"
namespace Magnum { namespace GL { namespace Test {
struct SampleQueryGLTest: OpenGLTester {
explicit SampleQueryGLTest();
@ -63,8 +63,8 @@ SampleQueryGLTest::SampleQueryGLTest() {
void SampleQueryGLTest::wrap() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::occlusion_query_boolean>())
CORRADE_SKIP(Extensions::GL::EXT::occlusion_query_boolean::string() + std::string(" is not available."));
if(!Context::current().isExtensionSupported<Extensions::EXT::occlusion_query_boolean>())
CORRADE_SKIP(Extensions::EXT::occlusion_query_boolean::string() + std::string(" is not available."));
#endif
GLuint id;
@ -150,8 +150,8 @@ MyShader::MyShader() {
void SampleQueryGLTest::querySamplesPassed() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::occlusion_query_boolean>())
CORRADE_SKIP(Extensions::GL::EXT::occlusion_query_boolean::string() + std::string(" is not available."));
if(!Context::current().isExtensionSupported<Extensions::EXT::occlusion_query_boolean>())
CORRADE_SKIP(Extensions::EXT::occlusion_query_boolean::string() + std::string(" is not available."));
#endif
Renderbuffer renderbuffer;
@ -175,7 +175,7 @@ void SampleQueryGLTest::querySamplesPassed() {
MyShader shader;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
framebuffer.bind();
@ -193,7 +193,7 @@ void SampleQueryGLTest::querySamplesPassed() {
const UnsignedInt count = q.result<UnsignedInt>();
const bool availableAfter = q.resultAvailable();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(!availableBefore);
CORRADE_VERIFY(availableAfter);
#ifndef MAGNUM_TARGET_GLES
@ -205,8 +205,8 @@ void SampleQueryGLTest::querySamplesPassed() {
#ifndef MAGNUM_TARGET_GLES
void SampleQueryGLTest::conditionalRender() {
if(!Context::current().isExtensionSupported<Extensions::GL::NV::conditional_render>())
CORRADE_SKIP(Extensions::GL::NV::conditional_render::string() + std::string(" is not available."));
if(!Context::current().isExtensionSupported<Extensions::NV::conditional_render>())
CORRADE_SKIP(Extensions::NV::conditional_render::string() + std::string(" is not available."));
Renderbuffer renderbuffer;
renderbuffer.setStorage(RenderbufferFormat::RGBA8, Vector2i(32));
@ -226,7 +226,7 @@ void SampleQueryGLTest::conditionalRender() {
MyShader shader;
framebuffer.bind();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
SampleQuery qYes{SampleQuery::Target::SamplesPassed},
qNo{SampleQuery::Target::SamplesPassed},
@ -244,7 +244,7 @@ void SampleQueryGLTest::conditionalRender() {
q.end();
qYes.endConditionalRender();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(qYes.result<bool>());
CORRADE_VERIFY(q.result<bool>());
@ -259,12 +259,12 @@ void SampleQueryGLTest::conditionalRender() {
q.end();
qNo.endConditionalRender();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(!qNo.result<bool>());
CORRADE_VERIFY(!q.result<bool>());
}
#endif
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::SampleQueryGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::SampleQueryGLTest)

8
src/Magnum/GL/Test/SampleQueryTest.cpp

@ -25,9 +25,9 @@
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/SampleQuery.h"
#include "Magnum/GL/SampleQuery.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct SampleQueryTest: TestSuite::Tester {
explicit SampleQueryTest();
@ -48,6 +48,6 @@ void SampleQueryTest::constructNoCreate() {
CORRADE_VERIFY(true);
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::SampleQueryTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::SampleQueryTest)

28
src/Magnum/GL/Test/ShaderGLTest.cpp

@ -25,14 +25,14 @@
#include <Corrade/Utility/Directory.h>
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/Shader.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/Shader.h"
#include "Magnum/GL/OpenGLTester.h"
#include "configure.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct ShaderGLTest: OpenGLTester {
explicit ShaderGLTest();
@ -80,7 +80,7 @@ void ShaderGLTest::construct() {
const Shader shader(Version::GLES300, Shader::Type::Fragment);
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(shader.id() > 0);
CORRADE_COMPARE(shader.type(), Shader::Type::Fragment);
#ifndef MAGNUM_TARGET_GLES
@ -90,7 +90,7 @@ void ShaderGLTest::construct() {
#endif
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void ShaderGLTest::constructNoVersion() {
@ -111,7 +111,7 @@ void ShaderGLTest::constructMove() {
#endif
const Int id = a.id();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0);
Shader b(std::move(a));
@ -133,7 +133,7 @@ void ShaderGLTest::constructMove() {
const Int cId = c.id();
c = std::move(b);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0);
CORRADE_COMPARE(b.id(), cId);
CORRADE_COMPARE(c.id(), id);
@ -148,8 +148,8 @@ void ShaderGLTest::constructMove() {
#ifndef MAGNUM_TARGET_WEBGL
void ShaderGLTest::label() {
/* No-Op version is tested in AbstractObjectGLTest */
if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>() &&
!Context::current().isExtensionSupported<Extensions::GL::EXT::debug_label>())
if(!Context::current().isExtensionSupported<Extensions::KHR::debug>() &&
!Context::current().isExtensionSupported<Extensions::EXT::debug_label>())
CORRADE_SKIP("Required extension is not available");
#ifndef MAGNUM_TARGET_GLES
@ -162,7 +162,7 @@ void ShaderGLTest::label() {
shader.setLabel("MyShader");
CORRADE_COMPARE(shader.label(), "MyShader");
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
@ -305,6 +305,6 @@ void ShaderGLTest::compileNoVersion() {
CORRADE_VERIFY(shader.compile());
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::ShaderGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::ShaderGLTest)

8
src/Magnum/GL/Test/ShaderTest.cpp

@ -26,9 +26,9 @@
#include <sstream>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Shader.h"
#include "Magnum/GL/Shader.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct ShaderTest: TestSuite::Tester {
explicit ShaderTest();
@ -47,6 +47,6 @@ void ShaderTest::debugType() {
CORRADE_COMPARE(out.str(), "GL::Shader::Type::Fragment GL::Shader::Type(0xdead)\n");
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::ShaderTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::ShaderTest)

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

File diff suppressed because it is too large Load Diff

8
src/Magnum/GL/Test/TextureArrayTest.cpp

@ -25,9 +25,9 @@
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/TextureArray.h"
#include "Magnum/GL/TextureArray.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct TextureArrayTest: TestSuite::Tester {
explicit TextureArrayTest();
@ -66,6 +66,6 @@ void TextureArrayTest::construct2DNoCreate() {
CORRADE_VERIFY(true);
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::TextureArrayTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::TextureArrayTest)

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

File diff suppressed because it is too large Load Diff

8
src/Magnum/GL/Test/TextureTest.cpp

@ -25,9 +25,9 @@
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Texture.h"
#include "Magnum/GL/Texture.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct TextureTest: TestSuite::Tester {
explicit TextureTest();
@ -84,6 +84,6 @@ void TextureTest::construct3DNoCreate() {
}
#endif
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::TextureTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::TextureTest)

40
src/Magnum/GL/Test/TimeQueryGLTest.cpp

@ -25,12 +25,12 @@
#include <Corrade/TestSuite/Compare/Numeric.h>
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/TimeQuery.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/OpenGLTester.h"
#include "Magnum/GL/TimeQuery.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct TimeQueryGLTest: OpenGLTester {
explicit TimeQueryGLTest();
@ -50,11 +50,11 @@ TimeQueryGLTest::TimeQueryGLTest() {
void TimeQueryGLTest::wrap() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::timer_query>())
CORRADE_SKIP(Extensions::GL::ARB::timer_query::string() + std::string(" is not available"));
if(!Context::current().isExtensionSupported<Extensions::ARB::timer_query>())
CORRADE_SKIP(Extensions::ARB::timer_query::string() + std::string(" is not available"));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::disjoint_timer_query>())
CORRADE_SKIP(Extensions::GL::EXT::disjoint_timer_query::string() + std::string(" is not available"));
if(!Context::current().isExtensionSupported<Extensions::EXT::disjoint_timer_query>())
CORRADE_SKIP(Extensions::EXT::disjoint_timer_query::string() + std::string(" is not available"));
#endif
GLuint id;
@ -81,11 +81,11 @@ void TimeQueryGLTest::wrap() {
void TimeQueryGLTest::queryTime() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::timer_query>())
CORRADE_SKIP(Extensions::GL::ARB::timer_query::string() + std::string(" is not available"));
if(!Context::current().isExtensionSupported<Extensions::ARB::timer_query>())
CORRADE_SKIP(Extensions::ARB::timer_query::string() + std::string(" is not available"));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::disjoint_timer_query>())
CORRADE_SKIP(Extensions::GL::EXT::disjoint_timer_query::string() + std::string(" is not available"));
if(!Context::current().isExtensionSupported<Extensions::EXT::disjoint_timer_query>())
CORRADE_SKIP(Extensions::EXT::disjoint_timer_query::string() + std::string(" is not available"));
#endif
TimeQuery q1{TimeQuery::Target::TimeElapsed};
@ -93,7 +93,7 @@ void TimeQueryGLTest::queryTime() {
q1.end();
const auto result1 = q1.result<UnsignedInt>();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
TimeQuery q2{TimeQuery::Target::TimeElapsed};
q2.begin();
@ -102,14 +102,14 @@ void TimeQueryGLTest::queryTime() {
q2.end();
const auto result2 = q2.result<UnsignedInt>();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(result2, result1, TestSuite::Compare::GreaterOrEqual);
}
void TimeQueryGLTest::queryTimestamp() {
#ifdef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::disjoint_timer_query>())
CORRADE_SKIP(Extensions::GL::EXT::disjoint_timer_query::string() + std::string(" is not available"));
if(!Context::current().isExtensionSupported<Extensions::EXT::disjoint_timer_query>())
CORRADE_SKIP(Extensions::EXT::disjoint_timer_query::string() + std::string(" is not available"));
#endif
TimeQuery q1{TimeQuery::Target::Timestamp},
@ -129,11 +129,11 @@ void TimeQueryGLTest::queryTimestamp() {
const auto result1 = q1.result<UnsignedLong>();
const auto result2 = q2.result<UnsignedLong>();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE_AS(result2, result1, TestSuite::Compare::GreaterOrEqual);
CORRADE_COMPARE_AS(result2 - result1, result, TestSuite::Compare::GreaterOrEqual);
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::TimeQueryGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::TimeQueryGLTest)

8
src/Magnum/GL/Test/TimeQueryTest.cpp

@ -25,9 +25,9 @@
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/TimeQuery.h"
#include "Magnum/GL/TimeQuery.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct TimeQueryTest: TestSuite::Tester {
explicit TimeQueryTest();
@ -48,6 +48,6 @@ void TimeQueryTest::constructNoCreate() {
CORRADE_VERIFY(true);
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::TimeQueryTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::TimeQueryTest)

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

@ -23,24 +23,24 @@
DEALINGS IN THE SOFTWARE.
*/
#include "Magnum/AbstractShaderProgram.h"
#include "Magnum/Buffer.h"
#include "Magnum/Context.h"
#include "Magnum/Extensions.h"
#include "Magnum/Framebuffer.h"
#include "Magnum/Image.h"
#include "Magnum/Mesh.h"
#include "Magnum/OpenGLTester.h"
#include "Magnum/PixelFormat.h"
#include "Magnum/PrimitiveQuery.h"
#include "Magnum/SampleQuery.h"
#include "Magnum/Renderbuffer.h"
#include "Magnum/RenderbufferFormat.h"
#include "Magnum/Shader.h"
#include "Magnum/TransformFeedback.h"
#include "Magnum/GL/AbstractShaderProgram.h"
#include "Magnum/GL/Buffer.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#include "Magnum/GL/Framebuffer.h"
#include "Magnum/GL/Mesh.h"
#include "Magnum/GL/OpenGLTester.h"
#include "Magnum/GL/PixelFormat.h"
#include "Magnum/GL/PrimitiveQuery.h"
#include "Magnum/GL/SampleQuery.h"
#include "Magnum/GL/Renderbuffer.h"
#include "Magnum/GL/RenderbufferFormat.h"
#include "Magnum/GL/Shader.h"
#include "Magnum/GL/TransformFeedback.h"
#include "Magnum/Math/Vector2.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct TransformFeedbackGLTest: OpenGLTester {
explicit TransformFeedbackGLTest();
@ -111,18 +111,18 @@ TransformFeedbackGLTest::TransformFeedbackGLTest() {
void TransformFeedbackGLTest::construct() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::GL::ARB::transform_feedback2::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::ARB::transform_feedback2::string() + std::string(" is not supported."));
#endif
{
TransformFeedback feedback;
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(feedback.id() > 0);
}
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
void TransformFeedbackGLTest::constructCopy() {
@ -132,14 +132,14 @@ void TransformFeedbackGLTest::constructCopy() {
void TransformFeedbackGLTest::constructMove() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::GL::ARB::transform_feedback2::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::ARB::transform_feedback2::string() + std::string(" is not supported."));
#endif
TransformFeedback a;
const Int id = a.id();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0);
TransformFeedback b{std::move(a)};
@ -151,7 +151,7 @@ void TransformFeedbackGLTest::constructMove() {
const Int cId = c.id();
c = std::move(b);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0);
CORRADE_COMPARE(b.id(), cId);
CORRADE_COMPARE(c.id(), id);
@ -159,8 +159,8 @@ void TransformFeedbackGLTest::constructMove() {
void TransformFeedbackGLTest::wrap() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::GL::ARB::transform_feedback2::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::ARB::transform_feedback2::string() + std::string(" is not supported."));
#endif
GLuint id;
@ -180,11 +180,11 @@ void TransformFeedbackGLTest::wrap() {
void TransformFeedbackGLTest::label() {
/* No-Op version is tested in AbstractObjectGLTest */
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::GL::ARB::transform_feedback2::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::ARB::transform_feedback2::string() + std::string(" is not supported."));
#endif
if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>() &&
!Context::current().isExtensionSupported<Extensions::GL::EXT::debug_label>())
if(!Context::current().isExtensionSupported<Extensions::KHR::debug>() &&
!Context::current().isExtensionSupported<Extensions::EXT::debug_label>())
CORRADE_SKIP("Required extension is not available");
TransformFeedback feedback;
@ -193,23 +193,23 @@ void TransformFeedbackGLTest::label() {
{
#ifdef MAGNUM_TARGET_GLES
CORRADE_EXPECT_FAIL_IF(Context::current().detectedDriver() & Context::DetectedDriver::NVidia &&
!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>(),
!Context::current().isExtensionSupported<Extensions::KHR::debug>(),
"NVidia 387.34 ES3.2 complains that GL_TRANSFORM_FEEDBACK can't be used with glGetObjectLabelEXT().");
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
feedback.setLabel("MyXfb");
{
#ifdef MAGNUM_TARGET_GLES
CORRADE_EXPECT_FAIL_IF(Context::current().detectedDriver() & Context::DetectedDriver::NVidia &&
!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>(),
!Context::current().isExtensionSupported<Extensions::KHR::debug>(),
"NVidia 387.34 ES3.2 complains that GL_TRANSFORM_FEEDBACK can't be used with glGetObjectLabelEXT().");
#endif
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(feedback.label(), "MyXfb");
MAGNUM_VERIFY_NO_ERROR(); /* Check for errors again to flush the error state */
MAGNUM_VERIFY_NO_GL_ERROR(); /* Check for errors again to flush the error state */
}
}
@ -264,8 +264,8 @@ XfbShader::XfbShader() {
void TransformFeedbackGLTest::attachBase() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::GL::ARB::transform_feedback2::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::ARB::transform_feedback2::string() + std::string(" is not supported."));
#endif
/* Bind some FB to avoid errors on contexts w/o default FB */
@ -290,14 +290,14 @@ void TransformFeedbackGLTest::attachBase() {
TransformFeedback feedback;
feedback.attachBuffer(0, output);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
Renderer::enable(Renderer::Feature::RasterizerDiscard);
feedback.begin(shader, TransformFeedback::PrimitiveMode::Points);
mesh.draw(shader);
feedback.end();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
auto data = Containers::arrayCast<const Vector2>(output.mapRead(0, 2*sizeof(Vector2)));
CORRADE_COMPARE(data[0], Vector2(1.0f, -1.0f));
@ -307,8 +307,8 @@ void TransformFeedbackGLTest::attachBase() {
void TransformFeedbackGLTest::attachRange() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::GL::ARB::transform_feedback2::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::ARB::transform_feedback2::string() + std::string(" is not supported."));
#endif
/* Bind some FB to avoid errors on contexts w/o default FB */
@ -333,14 +333,14 @@ void TransformFeedbackGLTest::attachRange() {
TransformFeedback feedback;
feedback.attachBuffer(0, output, 256, 2*sizeof(Vector2));
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
Renderer::enable(Renderer::Feature::RasterizerDiscard);
feedback.begin(shader, TransformFeedback::PrimitiveMode::Points);
mesh.draw(shader);
feedback.end();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
auto data = Containers::arrayCast<const Vector2>(output.mapRead(256, 2*sizeof(Vector2)));
CORRADE_COMPARE(data[0], Vector2(1.0f, -1.0f));
@ -396,8 +396,8 @@ XfbMultiShader::XfbMultiShader() {
void TransformFeedbackGLTest::attachBases() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::GL::ARB::transform_feedback2::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::ARB::transform_feedback2::string() + std::string(" is not supported."));
#endif
/* Bind some FB to avoid errors on contexts w/o default FB */
@ -423,14 +423,14 @@ void TransformFeedbackGLTest::attachBases() {
TransformFeedback feedback;
feedback.attachBuffers(0, {&output1, &output2});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
Renderer::enable(Renderer::Feature::RasterizerDiscard);
feedback.begin(shader, TransformFeedback::PrimitiveMode::Points);
mesh.draw(shader);
feedback.end();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
auto data1 = Containers::arrayCast<const Vector2>(output1.mapRead(0, 2*sizeof(Vector2)));
CORRADE_COMPARE(data1[0], Vector2(1.0f, -1.0f));
@ -445,8 +445,8 @@ void TransformFeedbackGLTest::attachBases() {
void TransformFeedbackGLTest::attachRanges() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::GL::ARB::transform_feedback2::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::ARB::transform_feedback2::string() + std::string(" is not supported."));
#endif
/* Bind some FB to avoid errors on contexts w/o default FB */
@ -475,14 +475,14 @@ void TransformFeedbackGLTest::attachRanges() {
std::make_tuple(&output2, 512, 2*sizeof(Float))
});
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
Renderer::enable(Renderer::Feature::RasterizerDiscard);
feedback.begin(shader, TransformFeedback::PrimitiveMode::Points);
mesh.draw(shader);
feedback.end();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
auto data1 = Containers::arrayCast<const Vector2>(output1.mapRead(256, 2*sizeof(Vector2)));
CORRADE_COMPARE(data1[0], Vector2(1.0f, -1.0f));
@ -498,8 +498,8 @@ void TransformFeedbackGLTest::attachRanges() {
#ifndef MAGNUM_TARGET_GLES
void TransformFeedbackGLTest::interleaved() {
/* ARB_transform_feedback3 needed for gl_SkipComponents1 */
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback3>())
CORRADE_SKIP(Extensions::GL::ARB::transform_feedback3::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback3>())
CORRADE_SKIP(Extensions::ARB::transform_feedback3::string() + std::string(" is not supported."));
/* Bind some FB to avoid errors on contexts w/o default FB */
Renderbuffer color;
@ -550,14 +550,14 @@ void TransformFeedbackGLTest::interleaved() {
TransformFeedback feedback;
feedback.attachBuffer(0, output);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
Renderer::enable(Renderer::Feature::RasterizerDiscard);
feedback.begin(shader, TransformFeedback::PrimitiveMode::Points);
mesh.draw(shader);
feedback.end();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
auto data = Containers::arrayCast<const Vector2>(output.mapRead(0, 4*sizeof(Vector2)));
CORRADE_COMPARE(data[0], Vector2(1.0f, -1.0f));
@ -571,12 +571,12 @@ void TransformFeedbackGLTest::draw() {
setTestCaseDescription(DrawData[testCaseInstanceId()].name);
/* ARB_transform_feedback2 needed as base, other optional */
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::GL::ARB::transform_feedback2::string() + std::string(" is not supported."));
if(DrawData[testCaseInstanceId()].stream && (!Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback3>() || TransformFeedback::maxVertexStreams() < 2))
CORRADE_SKIP(Extensions::GL::ARB::transform_feedback3::string() + std::string(" is not supported well enough."));
if(DrawData[testCaseInstanceId()].instances && !Context::current().isExtensionSupported<Extensions::GL::ARB::transform_feedback_instanced>())
CORRADE_SKIP(Extensions::GL::ARB::transform_feedback_instanced::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback2>())
CORRADE_SKIP(Extensions::ARB::transform_feedback2::string() + std::string(" is not supported."));
if(DrawData[testCaseInstanceId()].stream && (!Context::current().isExtensionSupported<Extensions::ARB::transform_feedback3>() || TransformFeedback::maxVertexStreams() < 2))
CORRADE_SKIP(Extensions::ARB::transform_feedback3::string() + std::string(" is not supported well enough."));
if(DrawData[testCaseInstanceId()].instances && !Context::current().isExtensionSupported<Extensions::ARB::transform_feedback_instanced>())
CORRADE_SKIP(Extensions::ARB::transform_feedback_instanced::string() + std::string(" is not supported."));
/* Bind some FB to avoid errors on contexts w/o default FB */
Renderbuffer color;
@ -630,7 +630,7 @@ void TransformFeedbackGLTest::draw() {
TransformFeedback feedback;
feedback.attachBuffer(0, outputBuffer);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
PrimitiveQuery queryStream0{PrimitiveQuery::Target::TransformFeedbackPrimitivesWritten},
queryStreamN{PrimitiveQuery::Target::TransformFeedbackPrimitivesWritten};
@ -649,7 +649,7 @@ void TransformFeedbackGLTest::draw() {
queryStreamN.end();
queryStream0.end();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(queryStream0.result<UnsignedInt>(), DrawData[testCaseInstanceId()].countStream0);
if(DrawData[testCaseInstanceId()].stream)
@ -694,15 +694,15 @@ void TransformFeedbackGLTest::draw() {
outputMesh.draw(drawShader, feedback, DrawData[testCaseInstanceId()].stream);
q.end();
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(q.result<UnsignedInt>(), DrawData[testCaseInstanceId()].countDraw);
CORRADE_COMPARE(fb.read({{}, Vector2i{1}}, {PixelFormat::RGBA, PixelType::UnsignedByte}).data<UnsignedByte>()[0], 153);
MAGNUM_VERIFY_NO_ERROR();
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::TransformFeedbackGLTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::TransformFeedbackGLTest)

8
src/Magnum/GL/Test/TransformFeedbackTest.cpp

@ -25,9 +25,9 @@
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/TransformFeedback.h"
#include "Magnum/GL/TransformFeedback.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct TransformFeedbackTest: TestSuite::Tester {
explicit TransformFeedbackTest();
@ -48,6 +48,6 @@ void TransformFeedbackTest::constructNoCreate() {
CORRADE_VERIFY(true);
}
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::TransformFeedbackTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::TransformFeedbackTest)

8
src/Magnum/GL/Test/VersionTest.cpp

@ -26,9 +26,9 @@
#include <sstream>
#include <Corrade/TestSuite/Tester.h>
#include "Magnum/Version.h"
#include "Magnum/GL/Version.h"
namespace Magnum { namespace Test {
namespace Magnum { namespace GL { namespace Test {
struct VersionTest: TestSuite::Tester {
explicit VersionTest();
@ -126,6 +126,6 @@ void VersionTest::debugES() {
}
#endif
}}
}}}
CORRADE_TEST_MAIN(Magnum::Test::VersionTest)
CORRADE_TEST_MAIN(Magnum::GL::Test::VersionTest)

Loading…
Cancel
Save