Browse Source

Test: make the GL tests compile on WebGL 1.

Not WebGL 2 yet, though.
pull/205/head
Vladimír Vondruš 8 years ago
parent
commit
cb2a20aced
  1. 11
      src/Magnum/DebugTools/Test/CMakeLists.txt
  2. 28
      src/Magnum/DebugTools/Test/TextureImageGLTest.cpp
  3. 9
      src/Magnum/Test/AbstractQueryGLTest.cpp
  4. 6
      src/Magnum/Test/AbstractShaderProgramGLTest.cpp
  5. 9
      src/Magnum/Test/AbstractTextureGLTest.cpp
  6. 12
      src/Magnum/Test/BufferGLTest.cpp
  7. 46
      src/Magnum/Test/CMakeLists.txt
  8. 111
      src/Magnum/Test/CubeMapTextureGLTest.cpp
  9. 232
      src/Magnum/Test/FramebufferGLTest.cpp
  10. 49
      src/Magnum/Test/MeshGLTest.cpp
  11. 16
      src/Magnum/Test/RenderbufferGLTest.cpp
  12. 6
      src/Magnum/Test/ShaderGLTest.cpp
  13. 152
      src/Magnum/Test/TextureGLTest.cpp
  14. 2
      src/Magnum/Test/configure.h.cmake
  15. 5
      src/Magnum/Text/Test/RendererGLTest.cpp

11
src/Magnum/DebugTools/Test/CMakeLists.txt

@ -46,11 +46,12 @@ if(Corrade_TestSuite_FOUND)
endif()
if(BUILD_GL_TESTS)
corrade_add_test(DebugToolsBufferDataGLTest BufferDataGLTest.cpp LIBRARIES MagnumDebugTools MagnumOpenGLTester)
corrade_add_test(DebugToolsTextureImageGLTest TextureImageGLTest.cpp LIBRARIES MagnumDebugTools MagnumOpenGLTester)
set_target_properties(DebugToolsTextureImageGLTest PROPERTIES FOLDER "Magnum/DebugTools/Test")
set_target_properties(
DebugToolsBufferDataGLTest
DebugToolsTextureImageGLTest
PROPERTIES FOLDER "Magnum/DebugTools/Test")
if(NOT (MAGNUM_TARGET_GLES2 AND MAGNUM_TARGET_WEBGL))
corrade_add_test(DebugToolsBufferDataGLTest BufferDataGLTest.cpp LIBRARIES MagnumDebugTools MagnumOpenGLTester)
set_target_properties(DebugToolsBufferDataGLTest PROPERTIES FOLDER "Magnum/DebugTools/Test")
endif()
endif()

28
src/Magnum/DebugTools/Test/TextureImageGLTest.cpp

@ -31,11 +31,11 @@
#include "Magnum/PixelFormat.h"
#include "Magnum/Texture.h"
#include "Magnum/TextureFormat.h"
#include "Magnum/DebugTools/BufferData.h"
#include "Magnum/DebugTools/TextureImage.h"
#include "Magnum/Math/Range.h"
#ifndef MAGNUM_TARGET_GLES2
#include "Magnum/DebugTools/BufferData.h"
#include "Magnum/BufferImage.h"
#endif
@ -87,7 +87,13 @@ namespace {
void TextureImageGLTest::subImage2D() {
Texture2D texture;
texture.setImage(0, TextureFormat::RGBA8, ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{2}, Data2D});
texture.setImage(0,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
TextureFormat::RGBA8,
#else
TextureFormat::RGBA,
#endif
ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{2}, Data2D});
Image2D image = textureSubImage(texture, 0, {{}, Vector2i{2}}, {PixelFormat::RGBA, PixelType::UnsignedByte});
MAGNUM_VERIFY_NO_ERROR();
@ -113,13 +119,19 @@ void TextureImageGLTest::subImage2DBuffer() {
void TextureImageGLTest::subImageCube() {
ImageView2D view{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{2}, Data2D};
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
constexpr TextureFormat format = TextureFormat::RGBA8;
#else
constexpr TextureFormat format = TextureFormat::RGBA;
#endif
CubeMapTexture texture;
texture.setImage(CubeMapCoordinate::PositiveX, 0, TextureFormat::RGBA8, view)
.setImage(CubeMapCoordinate::NegativeX, 0, TextureFormat::RGBA8, view)
.setImage(CubeMapCoordinate::PositiveY, 0, TextureFormat::RGBA8, view)
.setImage(CubeMapCoordinate::NegativeY, 0, TextureFormat::RGBA8, view)
.setImage(CubeMapCoordinate::PositiveZ, 0, TextureFormat::RGBA8, view)
.setImage(CubeMapCoordinate::NegativeZ, 0, TextureFormat::RGBA8, view);
texture.setImage(CubeMapCoordinate::PositiveX, 0, format, view)
.setImage(CubeMapCoordinate::NegativeX, 0, format, view)
.setImage(CubeMapCoordinate::PositiveY, 0, format, view)
.setImage(CubeMapCoordinate::NegativeY, 0, format, view)
.setImage(CubeMapCoordinate::PositiveZ, 0, format, view)
.setImage(CubeMapCoordinate::NegativeZ, 0, format, view);
Image2D image = textureSubImage(texture, CubeMapCoordinate::PositiveX, 0, {{}, Vector2i{2}}, {PixelFormat::RGBA, PixelType::UnsignedByte});
MAGNUM_VERIFY_NO_ERROR();

9
src/Magnum/Test/AbstractQueryGLTest.cpp

@ -37,7 +37,9 @@ struct AbstractQueryGLTest: OpenGLTester {
void constructCopy();
void constructMove();
#ifndef MAGNUM_TARGET_WEBGL
void label();
#endif
};
AbstractQueryGLTest::AbstractQueryGLTest() {
@ -45,7 +47,10 @@ AbstractQueryGLTest::AbstractQueryGLTest() {
&AbstractQueryGLTest::constructCopy,
&AbstractQueryGLTest::constructMove,
&AbstractQueryGLTest::label});
#ifndef MAGNUM_TARGET_WEBGL
&AbstractQueryGLTest::label
#endif
});
}
void AbstractQueryGLTest::construct() {
@ -108,6 +113,7 @@ void AbstractQueryGLTest::constructMove() {
CORRADE_COMPARE(c.id(), id);
}
#ifndef MAGNUM_TARGET_WEBGL
void AbstractQueryGLTest::label() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::occlusion_query_boolean>())
@ -142,6 +148,7 @@ void AbstractQueryGLTest::label() {
MAGNUM_VERIFY_NO_ERROR();
}
#endif
}}

6
src/Magnum/Test/AbstractShaderProgramGLTest.cpp

@ -53,7 +53,9 @@ struct AbstractShaderProgramGLTest: OpenGLTester {
void constructCopy();
void constructMove();
#ifndef MAGNUM_TARGET_WEBGL
void label();
#endif
void create();
void createMultipleOutputs();
@ -81,7 +83,9 @@ AbstractShaderProgramGLTest::AbstractShaderProgramGLTest() {
&AbstractShaderProgramGLTest::constructCopy,
&AbstractShaderProgramGLTest::constructMove,
#ifndef MAGNUM_TARGET_WEBGL
&AbstractShaderProgramGLTest::label,
#endif
&AbstractShaderProgramGLTest::create,
&AbstractShaderProgramGLTest::createMultipleOutputs,
@ -150,6 +154,7 @@ void AbstractShaderProgramGLTest::constructMove() {
CORRADE_COMPARE(c.id(), id);
}
#ifndef MAGNUM_TARGET_WEBGL
void AbstractShaderProgramGLTest::label() {
/* No-Op version is tested in AbstractObjectGLTest */
if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>() &&
@ -164,6 +169,7 @@ void AbstractShaderProgramGLTest::label() {
MAGNUM_VERIFY_NO_ERROR();
}
#endif
namespace {
struct MyPublicShader: AbstractShaderProgram {

9
src/Magnum/Test/AbstractTextureGLTest.cpp

@ -37,7 +37,9 @@ struct AbstractTextureGLTest: OpenGLTester {
void constructCopy();
void constructMove();
#ifndef MAGNUM_TARGET_WEBGL
void label();
#endif
};
AbstractTextureGLTest::AbstractTextureGLTest() {
@ -45,7 +47,10 @@ AbstractTextureGLTest::AbstractTextureGLTest() {
&AbstractTextureGLTest::constructCopy,
&AbstractTextureGLTest::constructMove,
&AbstractTextureGLTest::label});
#ifndef MAGNUM_TARGET_WEBGL
&AbstractTextureGLTest::label
#endif
});
}
void AbstractTextureGLTest::construct() {
@ -86,6 +91,7 @@ void AbstractTextureGLTest::constructMove() {
CORRADE_COMPARE(c.id(), id);
}
#ifndef MAGNUM_TARGET_WEBGL
void AbstractTextureGLTest::label() {
/* No-Op version is tested in AbstractObjectGLTest */
if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>() &&
@ -102,6 +108,7 @@ void AbstractTextureGLTest::label() {
CORRADE_COMPARE(texture.label(), "MyTexture");
}
#endif
}}

12
src/Magnum/Test/BufferGLTest.cpp

@ -43,7 +43,9 @@ struct BufferGLTest: OpenGLTester {
void constructMove();
void wrap();
#ifndef MAGNUM_TARGET_WEBGL
void label();
#endif
#ifndef MAGNUM_TARGET_GLES2
void bindBase();
@ -51,9 +53,11 @@ struct BufferGLTest: OpenGLTester {
#endif
void data();
#ifndef MAGNUM_TARGET_WEBGL
void map();
void mapRange();
void mapRangeExplicitFlush();
#endif
#ifndef MAGNUM_TARGET_GLES2
void copy();
#endif
@ -66,7 +70,9 @@ BufferGLTest::BufferGLTest() {
&BufferGLTest::constructMove,
&BufferGLTest::wrap,
#ifndef MAGNUM_TARGET_WEBGL
&BufferGLTest::label,
#endif
#ifndef MAGNUM_TARGET_GLES2
&BufferGLTest::bindBase,
@ -74,9 +80,11 @@ BufferGLTest::BufferGLTest() {
#endif
&BufferGLTest::data,
#ifndef MAGNUM_TARGET_WEBGL
&BufferGLTest::map,
&BufferGLTest::mapRange,
&BufferGLTest::mapRangeExplicitFlush,
#endif
#ifndef MAGNUM_TARGET_GLES2
&BufferGLTest::copy,
#endif
@ -138,6 +146,7 @@ void BufferGLTest::wrap() {
glDeleteBuffers(1, &id);
}
#ifndef MAGNUM_TARGET_WEBGL
void BufferGLTest::label() {
/* No-Op version is tested in AbstractObjectGLTest */
if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>() &&
@ -154,6 +163,7 @@ void BufferGLTest::label() {
CORRADE_COMPARE(buffer.label(), "MyBuffer");
}
#endif
#ifndef MAGNUM_TARGET_GLES2
void BufferGLTest::bindBase() {
@ -262,6 +272,7 @@ void BufferGLTest::data() {
#endif
}
#ifndef MAGNUM_TARGET_WEBGL
void BufferGLTest::map() {
#ifdef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::OES::mapbuffer>())
@ -369,6 +380,7 @@ void BufferGLTest::mapRangeExplicitFlush() {
CORRADE_COMPARE(changedContents[4], 107);
#endif
}
#endif
#ifndef MAGNUM_TARGET_GLES2
void BufferGLTest::copy() {

46
src/Magnum/Test/CMakeLists.txt

@ -128,20 +128,14 @@ set_target_properties(
PROPERTIES FOLDER "Magnum/Test")
if(BUILD_GL_TESTS)
corrade_add_test(AbstractObjectGLTest AbstractObjectGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(AbstractQueryGLTest AbstractQueryGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(AbstractTextureGLTest AbstractTextureGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(BufferGLTest BufferGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(ContextGLTest ContextGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(CubeMapTextureGLTest CubeMapTextureGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(DebugOutputGLTest DebugOutputGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(FramebufferGLTest FramebufferGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(MeshGLTest MeshGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(PixelStorageGLTest PixelStorageGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(RenderbufferGLTest RenderbufferGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(SampleQueryGLTest SampleQueryGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(TextureGLTest TextureGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(TimeQueryGLTest TimeQueryGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_resource(AbstractShaderProgramGLTest_RES AbstractShaderProgramGLTestFiles/resources.conf)
corrade_add_test(AbstractShaderProgramGLTest
@ -149,26 +143,28 @@ if(BUILD_GL_TESTS)
${AbstractShaderProgramGLTest_RES}
LIBRARIES MagnumOpenGLTester)
if(CORRADE_TARGET_EMSCRIPTEN OR CORRADE_TARGET_ANDROID)
set(SHADERGLTEST_FILES_DIR "ShaderGLTestFiles")
else()
set(SHADERGLTEST_FILES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ShaderGLTestFiles)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/configure.h)
corrade_add_test(ShaderGLTest ShaderGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(ShaderGLTest ShaderGLTest.cpp
LIBRARIES MagnumOpenGLTester
FILES ShaderGLTestFiles/shader.glsl)
target_include_directories(ShaderGLTest PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(
AbstractObjectGLTest
AbstractQueryGLTest
AbstractTextureGLTest
BufferGLTest
ContextGLTest
CubeMapTextureGLTest
DebugOutputGLTest
FramebufferGLTest
MeshGLTest
PixelStorageGLTest
RenderbufferGLTest
SampleQueryGLTest
TextureGLTest
TimeQueryGLTest
AbstractShaderProgramGLTest
AbstractShaderProgramGLTest_RES-dependencies
@ -176,6 +172,30 @@ if(BUILD_GL_TESTS)
ShaderGLTest
PROPERTIES FOLDER "Magnum/Test")
if(NOT MAGNUM_TARGET_WEBGL)
corrade_add_test(AbstractObjectGLTest AbstractObjectGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(DebugOutputGLTest DebugOutputGLTest.cpp LIBRARIES MagnumOpenGLTester)
set_target_properties(
AbstractObjectGLTest
DebugOutputGLTest
PROPERTIES FOLDER "Magnum/Test")
endif()
if(NOT (MAGNUM_TARGET_WEBGL AND MAGNUM_TARGET_GLES2))
corrade_add_test(AbstractQueryGLTest AbstractQueryGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(PixelStorageGLTest PixelStorageGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(SampleQueryGLTest SampleQueryGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(TimeQueryGLTest TimeQueryGLTest.cpp LIBRARIES MagnumOpenGLTester)
set_target_properties(
AbstractQueryGLTest
PixelStorageGLTest
SampleQueryGLTest
TimeQueryGLTest
PROPERTIES FOLDER "Magnum/Test")
endif()
if(NOT MAGNUM_TARGET_GLES2)
corrade_add_test(BufferImageGLTest BufferImageGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(BufferTextureGLTest BufferTextureGLTest.cpp LIBRARIES MagnumOpenGLTester)

111
src/Magnum/Test/CubeMapTextureGLTest.cpp

@ -55,10 +55,12 @@ struct CubeMapTextureGLTest: OpenGLTester {
#endif
void sampling();
#ifndef MAGNUM_TARGET_WEBGL
void samplingSRGBDecode();
#endif
#ifndef MAGNUM_TARGET_GLES2
void samplingSwizzle();
#else
#elif !defined(MAGNUM_TARGET_WEBGL)
void samplingMaxLevel();
void samplingCompare();
#endif
@ -68,7 +70,7 @@ struct CubeMapTextureGLTest: OpenGLTester {
#ifndef MAGNUM_TARGET_GLES2
void samplingDepthStencilMode();
#endif
#ifdef MAGNUM_TARGET_GLES
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
void samplingBorder();
#endif
@ -91,7 +93,9 @@ struct CubeMapTextureGLTest: OpenGLTester {
#ifndef MAGNUM_TARGET_GLES2
void compressedImageBuffer();
#endif
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void immutableCompressedImage();
#endif
void compressedSubImage();
#ifndef MAGNUM_TARGET_GLES2
void compressedSubImageBuffer();
@ -121,7 +125,13 @@ namespace {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
enum: std::size_t { PixelStorageDataCount = 2 };
enum: std::size_t { PixelStorageDataCount =
#if !defined(MAGNUM_TARGET_GLES2) || !defined(MAGNUM_TARGET_WEBGL)
2
#else
1
#endif
};
const struct {
const char* name;
@ -288,10 +298,12 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() {
#endif
&CubeMapTextureGLTest::sampling,
#ifndef MAGNUM_TARGET_WEBGL
&CubeMapTextureGLTest::samplingSRGBDecode,
#endif
#ifndef MAGNUM_TARGET_GLES2
&CubeMapTextureGLTest::samplingSwizzle,
#else
#elif !defined(MAGNUM_TARGET_WEBGL)
&CubeMapTextureGLTest::samplingMaxLevel,
&CubeMapTextureGLTest::samplingCompare,
#endif
@ -301,7 +313,7 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() {
#ifndef MAGNUM_TARGET_GLES2
&CubeMapTextureGLTest::samplingDepthStencilMode,
#endif
#ifdef MAGNUM_TARGET_GLES
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
&CubeMapTextureGLTest::samplingBorder,
#endif
@ -331,7 +343,9 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() {
#ifndef MAGNUM_TARGET_GLES2
&CubeMapTextureGLTest::compressedImageBuffer,
#endif
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
&CubeMapTextureGLTest::immutableCompressedImage,
#endif
#ifndef MAGNUM_TARGET_GLES
&CubeMapTextureGLTest::compressedFullImageQuery,
&CubeMapTextureGLTest::compressedFullImageQueryBuffer,
@ -468,6 +482,7 @@ void CubeMapTextureGLTest::sampling() {
MAGNUM_VERIFY_NO_ERROR();
}
#ifndef MAGNUM_TARGET_WEBGL
void CubeMapTextureGLTest::samplingSRGBDecode() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::sRGB>())
@ -481,6 +496,7 @@ void CubeMapTextureGLTest::samplingSRGBDecode() {
MAGNUM_VERIFY_NO_ERROR();
}
#endif
#ifndef MAGNUM_TARGET_GLES2
void CubeMapTextureGLTest::samplingSwizzle() {
@ -494,7 +510,7 @@ void CubeMapTextureGLTest::samplingSwizzle() {
MAGNUM_VERIFY_NO_ERROR();
}
#else
#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."));
@ -556,7 +572,7 @@ void CubeMapTextureGLTest::samplingDepthStencilMode() {
}
#endif
#ifdef MAGNUM_TARGET_GLES
#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>())
@ -572,7 +588,13 @@ void CubeMapTextureGLTest::samplingBorder() {
void CubeMapTextureGLTest::storage() {
CubeMapTexture texture;
texture.setStorage(5, TextureFormat::RGBA8, Vector2i(32));
texture.setStorage(5,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
TextureFormat::RGBA8,
#else
TextureFormat::RGBA,
#endif
Vector2i(32));
MAGNUM_VERIFY_NO_ERROR();
@ -598,12 +620,22 @@ void CubeMapTextureGLTest::image() {
setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name);
#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."));
#else
if(PixelStorageData[testCaseInstanceId()].storage != PixelStorage{})
CORRADE_SKIP("Image unpack is not supported in WebGL 1.");
#endif
#endif
CubeMapTexture texture;
texture.setImage(CubeMapCoordinate::PositiveX, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveX, 0,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
TextureFormat::RGBA8,
#else
TextureFormat::RGBA,
#endif
ImageView2D{PixelStorageData[testCaseInstanceId()].storage,
PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2),
PixelStorageData[testCaseInstanceId()].dataSparse});
@ -671,22 +703,33 @@ void CubeMapTextureGLTest::subImage() {
setTestCaseDescription(PixelStorageData[testCaseInstanceId()].name);
#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."));
#else
if(PixelStorageData[testCaseInstanceId()].storage != PixelStorage{})
CORRADE_SKIP("Image unpack is not supported in WebGL 1.");
#endif
#endif
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
constexpr TextureFormat format = TextureFormat::RGBA8;
#else
constexpr TextureFormat format = TextureFormat::RGBA;
#endif
CubeMapTexture texture;
texture.setImage(CubeMapCoordinate::PositiveX, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveX, 0, format,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setImage(CubeMapCoordinate::NegativeX, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::NegativeX, 0, format,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setImage(CubeMapCoordinate::PositiveY, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveY, 0, format,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setImage(CubeMapCoordinate::NegativeY, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::NegativeY, 0, format,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setImage(CubeMapCoordinate::PositiveZ, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveZ, 0, format,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setImage(CubeMapCoordinate::NegativeZ, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::NegativeZ, 0, format,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setSubImage(CubeMapCoordinate::PositiveX, 0, Vector2i(1), ImageView2D{
PixelStorageData[testCaseInstanceId()].storage,
@ -899,6 +942,7 @@ void CubeMapTextureGLTest::compressedImageBuffer() {
}
#endif
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void CubeMapTextureGLTest::immutableCompressedImage() {
setTestCaseDescription(CompressedPixelStorageData[testCaseInstanceId()].name);
@ -953,6 +997,7 @@ void CubeMapTextureGLTest::immutableCompressedImage() {
TestSuite::Compare::Container);
#endif
}
#endif
namespace {
/* Just 12x12 zeros compressed using RGBA DXT3 by the driver */
@ -1275,18 +1320,24 @@ void CubeMapTextureGLTest::compressedFullImageQueryBuffer() {
#endif
void CubeMapTextureGLTest::generateMipmap() {
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
constexpr TextureFormat format = TextureFormat::RGBA8;
#else
constexpr TextureFormat format = TextureFormat::RGBA;
#endif
CubeMapTexture texture;
texture.setImage(CubeMapCoordinate::PositiveX, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveX, 0, format,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32)));
texture.setImage(CubeMapCoordinate::PositiveY, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveY, 0, format,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32)));
texture.setImage(CubeMapCoordinate::PositiveZ, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveZ, 0, format,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32)));
texture.setImage(CubeMapCoordinate::NegativeX, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::NegativeX, 0, format,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32)));
texture.setImage(CubeMapCoordinate::NegativeY, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::NegativeY, 0, format,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32)));
texture.setImage(CubeMapCoordinate::NegativeZ, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::NegativeZ, 0, format,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32)));
/** @todo How to test this on ES? */
@ -1314,7 +1365,13 @@ void CubeMapTextureGLTest::generateMipmap() {
void CubeMapTextureGLTest::invalidateImage() {
CubeMapTexture texture;
texture.setStorage(2, TextureFormat::RGBA8, Vector2i(32));
texture.setStorage(2,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
TextureFormat::RGBA8,
#else
TextureFormat::RGBA,
#endif
Vector2i(32));
texture.invalidateImage(1);
MAGNUM_VERIFY_NO_ERROR();
@ -1322,16 +1379,24 @@ void CubeMapTextureGLTest::invalidateImage() {
void CubeMapTextureGLTest::invalidateSubImage() {
CubeMapTexture texture;
texture.setStorage(2, TextureFormat::RGBA8, Vector2i(32));
texture.setStorage(2,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
TextureFormat::RGBA8,
#else
TextureFormat::RGBA,
#endif
Vector2i(32));
texture.invalidateSubImage(1, Vector3i(2), Vector3i(Vector2i(8), 4));
{
#ifndef MAGNUM_TARGET_WEBGL
/* Mesa (last checked version 12.0.6) treats cube map images as having
only single layer instead of 6, so the above invalidation call
fails. Relevant source code (scroll up to see imageDepth = 1):
https://github.com/anholt/mesa/blob/1c0ac1976ac7a87bfd2ade47f25047c31527f18a/src/mesa/main/texobj.c#L2179 */
CORRADE_EXPECT_FAIL_IF((Context::current().detectedDriver() & Context::DetectedDriver::Mesa),
"Broken on Mesa.");
#endif
MAGNUM_VERIFY_NO_ERROR();
}

232
src/Magnum/Test/FramebufferGLTest.cpp

@ -60,16 +60,22 @@ struct FramebufferGLTest: OpenGLTester {
void constructMove();
void wrap();
#ifndef MAGNUM_TARGET_WEBGL
void label();
#endif
void attachRenderbuffer();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void attachRenderbufferMultisample();
#endif
#ifndef MAGNUM_TARGET_GLES
void attachTexture1D();
#endif
void attachTexture2D();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void attachTexture3D();
#endif
#ifndef MAGNUM_TARGET_GLES
void attachTexture1DArray();
#endif
@ -110,7 +116,9 @@ struct FramebufferGLTest: OpenGLTester {
void clearStencil();
void clearDepthStencil();
#endif
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void invalidate();
#endif
#ifndef MAGNUM_TARGET_GLES2
void invalidateSub();
#endif
@ -133,7 +141,9 @@ struct FramebufferGLTest: OpenGLTester {
void copySubImageTexture1D();
#endif
void copySubImageTexture2D();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void copySubImageTexture3D();
#endif
#ifndef MAGNUM_TARGET_GLES
void copySubImageTexture1DArray();
#endif
@ -147,9 +157,11 @@ struct FramebufferGLTest: OpenGLTester {
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void copySubImageCubeMapTextureArray();
#endif
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void blit();
#endif
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
private:
TextureFormat rgbaFormatES2, depthStencilFormatES2;
#endif
@ -161,16 +173,22 @@ FramebufferGLTest::FramebufferGLTest() {
&FramebufferGLTest::constructMove,
&FramebufferGLTest::wrap,
#ifndef MAGNUM_TARGET_WEBGL
&FramebufferGLTest::label,
#endif
&FramebufferGLTest::attachRenderbuffer,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
&FramebufferGLTest::attachRenderbufferMultisample,
#endif
#ifndef MAGNUM_TARGET_GLES
&FramebufferGLTest::attachTexture1D,
#endif
&FramebufferGLTest::attachTexture2D,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
&FramebufferGLTest::attachTexture3D,
#endif
#ifndef MAGNUM_TARGET_GLES
&FramebufferGLTest::attachTexture1DArray,
#endif
@ -211,7 +229,9 @@ FramebufferGLTest::FramebufferGLTest() {
&FramebufferGLTest::clearStencil,
&FramebufferGLTest::clearDepthStencil,
#endif
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
&FramebufferGLTest::invalidate,
#endif
#ifndef MAGNUM_TARGET_GLES2
&FramebufferGLTest::invalidateSub,
#endif
@ -234,7 +254,9 @@ FramebufferGLTest::FramebufferGLTest() {
&FramebufferGLTest::copySubImageTexture1D,
#endif
&FramebufferGLTest::copySubImageTexture2D,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
&FramebufferGLTest::copySubImageTexture3D,
#endif
#ifndef MAGNUM_TARGET_GLES
&FramebufferGLTest::copySubImageTexture1DArray,
#endif
@ -248,9 +270,12 @@ FramebufferGLTest::FramebufferGLTest() {
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
&FramebufferGLTest::copySubImageCubeMapTextureArray,
#endif
&FramebufferGLTest::blit});
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
&FramebufferGLTest::blit
#endif
});
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
if(Context::current().isExtensionSupported<Extensions::GL::EXT::texture_storage>()) {
rgbaFormatES2 = TextureFormat::RGBA8;
depthStencilFormatES2 = TextureFormat::Depth24Stencil8;
@ -332,6 +357,7 @@ void FramebufferGLTest::wrap() {
glDeleteFramebuffers(1, &id);
}
#ifndef MAGNUM_TARGET_WEBGL
void FramebufferGLTest::label() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::framebuffer_object>())
@ -353,6 +379,7 @@ void FramebufferGLTest::label() {
CORRADE_COMPARE(framebuffer.label(), "MyFramebuffer");
}
#endif
void FramebufferGLTest::attachRenderbuffer() {
#ifndef MAGNUM_TARGET_GLES
@ -370,16 +397,22 @@ void FramebufferGLTest::attachRenderbuffer() {
/* Separate depth and stencil renderbuffers are not supported (or at least
on my NVidia, thus we need to do this juggling with one renderbuffer */
Renderbuffer depthStencil;
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
if(Context::current().isExtensionSupported<Extensions::GL::OES::packed_depth_stencil>())
#endif
{
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Debug() << "Using" << Extensions::GL::OES::packed_depth_stencil::string();
#endif
depthStencil.setStorage(RenderbufferFormat::Depth24Stencil8, Vector2i(128));
depthStencil.setStorage(
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
RenderbufferFormat::Depth24Stencil8,
#else
RenderbufferFormat::DepthStencil,
#endif
Vector2i(128));
}
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
else depthStencil.setStorage(RenderbufferFormat::DepthComponent16, Vector2i(128));
#endif
@ -387,7 +420,7 @@ void FramebufferGLTest::attachRenderbuffer() {
framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), color)
.attachRenderbuffer(Framebuffer::BufferAttachment::Depth, depthStencil);
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
if(Context::current().isExtensionSupported<Extensions::GL::OES::packed_depth_stencil>())
#endif
{
@ -399,6 +432,7 @@ void FramebufferGLTest::attachRenderbuffer() {
CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::Draw), Framebuffer::Status::Complete);
}
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void FramebufferGLTest::attachRenderbufferMultisample() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::framebuffer_object>())
@ -416,7 +450,7 @@ void FramebufferGLTest::attachRenderbufferMultisample() {
color.setStorageMultisample(Renderbuffer::maxSamples(), RenderbufferFormat::RGBA4, Vector2i(128));
#endif
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
MAGNUM_ASSERT_EXTENSION_SUPPORTED(Extensions::GL::OES::packed_depth_stencil);
#endif
@ -436,6 +470,7 @@ void FramebufferGLTest::attachRenderbufferMultisample() {
CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::Read), Framebuffer::Status::Complete);
CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::Draw), Framebuffer::Status::Complete);
}
#endif
#ifndef MAGNUM_TARGET_GLES
void FramebufferGLTest::attachTexture1D() {
@ -471,11 +506,15 @@ void FramebufferGLTest::attachTexture2D() {
MAGNUM_VERIFY_NO_ERROR();
Texture2D color;
#ifndef MAGNUM_TARGET_GLES2
color.setStorage(1, TextureFormat::RGBA8, Vector2i(128));
#else
color.setStorage(1, rgbaFormatES2, Vector2i(128));
#endif
color.setStorage(1,
#ifndef MAGNUM_TARGET_GLES2
TextureFormat::RGBA8,
#elif !defined(MAGNUM_TARGET_WEBGL)
rgbaFormatES2,
#else
TextureFormat::RGBA,
#endif
Vector2i(128));
MAGNUM_VERIFY_NO_ERROR();
@ -483,18 +522,24 @@ void FramebufferGLTest::attachTexture2D() {
MAGNUM_VERIFY_NO_ERROR();
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
if(Context::current().isExtensionSupported<Extensions::GL::OES::packed_depth_stencil>())
#endif
{
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Debug() << "Using" << Extensions::GL::OES::packed_depth_stencil::string();
#endif
/** @todo Is there any better way to select proper sized/unsized format on ES2? */
Texture2D depthStencil;
#ifndef MAGNUM_TARGET_GLES2
depthStencil.setStorage(1, TextureFormat::Depth24Stencil8, Vector2i(128));
#if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL)
depthStencil.setStorage(1,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
TextureFormat::Depth24Stencil8,
#else
TextureFormat::DepthStencil,
#endif
Vector2i(128));
framebuffer.attachTexture(Framebuffer::BufferAttachment::DepthStencil, depthStencil, 0);
#else
depthStencil.setStorage(1, depthStencilFormatES2, Vector2i(128));
@ -503,7 +548,7 @@ void FramebufferGLTest::attachTexture2D() {
#endif
}
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
else if(Context::current().isExtensionSupported<Extensions::GL::OES::depth_texture>()) {
Debug() << "Using" << Extensions::GL::OES::depth_texture::string();
@ -518,6 +563,7 @@ void FramebufferGLTest::attachTexture2D() {
CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::Draw), Framebuffer::Status::Complete);
}
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void FramebufferGLTest::attachTexture3D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::framebuffer_object>())
@ -528,11 +574,13 @@ void FramebufferGLTest::attachTexture3D() {
#endif
Texture3D color;
#ifndef MAGNUM_TARGET_GLES2
color.setStorage(1, TextureFormat::RGBA8, Vector3i(128));
#else
color.setStorage(1, rgbaFormatES2, Vector3i(128));
#endif
color.setStorage(1,
#ifndef MAGNUM_TARGET_GLES2
TextureFormat::RGBA8,
#else
rgbaFormatES2,
#endif
Vector3i(128));
Framebuffer framebuffer({{}, Vector2i(128)});
framebuffer.attachTextureLayer(Framebuffer::ColorAttachment(0), color, 0, 0);
@ -541,6 +589,7 @@ void FramebufferGLTest::attachTexture3D() {
CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::Read), Framebuffer::Status::Complete);
CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::Draw), Framebuffer::Status::Complete);
}
#endif
#ifndef MAGNUM_TARGET_GLES
void FramebufferGLTest::attachTexture1DArray() {
@ -686,25 +735,35 @@ void FramebufferGLTest::attachCubeMapTexture() {
Framebuffer framebuffer({{}, Vector2i(128)});
CubeMapTexture color;
#ifndef MAGNUM_TARGET_GLES2
color.setStorage(1, TextureFormat::RGBA8, Vector2i(128));
#else
color.setStorage(1, rgbaFormatES2, Vector2i(128));
#endif
color.setStorage(1,
#ifndef MAGNUM_TARGET_GLES2
TextureFormat::RGBA8,
#elif !defined(MAGNUM_TARGET_WEBGL)
rgbaFormatES2,
#else
TextureFormat::RGBA,
#endif
Vector2i(128));
framebuffer.attachCubeMapTexture(Framebuffer::ColorAttachment(0), color, CubeMapCoordinate::NegativeZ, 0);
CubeMapTexture depthStencil;
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
if(Context::current().isExtensionSupported<Extensions::GL::OES::packed_depth_stencil>())
#endif
{
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Debug() << "Using" << Extensions::GL::OES::packed_depth_stencil::string();
#endif
#ifndef MAGNUM_TARGET_GLES2
depthStencil.setStorage(1, TextureFormat::Depth24Stencil8, Vector2i(128));
#if !defined(MAGNUM_TARGET_GLES2) || defined(MAGNUM_TARGET_WEBGL)
depthStencil.setStorage(1,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
TextureFormat::Depth24Stencil8,
#else
TextureFormat::DepthStencil,
#endif
Vector2i(128));
framebuffer.attachCubeMapTexture(Framebuffer::BufferAttachment::DepthStencil, depthStencil, CubeMapCoordinate::NegativeZ, 0);
#else
depthStencil.setStorage(1, depthStencilFormatES2, Vector2i(128));
@ -713,7 +772,7 @@ void FramebufferGLTest::attachCubeMapTexture() {
#endif
}
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
else if(Context::current().isExtensionSupported<Extensions::GL::OES::depth_texture>()) {
Debug() << "Using" << Extensions::GL::OES::depth_texture::string();
@ -937,24 +996,37 @@ void FramebufferGLTest::multipleColorOutputs() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::framebuffer_object>())
CORRADE_SKIP(Extensions::GL::ARB::framebuffer_object::string() + std::string(" is not available."));
#elif defined(MAGNUM_TARGET_GLES2)
#ifdef MAGNUM_TARGET_WEBGL
if(!Context::current().isExtensionSupported<Extensions::GL::WEBGL::draw_buffers>())
CORRADE_SKIP(Extensions::GL::WEBGL::draw_buffers::string() + std::string(" is not available."));
#else
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::draw_buffers>() &&
!Context::current().isExtensionSupported<Extensions::GL::NV::draw_buffers>())
CORRADE_SKIP("No required extension available.");
#endif
#endif
Texture2D color1;
#ifndef MAGNUM_TARGET_GLES2
color1.setStorage(1, TextureFormat::RGBA8, Vector2i(128));
#else
color1.setStorage(1, rgbaFormatES2, Vector2i(128));
#endif
color1.setStorage(1,
#ifndef MAGNUM_TARGET_GLES2
TextureFormat::RGBA8,
#elif !defined(MAGNUM_TARGET_WEBGL)
rgbaFormatES2,
#else
TextureFormat::RGBA,
#endif
Vector2i(128));
Texture2D color2;
#ifndef MAGNUM_TARGET_GLES2
color2.setStorage(1, TextureFormat::RGBA8, Vector2i(128));
#else
color2.setStorage(1, rgbaFormatES2, Vector2i(128));
#endif
color2.setStorage(1,
#ifndef MAGNUM_TARGET_GLES2
TextureFormat::RGBA8,
#elif !defined(MAGNUM_TARGET_WEBGL)
rgbaFormatES2,
#else
TextureFormat::RGBA,
#endif
Vector2i(128));
Renderbuffer depth;
depth.setStorage(RenderbufferFormat::DepthComponent16, Vector2i(128));
@ -967,6 +1039,7 @@ void FramebufferGLTest::multipleColorOutputs() {
{1, Framebuffer::ColorAttachment(0)},
{2, Framebuffer::DrawAttachment::None}});
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
#ifdef MAGNUM_TARGET_GLES2
if(Context::current().isExtensionSupported<Extensions::GL::NV::read_buffer>())
#endif
@ -976,6 +1049,7 @@ void FramebufferGLTest::multipleColorOutputs() {
#endif
framebuffer.mapForRead(Framebuffer::ColorAttachment(1));
}
#endif
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::Read), Framebuffer::Status::Complete);
@ -998,16 +1072,22 @@ void FramebufferGLTest::clear() {
/* Separate depth and stencil renderbuffers are not supported (or at least
on my NVidia, thus we need to do this juggling with one renderbuffer */
Renderbuffer depthStencil;
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
if(Context::current().isExtensionSupported<Extensions::GL::OES::packed_depth_stencil>())
#endif
{
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Debug() << "Using" << Extensions::GL::OES::packed_depth_stencil::string();
#endif
depthStencil.setStorage(RenderbufferFormat::Depth24Stencil8, Vector2i(128));
depthStencil.setStorage(
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
RenderbufferFormat::Depth24Stencil8,
#else
RenderbufferFormat::DepthStencil,
#endif
Vector2i(128));
}
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
else depthStencil.setStorage(RenderbufferFormat::DepthComponent16, Vector2i(128));
#endif
@ -1015,7 +1095,7 @@ void FramebufferGLTest::clear() {
framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), color)
.attachRenderbuffer(Framebuffer::BufferAttachment::Depth, depthStencil);
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
if(Context::current().isExtensionSupported<Extensions::GL::OES::packed_depth_stencil>())
#endif
{
@ -1234,6 +1314,7 @@ void FramebufferGLTest::clearDepthStencil() {
}
#endif
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void FramebufferGLTest::invalidate() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::framebuffer_object>())
@ -1260,6 +1341,7 @@ void FramebufferGLTest::invalidate() {
MAGNUM_VERIFY_NO_ERROR();
}
#endif
#ifndef MAGNUM_TARGET_GLES2
void FramebufferGLTest::invalidateSub() {
@ -1310,16 +1392,22 @@ void FramebufferGLTest::read() {
/* Separate depth and stencil renderbuffers are not supported (or at least
on my NVidia, thus we need to do this juggling with one renderbuffer */
Renderbuffer depthStencil;
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
if(Context::current().isExtensionSupported<Extensions::GL::OES::packed_depth_stencil>())
#endif
{
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
Debug() << "Using" << Extensions::GL::OES::packed_depth_stencil::string();
#endif
depthStencil.setStorage(RenderbufferFormat::Depth24Stencil8, Vector2i(128));
depthStencil.setStorage(
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
RenderbufferFormat::Depth24Stencil8,
#else
RenderbufferFormat::DepthStencil,
#endif
Vector2i(128));
}
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
else depthStencil.setStorage(RenderbufferFormat::DepthComponent16, Vector2i(128));
#endif
@ -1327,7 +1415,7 @@ void FramebufferGLTest::read() {
framebuffer.attachRenderbuffer(Framebuffer::ColorAttachment(0), color)
.attachRenderbuffer(Framebuffer::BufferAttachment::Depth, depthStencil);
#ifdef MAGNUM_TARGET_GLES2
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
if(Context::current().isExtensionSupported<Extensions::GL::OES::packed_depth_stencil>())
#endif
{
@ -1351,6 +1439,7 @@ void FramebufferGLTest::read() {
CORRADE_COMPARE(colorImage.data().size(), (DataOffset + 8*16)*sizeof(Color4ub));
CORRADE_COMPARE(colorImage.data<Color4ub>()[DataOffset], Color4ub(128, 64, 32, 17));
#ifndef MAGNUM_TARGET_WEBGL
#ifdef MAGNUM_TARGET_GLES
if(Context::current().isExtensionSupported<Extensions::GL::NV::read_depth>())
#endif
@ -1394,6 +1483,7 @@ void FramebufferGLTest::read() {
CORRADE_COMPARE(depthStencilImage.data<UnsignedInt>()[0] >> 8, 12378300);
CORRADE_COMPARE(depthStencilImage.data<UnsignedByte>()[0], 67);
}
#endif
}
#ifndef MAGNUM_TARGET_GLES2
@ -1481,8 +1571,10 @@ void FramebufferGLTest::copyImageTexture2D() {
storage.setStorage(1,
#ifndef MAGNUM_TARGET_GLES2
TextureFormat::RGBA8,
#else
#elif !defined(MAGNUM_TARGET_WEBGL)
rgbaFormatES2,
#else
TextureFormat::RGBA,
#endif
Vector2i{4})
.setSubImage(0, {}, ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{4}, StorageData});
@ -1494,8 +1586,10 @@ void FramebufferGLTest::copyImageTexture2D() {
fb.copyImage(Range2Di::fromSize(Vector2i{1}, Vector2i{2}), texture, 0,
#ifndef MAGNUM_TARGET_GLES2
TextureFormat::RGBA8
#else
#elif !defined(MAGNUM_TARGET_WEBGL)
rgbaFormatES2
#else
TextureFormat::RGBA
#endif
);
@ -1575,8 +1669,10 @@ void FramebufferGLTest::copyImageCubeMapTexture() {
storage.setStorage(1,
#ifndef MAGNUM_TARGET_GLES2
TextureFormat::RGBA8,
#else
#elif !defined(MAGNUM_TARGET_WEBGL)
rgbaFormatES2,
#else
TextureFormat::RGBA,
#endif
Vector2i{4})
.setSubImage(0, {}, ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{4}, StorageData});
@ -1588,8 +1684,10 @@ void FramebufferGLTest::copyImageCubeMapTexture() {
fb.copyImage(Range2Di::fromSize(Vector2i{1}, Vector2i{2}), texture, CubeMapCoordinate::PositiveX, 0,
#ifndef MAGNUM_TARGET_GLES2
TextureFormat::RGBA8
#else
#elif !defined(MAGNUM_TARGET_WEBGL)
rgbaFormatES2
#else
TextureFormat::RGBA
#endif
);
@ -1641,8 +1739,10 @@ void FramebufferGLTest::copySubImageTexture2D() {
storage.setStorage(1,
#ifndef MAGNUM_TARGET_GLES2
TextureFormat::RGBA8,
#else
#elif !defined(MAGNUM_TARGET_WEBGL)
rgbaFormatES2,
#else
TextureFormat::RGBA,
#endif
Vector2i{4})
.setSubImage(0, {}, ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{4}, StorageData});
@ -1654,8 +1754,10 @@ void FramebufferGLTest::copySubImageTexture2D() {
texture.setStorage(1,
#ifndef MAGNUM_TARGET_GLES2
TextureFormat::RGBA8,
#else
#elif !defined(MAGNUM_TARGET_WEBGL)
rgbaFormatES2,
#else
TextureFormat::RGBA,
#endif
Vector2i{4})
.setSubImage(0, {}, ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{4}, ZeroStorage});
@ -1839,8 +1941,10 @@ void FramebufferGLTest::copySubImageCubeMapTexture() {
storage.setStorage(1,
#ifndef MAGNUM_TARGET_GLES2
TextureFormat::RGBA8,
#else
#elif !defined(MAGNUM_TARGET_WEBGL)
rgbaFormatES2,
#else
TextureFormat::RGBA,
#endif
Vector2i{4})
.setSubImage(0, {}, ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{4}, StorageData});
@ -1852,8 +1956,10 @@ void FramebufferGLTest::copySubImageCubeMapTexture() {
texture.setStorage(1,
#ifndef MAGNUM_TARGET_GLES2
TextureFormat::RGBA8,
#else
#elif !defined(MAGNUM_TARGET_WEBGL)
rgbaFormatES2,
#else
TextureFormat::RGBA,
#endif
Vector2i{4})
.setSubImage(CubeMapCoordinate::NegativeY, 0, {}, ImageView2D{PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i{4}, ZeroStorage});
@ -1935,6 +2041,7 @@ void FramebufferGLTest::copySubImageCubeMapTextureArray() {
}
#endif
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void FramebufferGLTest::blit() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::framebuffer_object>())
@ -1983,6 +2090,7 @@ void FramebufferGLTest::blit() {
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(imageAfter.data<Color4ub>()[0], Color4ub(128, 64, 32, 17));
}
#endif
}}

49
src/Magnum/Test/MeshGLTest.cpp

@ -43,7 +43,7 @@
namespace Magnum { namespace Test {
/* Tests also MeshView class. */
/* Tests also the MeshView class. */
struct MeshGLTest: OpenGLTester {
explicit MeshGLTest();
@ -53,7 +53,9 @@ struct MeshGLTest: OpenGLTester {
void constructMove();
void wrap();
#ifndef MAGNUM_TARGET_WEBGL
void label();
#endif
#ifndef MAGNUM_TARGET_GLES2
void addVertexBufferUnsignedInt();
@ -88,8 +90,10 @@ struct MeshGLTest: OpenGLTester {
void addVertexBufferIntWithUnsignedShort();
void addVertexBufferIntWithShort();
#endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/* Other Float types omitted (covered by addVertexBufferNormalized()) */
void addVertexBufferFloatWithHalfFloat();
#endif
#ifndef MAGNUM_TARGET_GLES
void addVertexBufferFloatWithDouble();
void addVertexBufferVector3WithUnsignedInt10f11f11fRev();
@ -148,7 +152,10 @@ MeshGLTest::MeshGLTest() {
&MeshGLTest::constructMove,
&MeshGLTest::wrap,
&MeshGLTest::label});
#ifndef MAGNUM_TARGET_WEBGL
&MeshGLTest::label
#endif
});
/* First instance is always using Attribute, second DynamicAttribute */
addInstancedTests({
@ -185,7 +192,9 @@ MeshGLTest::MeshGLTest() {
&MeshGLTest::addVertexBufferIntWithUnsignedShort,
&MeshGLTest::addVertexBufferIntWithShort,
#endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
&MeshGLTest::addVertexBufferFloatWithHalfFloat,
#endif
#ifndef MAGNUM_TARGET_GLES
&MeshGLTest::addVertexBufferFloatWithDouble,
&MeshGLTest::addVertexBufferVector3WithUnsignedInt10f11f11fRev,
@ -215,8 +224,10 @@ MeshGLTest::MeshGLTest() {
#ifndef MAGNUM_TARGET_GLES
&MeshGLTest::setBaseVertex,
#endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
&MeshGLTest::setInstanceCount,
&MeshGLTest::setInstanceCountIndexed,
#endif
#ifndef MAGNUM_TARGET_GLES
&MeshGLTest::setInstanceCountBaseInstance,
&MeshGLTest::setInstanceCountBaseInstanceIndexed,
@ -224,7 +235,9 @@ MeshGLTest::MeshGLTest() {
&MeshGLTest::setInstanceCountBaseVertexBaseInstance,
#endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
&MeshGLTest::addVertexBufferInstancedFloat,
#endif
#ifndef MAGNUM_TARGET_GLES2
&MeshGLTest::addVertexBufferInstancedInteger,
#endif
@ -334,6 +347,7 @@ void MeshGLTest::wrap() {
#endif
}
#ifndef MAGNUM_TARGET_WEBGL
void MeshGLTest::label() {
/* No-Op version is tested in AbstractObjectGLTest */
if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>() &&
@ -350,6 +364,7 @@ void MeshGLTest::label() {
CORRADE_COMPARE(mesh.label(), "MyMesh");
}
#endif
namespace {
struct FloatShader: AbstractShaderProgram {
@ -849,7 +864,12 @@ void MeshGLTest::addVertexBufferMatrixNxN() {
const auto value = Checker(FloatShader("mat3",
"vec4(valueInterpolated[0][0], valueInterpolated[1][1], valueInterpolated[2][2], 0.0)"),
RenderbufferFormat::RGBA8, mesh).get<Color3ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
#ifndef MAGNUM_TARGET_GLES2
RenderbufferFormat::RGBA8,
#else
RenderbufferFormat::RGBA4,
#endif
mesh).get<Color3ub>(PixelFormat::RGBA, PixelType::UnsignedByte);
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(value, Color3ub(96, 24, 156));
@ -1142,6 +1162,7 @@ void MeshGLTest::addVertexBufferIntWithShort() {
}
#endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void MeshGLTest::addVertexBufferFloatWithHalfFloat() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::half_float_vertex>())
@ -1179,6 +1200,7 @@ void MeshGLTest::addVertexBufferFloatWithHalfFloat() {
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(value, 186);
}
#endif
#ifndef MAGNUM_TARGET_GLES
void MeshGLTest::addVertexBufferFloatWithDouble() {
@ -1827,10 +1849,15 @@ void MeshGLTest::setInstanceCount() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::draw_instanced>())
CORRADE_SKIP(Extensions::GL::ARB::draw_instanced::string() + std::string(" is not available."));
#elif defined(MAGNUM_TARGET_GLES2)
#ifndef MAGNUM_TARGET_WEBGL
if(!Context::current().isExtensionSupported<Extensions::GL::ANGLE::instanced_arrays>() &&
!Context::current().isExtensionSupported<Extensions::GL::EXT::draw_instanced>() &&
!Context::current().isExtensionSupported<Extensions::GL::NV::draw_instanced>())
CORRADE_SKIP("Required extension is not available.");
#else
if(!Context::current().isExtensionSupported<Extensions::GL::ANGLE::instanced_arrays>())
CORRADE_SKIP(Extensions::GL::ANGLE::instanced_arrays::string() + std::string(" is not available."));
#endif
#endif
typedef Attribute<0, Float> Attribute;
@ -1868,10 +1895,15 @@ void MeshGLTest::setInstanceCountIndexed() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::draw_instanced>())
CORRADE_SKIP(Extensions::GL::ARB::draw_instanced::string() + std::string(" is not available."));
#elif defined(MAGNUM_TARGET_GLES2)
#ifndef MAGNUM_TARGET_WEBGL
if(!Context::current().isExtensionSupported<Extensions::GL::ANGLE::instanced_arrays>() &&
!Context::current().isExtensionSupported<Extensions::GL::EXT::draw_instanced>() &&
!Context::current().isExtensionSupported<Extensions::GL::NV::draw_instanced>())
CORRADE_SKIP("Required extension is not available.");
#else
if(!Context::current().isExtensionSupported<Extensions::GL::ANGLE::instanced_arrays>())
CORRADE_SKIP(Extensions::GL::ANGLE::instanced_arrays::string() + std::string(" is not available."));
#endif
#endif
Buffer vertices;
@ -2041,6 +2073,7 @@ void MeshGLTest::setInstanceCountBaseVertexBaseInstance() {
}
#endif
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
void MeshGLTest::addVertexBufferInstancedFloat() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::draw_instanced>())
@ -2048,6 +2081,7 @@ void MeshGLTest::addVertexBufferInstancedFloat() {
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::instanced_arrays>())
CORRADE_SKIP(Extensions::GL::ARB::instanced_arrays::string() + std::string(" is not available."));
#elif defined(MAGNUM_TARGET_GLES2)
#ifndef MAGNUM_TARGET_WEBGL
if(!Context::current().isExtensionSupported<Extensions::GL::ANGLE::instanced_arrays>() &&
!Context::current().isExtensionSupported<Extensions::GL::EXT::instanced_arrays>() &&
!Context::current().isExtensionSupported<Extensions::GL::NV::instanced_arrays>())
@ -2056,6 +2090,10 @@ void MeshGLTest::addVertexBufferInstancedFloat() {
!Context::current().isExtensionSupported<Extensions::GL::EXT::draw_instanced>() &&
!Context::current().isExtensionSupported<Extensions::GL::NV::draw_instanced>())
CORRADE_SKIP("Required drawing extension is not available.");
#else
if(!Context::current().isExtensionSupported<Extensions::GL::ANGLE::instanced_arrays>())
CORRADE_SKIP(Extensions::GL::ANGLE::instanced_arrays::string() + std::string(" is not available."));
#endif
#endif
typedef Attribute<0, Float> Attribute;
@ -2087,6 +2125,7 @@ void MeshGLTest::addVertexBufferInstancedFloat() {
MAGNUM_VERIFY_NO_ERROR();
CORRADE_COMPARE(value, 96);
}
#endif
#ifndef MAGNUM_TARGET_GLES2
void MeshGLTest::addVertexBufferInstancedInteger() {
@ -2211,7 +2250,7 @@ template<class T> T MultiChecker::get(PixelFormat format, PixelType type) {
#endif
void MeshGLTest::multiDraw() {
#ifdef MAGNUM_TARGET_GLES
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::multi_draw_arrays>())
Debug() << Extensions::GL::EXT::multi_draw_arrays::string() << "not supported, using fallback implementation";
#endif
@ -2235,7 +2274,7 @@ void MeshGLTest::multiDraw() {
}
void MeshGLTest::multiDrawIndexed() {
#ifdef MAGNUM_TARGET_GLES
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::multi_draw_arrays>())
Debug() << Extensions::GL::EXT::multi_draw_arrays::string() << "not supported, using fallback implementation";
#endif

16
src/Magnum/Test/RenderbufferGLTest.cpp

@ -40,10 +40,14 @@ struct RenderbufferGLTest: OpenGLTester {
void constructMove();
void wrap();
#ifndef MAGNUM_TARGET_WEBGL
void label();
#endif
void setStorage();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void setStorageMultisample();
#endif
};
RenderbufferGLTest::RenderbufferGLTest() {
@ -52,10 +56,16 @@ RenderbufferGLTest::RenderbufferGLTest() {
&RenderbufferGLTest::constructMove,
&RenderbufferGLTest::wrap,
#ifndef MAGNUM_TARGET_WEBGL
&RenderbufferGLTest::label,
#endif
&RenderbufferGLTest::setStorage,
&RenderbufferGLTest::setStorageMultisample});
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
&RenderbufferGLTest::setStorageMultisample
#endif
});
}
void RenderbufferGLTest::construct() {
@ -126,6 +136,7 @@ void RenderbufferGLTest::wrap() {
glDeleteRenderbuffers(1, &id);
}
#ifndef MAGNUM_TARGET_WEBGL
void RenderbufferGLTest::label() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::framebuffer_object>())
@ -145,6 +156,7 @@ void RenderbufferGLTest::label() {
CORRADE_COMPARE(renderbuffer.label(), "MyRenderbuffer");
}
#endif
void RenderbufferGLTest::setStorage() {
#ifndef MAGNUM_TARGET_GLES
@ -163,6 +175,7 @@ void RenderbufferGLTest::setStorage() {
MAGNUM_VERIFY_NO_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>())
@ -183,6 +196,7 @@ void RenderbufferGLTest::setStorageMultisample() {
MAGNUM_VERIFY_NO_ERROR();
}
#endif
}}

6
src/Magnum/Test/ShaderGLTest.cpp

@ -42,7 +42,9 @@ struct ShaderGLTest: OpenGLTester {
void constructCopy();
void constructMove();
#ifndef MAGNUM_TARGET_WEBGL
void label();
#endif
void addSource();
void addSourceNoVersion();
@ -58,7 +60,9 @@ ShaderGLTest::ShaderGLTest() {
&ShaderGLTest::constructCopy,
&ShaderGLTest::constructMove,
#ifndef MAGNUM_TARGET_WEBGL
&ShaderGLTest::label,
#endif
&ShaderGLTest::addSource,
&ShaderGLTest::addSourceNoVersion,
@ -141,6 +145,7 @@ void ShaderGLTest::constructMove() {
#endif
}
#ifndef MAGNUM_TARGET_WEBGL
void ShaderGLTest::label() {
/* No-Op version is tested in AbstractObjectGLTest */
if(!Context::current().isExtensionSupported<Extensions::GL::KHR::debug>() &&
@ -159,6 +164,7 @@ void ShaderGLTest::label() {
MAGNUM_VERIFY_NO_ERROR();
}
#endif
void ShaderGLTest::addSource() {
#ifndef MAGNUM_TARGET_GLES

152
src/Magnum/Test/TextureGLTest.cpp

@ -50,19 +50,25 @@ struct TextureGLTest: OpenGLTester {
void construct1D();
#endif
void construct2D();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void construct3D();
#endif
#ifndef MAGNUM_TARGET_GLES
void wrap1D();
#endif
void wrap2D();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void wrap3D();
#endif
#ifndef MAGNUM_TARGET_GLES
void bind1D();
#endif
void bind2D();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void bind3D();
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#ifndef MAGNUM_TARGET_GLES
@ -76,13 +82,17 @@ struct TextureGLTest: OpenGLTester {
void sampling1D();
#endif
void sampling2D();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void sampling3D();
#endif
#ifndef MAGNUM_TARGET_WEBGL
#ifndef MAGNUM_TARGET_GLES
void samplingSRGBDecode1D();
#endif
void samplingSRGBDecode2D();
void samplingSRGBDecode3D();
#endif
#ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES
@ -90,7 +100,7 @@ struct TextureGLTest: OpenGLTester {
#endif
void samplingSwizzle2D();
void samplingSwizzle3D();
#else
#elif !defined(MAGNUM_TARGET_WEBGL)
void samplingMaxLevel2D();
void samplingMaxLevel3D();
void samplingCompare2D();
@ -110,7 +120,7 @@ struct TextureGLTest: OpenGLTester {
void samplingDepthStencilMode2D();
void samplingDepthStencilMode3D();
#endif
#ifdef MAGNUM_TARGET_GLES
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
void samplingBorder2D();
void samplingBorder3D();
#endif
@ -119,7 +129,9 @@ struct TextureGLTest: OpenGLTester {
void storage1D();
#endif
void storage2D();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void storage3D();
#endif
#ifndef MAGNUM_TARGET_GLES
void image1D();
@ -163,6 +175,7 @@ struct TextureGLTest: OpenGLTester {
void compressedSubImage2DQueryBuffer();
#endif
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void image3D();
#ifndef MAGNUM_TARGET_GLES2
void image3DBuffer();
@ -188,24 +201,31 @@ struct TextureGLTest: OpenGLTester {
void compressedSubImage3DQuery();
void compressedSubImage3DQueryBuffer();
#endif
#endif
#ifndef MAGNUM_TARGET_GLES
void generateMipmap1D();
#endif
void generateMipmap2D();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void generateMipmap3D();
#endif
#ifndef MAGNUM_TARGET_GLES
void invalidateImage1D();
#endif
void invalidateImage2D();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void invalidateImage3D();
#endif
#ifndef MAGNUM_TARGET_GLES
void invalidateSubImage1D();
#endif
void invalidateSubImage2D();
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void invalidateSubImage3D();
#endif
void srgbStorage();
void srgbAlphaStorage();
@ -403,19 +423,25 @@ TextureGLTest::TextureGLTest() {
&TextureGLTest::construct1D,
#endif
&TextureGLTest::construct2D,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
&TextureGLTest::construct3D,
#endif
#ifndef MAGNUM_TARGET_GLES
&TextureGLTest::wrap1D,
#endif
&TextureGLTest::wrap2D,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
&TextureGLTest::wrap3D,
#endif
#ifndef MAGNUM_TARGET_GLES
&TextureGLTest::bind1D,
#endif
&TextureGLTest::bind2D,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
&TextureGLTest::bind3D,
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#ifndef MAGNUM_TARGET_GLES
@ -429,13 +455,17 @@ TextureGLTest::TextureGLTest() {
&TextureGLTest::sampling1D,
#endif
&TextureGLTest::sampling2D,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
&TextureGLTest::sampling3D,
#endif
#ifndef MAGNUM_TARGET_WEBGL
#ifndef MAGNUM_TARGET_GLES
&TextureGLTest::samplingSRGBDecode1D,
#endif
&TextureGLTest::samplingSRGBDecode2D,
&TextureGLTest::samplingSRGBDecode3D,
#endif
#ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES
@ -443,7 +473,7 @@ TextureGLTest::TextureGLTest() {
#endif
&TextureGLTest::samplingSwizzle2D,
&TextureGLTest::samplingSwizzle3D,
#else
#elif !defined(MAGNUM_TARGET_WEBGL)
&TextureGLTest::samplingMaxLevel2D,
&TextureGLTest::samplingMaxLevel3D,
&TextureGLTest::samplingCompare2D,
@ -463,7 +493,7 @@ TextureGLTest::TextureGLTest() {
&TextureGLTest::samplingDepthStencilMode2D,
&TextureGLTest::samplingDepthStencilMode3D,
#endif
#ifdef MAGNUM_TARGET_GLES
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
&TextureGLTest::samplingBorder2D,
&TextureGLTest::samplingBorder3D,
#endif
@ -472,7 +502,10 @@ TextureGLTest::TextureGLTest() {
&TextureGLTest::storage1D,
#endif
&TextureGLTest::storage2D,
&TextureGLTest::storage3D});
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
&TextureGLTest::storage3D
#endif
});
#ifndef MAGNUM_TARGET_GLES
addInstancedTests({
@ -522,6 +555,7 @@ TextureGLTest::TextureGLTest() {
#endif
}, CompressedPixelStorage2DDataCount);
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
addInstancedTests({
&TextureGLTest::image3D,
#ifndef MAGNUM_TARGET_GLES2
@ -551,25 +585,32 @@ TextureGLTest::TextureGLTest() {
&TextureGLTest::compressedSubImage3DQueryBuffer
#endif
}, CompressedPixelStorage3DDataCount);
#endif
addTests({
#ifndef MAGNUM_TARGET_GLES
&TextureGLTest::generateMipmap1D,
#endif
&TextureGLTest::generateMipmap2D,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
&TextureGLTest::generateMipmap3D,
#endif
#ifndef MAGNUM_TARGET_GLES
&TextureGLTest::invalidateImage1D,
#endif
&TextureGLTest::invalidateImage2D,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
&TextureGLTest::invalidateImage3D,
#endif
#ifndef MAGNUM_TARGET_GLES
&TextureGLTest::invalidateSubImage1D,
#endif
&TextureGLTest::invalidateSubImage2D,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
&TextureGLTest::invalidateSubImage3D,
#endif
&TextureGLTest::srgbStorage,
&TextureGLTest::srgbAlphaStorage});
@ -599,6 +640,7 @@ void TextureGLTest::construct2D() {
MAGNUM_VERIFY_NO_ERROR();
}
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void TextureGLTest::construct3D() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_3D>())
@ -614,6 +656,7 @@ void TextureGLTest::construct3D() {
MAGNUM_VERIFY_NO_ERROR();
}
#endif
#ifndef MAGNUM_TARGET_GLES
void TextureGLTest::wrap1D() {
@ -647,6 +690,7 @@ void TextureGLTest::wrap2D() {
glDeleteTextures(1, &id);
}
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void TextureGLTest::wrap3D() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_3D>())
@ -666,6 +710,7 @@ void TextureGLTest::wrap3D() {
Texture3D::wrap(id);
glDeleteTextures(1, &id);
}
#endif
#ifndef MAGNUM_TARGET_GLES
void TextureGLTest::bind1D() {
@ -707,6 +752,7 @@ void TextureGLTest::bind2D() {
MAGNUM_VERIFY_NO_ERROR();
}
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void TextureGLTest::bind3D() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_3D>())
@ -730,6 +776,7 @@ void TextureGLTest::bind3D() {
MAGNUM_VERIFY_NO_ERROR();
}
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#ifndef MAGNUM_TARGET_GLES
@ -905,12 +952,16 @@ void TextureGLTest::sampling2D() {
.setWrapping(Sampler::Wrapping::ClampToEdge)
#endif
.setMaxAnisotropy(Sampler::maxMaxAnisotropy())
#ifndef MAGNUM_TARGET_GLES2
.setCompareMode(Sampler::CompareMode::CompareRefToTexture)
.setCompareFunction(Sampler::CompareFunction::GreaterOrEqual);
.setCompareFunction(Sampler::CompareFunction::GreaterOrEqual)
#endif
;
MAGNUM_VERIFY_NO_ERROR();
}
#ifndef MAGNUM_TARGET_WEBGL
void TextureGLTest::samplingSRGBDecode2D() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::sRGB>())
@ -924,6 +975,7 @@ void TextureGLTest::samplingSRGBDecode2D() {
MAGNUM_VERIFY_NO_ERROR();
}
#endif
#ifndef MAGNUM_TARGET_GLES2
void TextureGLTest::samplingSwizzle2D() {
@ -937,7 +989,7 @@ void TextureGLTest::samplingSwizzle2D() {
MAGNUM_VERIFY_NO_ERROR();
}
#else
#elif !defined(MAGNUM_TARGET_WEBGL)
void TextureGLTest::samplingMaxLevel2D() {
if(!Context::current().isExtensionSupported<Extensions::GL::APPLE::texture_max_level>())
CORRADE_SKIP(Extensions::GL::APPLE::texture_max_level::string() + std::string(" is not supported."));
@ -998,7 +1050,7 @@ void TextureGLTest::samplingDepthStencilMode2D() {
}
#endif
#ifdef MAGNUM_TARGET_GLES
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
void TextureGLTest::samplingBorder2D() {
if(!Context::current().isExtensionSupported<Extensions::GL::NV::texture_border_clamp>() &&
!Context::current().isExtensionSupported<Extensions::GL::EXT::texture_border_clamp>())
@ -1012,6 +1064,7 @@ void TextureGLTest::samplingBorder2D() {
}
#endif
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void TextureGLTest::sampling3D() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_3D>())
@ -1139,6 +1192,7 @@ void TextureGLTest::samplingBorder3D() {
MAGNUM_VERIFY_NO_ERROR();
}
#endif
#endif
#ifndef MAGNUM_TARGET_GLES
void TextureGLTest::storage1D() {
@ -1160,7 +1214,13 @@ void TextureGLTest::storage1D() {
void TextureGLTest::storage2D() {
Texture2D texture;
texture.setStorage(5, TextureFormat::RGBA8, Vector2i(32));
texture.setStorage(5,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
TextureFormat::RGBA8,
#else
TextureFormat::RGBA,
#endif
Vector2i(32));
MAGNUM_VERIFY_NO_ERROR();
@ -1181,6 +1241,7 @@ void TextureGLTest::storage2D() {
#endif
}
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void TextureGLTest::storage3D() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_3D>())
@ -1208,6 +1269,7 @@ void TextureGLTest::storage3D() {
MAGNUM_VERIFY_NO_ERROR();
#endif
}
#endif
namespace {
@ -1392,12 +1454,23 @@ void TextureGLTest::image2D() {
setTestCaseDescription(PixelStorage2DData[testCaseInstanceId()].name);
#ifdef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_WEBGL
if(PixelStorage2DData[testCaseInstanceId()].storage != PixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::EXT::unpack_subimage>())
CORRADE_SKIP(Extensions::GL::EXT::unpack_subimage::string() + std::string(" is not supported."));
#else
if(PixelStorage2DData[testCaseInstanceId()].storage != PixelStorage{})
CORRADE_SKIP("Image unpack is not supported in WebGL 1.");
#endif
#endif
Texture2D texture;
texture.setImage(0, TextureFormat::RGBA8, ImageView2D{
texture.setImage(0,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
TextureFormat::RGBA8,
#else
TextureFormat::RGBA,
#endif
ImageView2D{
PixelStorage2DData[testCaseInstanceId()].storage,
PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2),
PixelStorage2DData[testCaseInstanceId()].dataSparse});
@ -1465,12 +1538,22 @@ void TextureGLTest::subImage2D() {
setTestCaseDescription(PixelStorage2DData[testCaseInstanceId()].name);
#ifdef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_WEBGL
if(PixelStorage2DData[testCaseInstanceId()].storage != PixelStorage{} && !Context::current().isExtensionSupported<Extensions::GL::EXT::unpack_subimage>())
CORRADE_SKIP(Extensions::GL::EXT::unpack_subimage::string() + std::string(" is not supported."));
#else
if(PixelStorage2DData[testCaseInstanceId()].storage != PixelStorage{})
CORRADE_SKIP("Image unpack is not supported in WebGL 1.");
#endif
#endif
Texture2D texture;
texture.setImage(0, TextureFormat::RGBA8,
texture.setImage(0,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
TextureFormat::RGBA8,
#else
TextureFormat::RGBA,
#endif
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero2D));
texture.setSubImage(0, Vector2i(1), ImageView2D{PixelStorage2DData[testCaseInstanceId()].storage,
PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2),
@ -1813,6 +1896,7 @@ void TextureGLTest::compressedSubImage2DQueryBuffer() {
}
#endif
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void TextureGLTest::image3D() {
setTestCaseDescription(PixelStorage3DData[testCaseInstanceId()].name);
@ -2279,6 +2363,7 @@ void TextureGLTest::compressedSubImage3DQueryBuffer() {
}
}
#endif
#endif
#ifndef MAGNUM_TARGET_GLES
void TextureGLTest::generateMipmap1D() {
@ -2314,7 +2399,12 @@ void TextureGLTest::generateMipmap2D() {
#endif
Texture2D texture;
texture.setImage(0, TextureFormat::RGBA8,
texture.setImage(0,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
TextureFormat::RGBA8,
#else
TextureFormat::RGBA,
#endif
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32)));
/** @todo How to test this on ES? */
@ -2340,6 +2430,7 @@ void TextureGLTest::generateMipmap2D() {
#endif
}
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void TextureGLTest::generateMipmap3D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::GL::ARB::framebuffer_object>())
@ -2375,6 +2466,7 @@ void TextureGLTest::generateMipmap3D() {
MAGNUM_VERIFY_NO_ERROR();
#endif
}
#endif
#ifndef MAGNUM_TARGET_GLES
void TextureGLTest::invalidateImage1D() {
@ -2388,12 +2480,19 @@ void TextureGLTest::invalidateImage1D() {
void TextureGLTest::invalidateImage2D() {
Texture2D texture;
texture.setStorage(2, TextureFormat::RGBA8, Vector2i(32));
texture.setStorage(2,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
TextureFormat::RGBA8,
#else
TextureFormat::RGBA,
#endif
Vector2i(32));
texture.invalidateImage(1);
MAGNUM_VERIFY_NO_ERROR();
}
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void TextureGLTest::invalidateImage3D() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_3D>())
@ -2406,6 +2505,7 @@ void TextureGLTest::invalidateImage3D() {
MAGNUM_VERIFY_NO_ERROR();
}
#endif
#ifndef MAGNUM_TARGET_GLES
void TextureGLTest::invalidateSubImage1D() {
@ -2419,12 +2519,19 @@ void TextureGLTest::invalidateSubImage1D() {
void TextureGLTest::invalidateSubImage2D() {
Texture2D texture;
texture.setStorage(2, TextureFormat::RGBA8, Vector2i(32));
texture.setStorage(2,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
TextureFormat::RGBA8,
#else
TextureFormat::RGBA,
#endif
Vector2i(32));
texture.invalidateSubImage(1, Vector2i(2), Vector2i(8));
MAGNUM_VERIFY_NO_ERROR();
}
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
void TextureGLTest::invalidateSubImage3D() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::GL::OES::texture_3D>())
@ -2437,6 +2544,7 @@ void TextureGLTest::invalidateSubImage3D() {
MAGNUM_VERIFY_NO_ERROR();
}
#endif
void TextureGLTest::srgbStorage() {
#ifdef MAGNUM_TARGET_GLES2
@ -2461,7 +2569,13 @@ void TextureGLTest::srgbStorage() {
MAGNUM_VERIFY_NO_ERROR();
texture.setStorage(1, TextureFormat::SRGB8, Vector2i{32});
texture.setStorage(1,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
TextureFormat::SRGB8,
#else
TextureFormat::SRGB,
#endif
Vector2i{32});
MAGNUM_VERIFY_NO_ERROR();
}
@ -2489,7 +2603,13 @@ void TextureGLTest::srgbAlphaStorage() {
MAGNUM_VERIFY_NO_ERROR();
texture.setStorage(1, TextureFormat::SRGB8Alpha8, Vector2i{32});
texture.setStorage(1,
#if !(defined(MAGNUM_TARGET_GLES2) && defined(MAGNUM_TARGET_WEBGL))
TextureFormat::SRGB8Alpha8,
#else
TextureFormat::SRGBAlpha,
#endif
Vector2i{32});
MAGNUM_VERIFY_NO_ERROR();
}

2
src/Magnum/Test/configure.h.cmake

@ -23,4 +23,4 @@
DEALINGS IN THE SOFTWARE.
*/
#define SHADERGLTEST_FILES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ShaderGLTestFiles"
#define SHADERGLTEST_FILES_DIR "${SHADERGLTEST_FILES_DIR}"

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

@ -178,7 +178,8 @@ void RendererGLTest::renderData() {
void RendererGLTest::renderMesh() {
TestFont font;
Mesh mesh{NoCreate};
Buffer vertexBuffer, indexBuffer;
Buffer vertexBuffer{Buffer::TargetHint::Array},
indexBuffer{Buffer::TargetHint::ElementArray};
Range2D bounds;
std::tie(mesh, bounds) = Text::Renderer3D::render(font, nullGlyphCache,
0.25f, "abc", vertexBuffer, indexBuffer, BufferUsage::StaticDraw, Alignment::TopCenter);
@ -267,7 +268,7 @@ void RendererGLTest::mutableText() {
#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"));
#elif defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_EMSCRIPTEN)
#elif defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
if(!Context::current().isExtensionSupported<Extensions::GL::EXT::map_buffer_range>() &&
!Context::current().isExtensionSupported<Extensions::GL::OES::mapbuffer>())
CORRADE_SKIP("No required extension is supported");

Loading…
Cancel
Save