Browse Source

Make it possible to compile GL tests on WebGL 2 as well.

Not sure why this didn't work already. WebGL 1 works.
pull/299/head
Vladimír Vondruš 8 years ago
parent
commit
b08d81a9ee
  1. 2
      src/Magnum/DebugTools/Test/CMakeLists.txt
  2. 14
      src/Magnum/DebugTools/Test/TextureImageGLTest.cpp
  3. 10
      src/Magnum/GL/Test/AbstractShaderProgramGLTest.cpp
  4. 22
      src/Magnum/GL/Test/CMakeLists.txt
  5. 23
      src/Magnum/GL/Test/CubeMapTextureGLTest.cpp
  6. 16
      src/Magnum/GL/Test/FramebufferGLTest.cpp
  7. 33
      src/Magnum/GL/Test/TextureArrayGLTest.cpp
  8. 38
      src/Magnum/GL/Test/TextureGLTest.cpp
  9. 22
      src/Magnum/GL/Test/TransformFeedbackGLTest.cpp

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

@ -98,7 +98,7 @@ if(TARGET_GL)
corrade_add_test(DebugToolsTextureImageGLTest TextureImageGLTest.cpp LIBRARIES MagnumDebugTools MagnumOpenGLTester)
set_target_properties(DebugToolsTextureImageGLTest PROPERTIES FOLDER "Magnum/DebugTools/Test")
if(NOT (MAGNUM_TARGET_GLES2 AND MAGNUM_TARGET_WEBGL))
if(NOT MAGNUM_TARGET_WEBGL)
corrade_add_test(DebugToolsBufferDataGLTest BufferDataGLTest.cpp LIBRARIES MagnumDebugTools MagnumOpenGLTester)
set_target_properties(DebugToolsBufferDataGLTest PROPERTIES FOLDER "Magnum/DebugTools/Test")

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

@ -35,7 +35,7 @@
#include "Magnum/GL/TextureFormat.h"
#include "Magnum/Math/Range.h"
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#include "Magnum/DebugTools/BufferData.h"
#include "Magnum/GL/BufferImage.h"
#endif
@ -46,13 +46,13 @@ struct TextureImageGLTest: GL::OpenGLTester {
explicit TextureImageGLTest();
void subImage2D();
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void subImage2DBuffer();
#endif
void subImage2DGeneric();
void subImageCube();
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void subImageCubeBuffer();
#endif
@ -65,13 +65,13 @@ struct TextureImageGLTest: GL::OpenGLTester {
TextureImageGLTest::TextureImageGLTest() {
addTests({&TextureImageGLTest::subImage2D,
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
&TextureImageGLTest::subImage2DBuffer,
#endif
&TextureImageGLTest::subImage2DGeneric,
&TextureImageGLTest::subImageCube,
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
&TextureImageGLTest::subImageCubeBuffer,
#endif
@ -110,7 +110,7 @@ void TextureImageGLTest::subImage2D() {
Containers::arrayView(Data2D), TestSuite::Compare::Container);
}
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void TextureImageGLTest::subImage2DBuffer() {
GL::Texture2D texture;
texture.setImage(0, GL::TextureFormat::RGBA8, ImageView2D{GL::PixelFormat::RGBA, GL::PixelType::UnsignedByte, Vector2i{2}, Data2D});
@ -174,7 +174,7 @@ void TextureImageGLTest::subImageCube() {
Containers::arrayView(Data2D), TestSuite::Compare::Container);
}
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void TextureImageGLTest::subImageCubeBuffer() {
ImageView2D view{GL::PixelFormat::RGBA, GL::PixelType::UnsignedByte, Vector2i{2}, Data2D};

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

@ -31,7 +31,7 @@
#include "Magnum/GL/AbstractShaderProgram.h"
#include "Magnum/GL/Context.h"
#include "Magnum/GL/Extensions.h"
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#include "Magnum/GL/ImageFormat.h"
#endif
#include "Magnum/GL/PixelFormat.h"
@ -79,9 +79,11 @@ struct AbstractShaderProgramGLTest: OpenGLTester {
void createUniformBlocks();
void uniformBlockIndexNotFound();
void uniformBlock();
#endif
#ifndef MAGNUM_TARGET_WEBGL
void compute();
#endif
#endif
};
AbstractShaderProgramGLTest::AbstractShaderProgramGLTest() {
@ -117,8 +119,10 @@ AbstractShaderProgramGLTest::AbstractShaderProgramGLTest() {
&AbstractShaderProgramGLTest::uniformBlockIndexNotFound,
&AbstractShaderProgramGLTest::uniformBlock,
#ifndef MAGNUM_TARGET_WEBGL
&AbstractShaderProgramGLTest::compute
#endif
#endif
});
}
@ -769,6 +773,7 @@ void AbstractShaderProgramGLTest::uniformBlock() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
#ifndef MAGNUM_TARGET_WEBGL
void AbstractShaderProgramGLTest::compute() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::compute_shader>())
@ -847,6 +852,7 @@ void AbstractShaderProgramGLTest::compute() {
#endif
}
#endif
#endif
}}}

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

@ -163,36 +163,42 @@ if(BUILD_GL_TESTS)
corrade_add_test(GLAbstractQueryGLTest AbstractQueryGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(GLPixelStorageGLTest PixelStorageGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(GLSampleQueryGLTest SampleQueryGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(GLTimeQueryGLTest TimeQueryGLTest.cpp LIBRARIES MagnumOpenGLTester)
set_target_properties(
GLAbstractQueryGLTest
GLPixelStorageGLTest
GLSampleQueryGLTest
GLTimeQueryGLTest
PROPERTIES FOLDER "Magnum/GL/Test")
endif()
if(NOT MAGNUM_TARGET_GLES2)
corrade_add_test(GLBufferImageGLTest BufferImageGLTest.cpp LIBRARIES MagnumGLTestLib MagnumOpenGLTester)
corrade_add_test(GLBufferTextureGLTest BufferTextureGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(GLCubeMapTextureArrayGLTest CubeMapTextureArrayGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(GLMultisampleTextureGLTest MultisampleTextureGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(GLPrimitiveQueryGLTest PrimitiveQueryGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(GLTextureArrayGLTest TextureArrayGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(GLTransformFeedbackGLTest TransformFeedbackGLTest.cpp LIBRARIES MagnumOpenGLTester)
set_target_properties(
GLBufferImageGLTest
GLBufferTextureGLTest
GLCubeMapTextureArrayGLTest
GLMultisampleTextureGLTest
GLPrimitiveQueryGLTest
GLTextureArrayGLTest
GLTransformFeedbackGLTest
PROPERTIES FOLDER "Magnum/GL/Test")
endif()
if(NOT MAGNUM_TARGET_GLES2 AND NOT MAGNUM_TARGET_WEBGL)
corrade_add_test(GLBufferTextureGLTest BufferTextureGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(GLCubeMapTextureArrayGLTest CubeMapTextureArrayGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(GLMultisampleTextureGLTest MultisampleTextureGLTest.cpp LIBRARIES MagnumOpenGLTester)
corrade_add_test(GLTimeQueryGLTest TimeQueryGLTest.cpp LIBRARIES MagnumOpenGLTester)
set_target_properties(
GLBufferTextureGLTest
GLCubeMapTextureArrayGLTest
GLMultisampleTextureGLTest
GLTimeQueryGLTest
PROPERTIES FOLDER "Magnum/GL/Test")
endif()
if(NOT MAGNUM_TARGET_GLES)
corrade_add_test(GLRectangleTextureGLTest RectangleTextureGLTest.cpp LIBRARIES MagnumOpenGLTester)
set_target_properties(GLRectangleTextureGLTest PROPERTIES FOLDER "Magnum/GL/Test")

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

@ -58,7 +58,7 @@ struct CubeMapTextureGLTest: OpenGLTester {
#ifndef MAGNUM_TARGET_WEBGL
void samplingSrgbDecode();
#endif
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void samplingSwizzle();
#elif !defined(MAGNUM_TARGET_WEBGL)
void samplingMaxLevel();
@ -66,8 +66,6 @@ struct CubeMapTextureGLTest: OpenGLTester {
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void samplingBorderInteger();
#endif
#ifndef MAGNUM_TARGET_GLES2
void samplingDepthStencilMode();
#endif
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
@ -313,7 +311,7 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() {
#ifndef MAGNUM_TARGET_WEBGL
&CubeMapTextureGLTest::samplingSrgbDecode,
#endif
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
&CubeMapTextureGLTest::samplingSwizzle,
#elif !defined(MAGNUM_TARGET_WEBGL)
&CubeMapTextureGLTest::samplingMaxLevel,
@ -321,8 +319,6 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() {
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
&CubeMapTextureGLTest::samplingBorderInteger,
#endif
#ifndef MAGNUM_TARGET_GLES2
&CubeMapTextureGLTest::samplingDepthStencilMode,
#endif
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
@ -513,7 +509,7 @@ void CubeMapTextureGLTest::samplingSrgbDecode() {
}
#endif
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void CubeMapTextureGLTest::samplingSwizzle() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_swizzle>())
@ -525,7 +521,9 @@ void CubeMapTextureGLTest::samplingSwizzle() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
#elif !defined(MAGNUM_TARGET_WEBGL)
#endif
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void CubeMapTextureGLTest::samplingMaxLevel() {
if(!Context::current().isExtensionSupported<Extensions::APPLE::texture_max_level>())
CORRADE_SKIP(Extensions::APPLE::texture_max_level::string() + std::string(" is not supported."));
@ -568,9 +566,7 @@ void CubeMapTextureGLTest::samplingBorderInteger() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
#ifndef MAGNUM_TARGET_GLES2
void CubeMapTextureGLTest::samplingDepthStencilMode() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::stencil_texturing>())
@ -613,7 +609,7 @@ void CubeMapTextureGLTest::storage() {
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#ifdef MAGNUM_TARGET_GLES
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 not supported, skipping image size testing");
@ -990,8 +986,13 @@ void CubeMapTextureGLTest::immutableCompressedImage() {
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_storage>())
CORRADE_SKIP(Extensions::EXT::texture_storage::string() + std::string(" is not supported."));
#endif
#ifndef MAGNUM_TARGET_WEBGL
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::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::ARB::compressed_texture_pixel_storage>())

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

@ -40,10 +40,10 @@
#ifndef MAGNUM_TARGET_GLES2
#include "Magnum/GL/BufferImage.h"
#include "Magnum/GL/MultisampleTexture.h"
#include "Magnum/GL/TextureArray.h"
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#include "Magnum/GL/MultisampleTexture.h"
#include "Magnum/GL/CubeMapTextureArray.h"
#endif
#ifndef MAGNUM_TARGET_GLES
@ -80,9 +80,9 @@ struct FramebufferGLTest: OpenGLTester {
#endif
#ifndef MAGNUM_TARGET_GLES2
void attachTexture2DArray();
void attachTexture2DMultisample();
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void attachTexture2DMultisample();
void attachTexture2DMultisampleArray();
#endif
#ifndef MAGNUM_TARGET_GLES
@ -192,9 +192,9 @@ FramebufferGLTest::FramebufferGLTest() {
#endif
#ifndef MAGNUM_TARGET_GLES2
&FramebufferGLTest::attachTexture2DArray,
&FramebufferGLTest::attachTexture2DMultisample,
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
&FramebufferGLTest::attachTexture2DMultisample,
&FramebufferGLTest::attachTexture2DMultisampleArray,
#endif
#ifndef MAGNUM_TARGET_GLES
@ -632,7 +632,7 @@ void FramebufferGLTest::attachTexture2DArray() {
}
#endif
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void FramebufferGLTest::attachTexture2DMultisample() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::framebuffer_object>())
@ -662,9 +662,7 @@ void FramebufferGLTest::attachTexture2DMultisample() {
CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::Read), Framebuffer::Status::Complete);
CORRADE_COMPARE(framebuffer.checkStatus(FramebufferTarget::Draw), Framebuffer::Status::Complete);
}
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void FramebufferGLTest::attachTexture2DMultisampleArray() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::framebuffer_object>())
@ -1211,6 +1209,7 @@ void FramebufferGLTest::clearDepth() {
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_WEBGL
#ifdef MAGNUM_TARGET_GLES
if(Context::current().isExtensionSupported<Extensions::NV::read_depth>())
#endif
@ -1224,6 +1223,7 @@ void FramebufferGLTest::clearDepth() {
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(depthImage.data<UnsignedShort>()[0], 48352);
}
#endif
}
void FramebufferGLTest::clearStencil() {
@ -1250,6 +1250,7 @@ void FramebufferGLTest::clearStencil() {
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_WEBGL
#ifdef MAGNUM_TARGET_GLES
if(Context::current().isExtensionSupported<Extensions::NV::read_stencil>())
#endif
@ -1263,6 +1264,7 @@ void FramebufferGLTest::clearStencil() {
MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_COMPARE(stencilImage.data<UnsignedByte>()[0], 67);
}
#endif
}
void FramebufferGLTest::clearDepthStencil() {
@ -1289,6 +1291,7 @@ void FramebufferGLTest::clearDepthStencil() {
framebuffer.clearDepthStencil(Math::unpack<Float, UnsignedShort>(48352), 67);
#ifndef MAGNUM_TARGET_WEBGL
#ifdef MAGNUM_TARGET_GLES
if(Context::current().isExtensionSupported<Extensions::NV::read_depth_stencil>())
#endif
@ -1304,6 +1307,7 @@ void FramebufferGLTest::clearDepthStencil() {
CORRADE_COMPARE(depthStencilImage.data<UnsignedInt>()[0] >> 8, 12378300);
CORRADE_COMPARE(depthStencilImage.data<UnsignedByte>()[0], 67);
}
#endif
}
#endif

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

@ -29,7 +29,6 @@
#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/TextureArray.h"
@ -37,6 +36,10 @@
#include "Magnum/Math/Color.h"
#include "Magnum/Math/Range.h"
#ifndef MAGNUM_TARGET_WEBGL
#include "Magnum/GL/ImageFormat.h"
#endif
namespace Magnum { namespace GL { namespace Test {
struct TextureArrayGLTest: OpenGLTester {
@ -69,10 +72,12 @@ struct TextureArrayGLTest: OpenGLTester {
#endif
template<class T> void sampling2D();
#ifndef MAGNUM_TARGET_WEBGL
#ifndef MAGNUM_TARGET_GLES
void samplingSrgbDecode1D();
#endif
void samplingSrgbDecode2D();
#endif
#ifndef MAGNUM_TARGET_GLES
void samplingSwizzle1D();
@ -88,8 +93,10 @@ struct TextureArrayGLTest: OpenGLTester {
#ifndef MAGNUM_TARGET_GLES
void samplingDepthStencilMode1D();
#endif
#ifndef MAGNUM_TARGET_WEBGL
void samplingDepthStencilMode2D();
#ifdef MAGNUM_TARGET_GLES
#endif
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
void samplingBorder2D();
#endif
@ -286,15 +293,19 @@ TextureArrayGLTest::TextureArrayGLTest() {
&TextureArrayGLTest::sampling2D<GenericSampler>,
&TextureArrayGLTest::sampling2D<GLSampler>,
#ifndef MAGNUM_TARGET_WEBGL
#ifndef MAGNUM_TARGET_GLES
&TextureArrayGLTest::samplingSrgbDecode1D,
#endif
&TextureArrayGLTest::samplingSrgbDecode2D,
#endif
#ifndef MAGNUM_TARGET_GLES
&TextureArrayGLTest::samplingSwizzle1D,
#endif
#ifndef MAGNUM_TARGET_WEBGL
&TextureArrayGLTest::samplingSwizzle2D,
#endif
#ifndef MAGNUM_TARGET_GLES
&TextureArrayGLTest::samplingBorderInteger1D,
@ -305,8 +316,10 @@ TextureArrayGLTest::TextureArrayGLTest() {
#ifndef MAGNUM_TARGET_GLES
&TextureArrayGLTest::samplingDepthStencilMode1D,
#endif
#ifndef MAGNUM_TARGET_WEBGL
&TextureArrayGLTest::samplingDepthStencilMode2D,
#ifdef MAGNUM_TARGET_GLES
#endif
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
&TextureArrayGLTest::samplingBorder2D,
#endif
@ -668,6 +681,7 @@ template<class T> void TextureArrayGLTest::sampling2D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
#ifndef MAGNUM_TARGET_WEBGL
void TextureArrayGLTest::samplingSrgbDecode2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_array>())
@ -681,8 +695,9 @@ void TextureArrayGLTest::samplingSrgbDecode2D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void TextureArrayGLTest::samplingSwizzle2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_array>())
@ -696,7 +711,9 @@ void TextureArrayGLTest::samplingSwizzle2D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
#else
#endif
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void TextureArrayGLTest::samplingMaxLevel2D() {
if(!Context::current().isExtensionSupported<Extensions::APPLE::texture_max_level>())
CORRADE_SKIP(Extensions::APPLE::texture_max_level::string() + std::string(" is not supported."));
@ -743,7 +760,7 @@ void TextureArrayGLTest::samplingBorderInteger2D() {
}
#endif
#ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_WEBGL
void TextureArrayGLTest::samplingDepthStencilMode2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_array>())
@ -762,7 +779,7 @@ void TextureArrayGLTest::samplingDepthStencilMode2D() {
}
#endif
#ifdef MAGNUM_TARGET_GLES
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
void TextureArrayGLTest::samplingBorder2D() {
if(!Context::current().isExtensionSupported<Extensions::NV::texture_border_clamp>() &&
!Context::current().isExtensionSupported<Extensions::EXT::texture_border_clamp>())
@ -808,7 +825,7 @@ void TextureArrayGLTest::storage2D() {
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#ifdef MAGNUM_TARGET_GLES
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 not supported, skipping image size testing");

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

@ -98,9 +98,12 @@ struct TextureGLTest: OpenGLTester {
#ifndef MAGNUM_TARGET_GLES
void samplingSwizzle1D();
#endif
#ifndef MAGNUM_TARGET_WEBGL
void samplingSwizzle2D();
void samplingSwizzle3D();
#elif !defined(MAGNUM_TARGET_WEBGL)
#endif
#endif
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void samplingMaxLevel2D();
void samplingMaxLevel3D();
void samplingCompare2D();
@ -116,7 +119,7 @@ struct TextureGLTest: OpenGLTester {
#ifndef MAGNUM_TARGET_GLES
void samplingDepthStencilMode1D();
#endif
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void samplingDepthStencilMode2D();
void samplingDepthStencilMode3D();
#endif
@ -485,9 +488,12 @@ TextureGLTest::TextureGLTest() {
#ifndef MAGNUM_TARGET_GLES
&TextureGLTest::samplingSwizzle1D,
#endif
#ifndef MAGNUM_TARGET_WEBGL
&TextureGLTest::samplingSwizzle2D,
&TextureGLTest::samplingSwizzle3D,
#elif !defined(MAGNUM_TARGET_WEBGL)
#endif
#endif
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
&TextureGLTest::samplingMaxLevel2D,
&TextureGLTest::samplingMaxLevel3D,
&TextureGLTest::samplingCompare2D,
@ -503,7 +509,7 @@ TextureGLTest::TextureGLTest() {
#ifndef MAGNUM_TARGET_GLES
&TextureGLTest::samplingDepthStencilMode1D,
#endif
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
&TextureGLTest::samplingDepthStencilMode2D,
&TextureGLTest::samplingDepthStencilMode3D,
#endif
@ -997,7 +1003,7 @@ void TextureGLTest::samplingSrgbDecode2D() {
}
#endif
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void TextureGLTest::samplingSwizzle2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_swizzle>())
@ -1009,7 +1015,9 @@ void TextureGLTest::samplingSwizzle2D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
#elif !defined(MAGNUM_TARGET_WEBGL)
#endif
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void TextureGLTest::samplingMaxLevel2D() {
if(!Context::current().isExtensionSupported<Extensions::APPLE::texture_max_level>())
CORRADE_SKIP(Extensions::APPLE::texture_max_level::string() + std::string(" is not supported."));
@ -1051,9 +1059,7 @@ void TextureGLTest::samplingBorderInteger2D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
#ifndef MAGNUM_TARGET_GLES2
void TextureGLTest::samplingDepthStencilMode2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::stencil_texturing>())
@ -1117,6 +1123,7 @@ template<class T> void TextureGLTest::sampling3D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
#ifndef MAGNUM_TARGET_WEBGL
void TextureGLTest::samplingSrgbDecode3D() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::OES::texture_3D>())
@ -1132,8 +1139,9 @@ void TextureGLTest::samplingSrgbDecode3D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void TextureGLTest::samplingSwizzle3D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_swizzle>())
@ -1145,7 +1153,9 @@ void TextureGLTest::samplingSwizzle3D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
#else
#endif
#if defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void TextureGLTest::samplingMaxLevel3D() {
if(!Context::current().isExtensionSupported<Extensions::OES::texture_3D>())
CORRADE_SKIP(Extensions::OES::texture_3D::string() + std::string(" is not supported."));
@ -1178,9 +1188,7 @@ void TextureGLTest::samplingBorderInteger3D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
#endif
#ifndef MAGNUM_TARGET_GLES2
void TextureGLTest::samplingDepthStencilMode3D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::stencil_texturing>())
@ -1197,7 +1205,7 @@ void TextureGLTest::samplingDepthStencilMode3D() {
}
#endif
#ifdef MAGNUM_TARGET_GLES
#if defined(MAGNUM_TARGET_GLES) && !defined(MAGNUM_TARGET_WEBGL)
void TextureGLTest::samplingBorder3D() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::OES::texture_3D>())
@ -1247,7 +1255,7 @@ void TextureGLTest::storage2D() {
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#ifdef MAGNUM_TARGET_GLES
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 not supported, skipping image size testing.");
@ -1276,7 +1284,7 @@ void TextureGLTest::storage3D() {
MAGNUM_VERIFY_NO_GL_ERROR();
#ifndef MAGNUM_TARGET_GLES2
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#ifdef MAGNUM_TARGET_GLES
if(!Context::current().isVersionSupported(Version::GLES310))
CORRADE_SKIP("OpenGL ES 3.1 not supported, skipping image size testing.");

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

@ -49,7 +49,9 @@ struct TransformFeedbackGLTest: OpenGLTester {
void constructMove();
void wrap();
#ifndef MAGNUM_TARGET_WEBGL
void label();
#endif
void attachBase();
void attachRange();
@ -90,7 +92,9 @@ TransformFeedbackGLTest::TransformFeedbackGLTest() {
&TransformFeedbackGLTest::constructMove,
&TransformFeedbackGLTest::wrap,
#ifndef MAGNUM_TARGET_WEBGL
&TransformFeedbackGLTest::label,
#endif
&TransformFeedbackGLTest::attachBase,
&TransformFeedbackGLTest::attachRange,
@ -170,6 +174,7 @@ void TransformFeedbackGLTest::wrap() {
glDeleteTransformFeedbacks(1, &id);
}
#ifndef MAGNUM_TARGET_WEBGL
void TransformFeedbackGLTest::label() {
/* No-Op version is tested in AbstractObjectGLTest */
#ifndef MAGNUM_TARGET_GLES
@ -205,6 +210,7 @@ void TransformFeedbackGLTest::label() {
MAGNUM_VERIFY_NO_GL_ERROR(); /* Check for errors again to flush the error state */
}
}
#endif
namespace {
@ -292,10 +298,14 @@ void TransformFeedbackGLTest::attachBase() {
MAGNUM_VERIFY_NO_GL_ERROR();
#ifdef MAGNUM_TARGET_WEBGL
CORRADE_SKIP("Can't map buffers on WebGL.");
#else
auto data = Containers::arrayCast<const Vector2>(output.mapRead(0, 2*sizeof(Vector2)));
CORRADE_COMPARE(data[0], Vector2(1.0f, -1.0f));
CORRADE_COMPARE(data[1], Vector2(0.0f, 0.0f));
output.unmap();
#endif
}
void TransformFeedbackGLTest::attachRange() {
@ -335,10 +345,14 @@ void TransformFeedbackGLTest::attachRange() {
MAGNUM_VERIFY_NO_GL_ERROR();
#ifdef MAGNUM_TARGET_WEBGL
CORRADE_SKIP("Can't map buffers on WebGL.");
#else
auto data = Containers::arrayCast<const Vector2>(output.mapRead(256, 2*sizeof(Vector2)));
CORRADE_COMPARE(data[0], Vector2(1.0f, -1.0f));
CORRADE_COMPARE(data[1], Vector2(0.0f, 0.0f));
output.unmap();
#endif
}
namespace {
@ -425,6 +439,9 @@ void TransformFeedbackGLTest::attachBases() {
MAGNUM_VERIFY_NO_GL_ERROR();
#ifdef MAGNUM_TARGET_WEBGL
CORRADE_SKIP("Can't map buffers on WebGL.");
#else
auto data1 = Containers::arrayCast<const Vector2>(output1.mapRead(0, 2*sizeof(Vector2)));
CORRADE_COMPARE(data1[0], Vector2(1.0f, -1.0f));
CORRADE_COMPARE(data1[1], Vector2(0.0f, 0.0f));
@ -434,6 +451,7 @@ void TransformFeedbackGLTest::attachBases() {
CORRADE_COMPARE(data2[0], 0.0f);
CORRADE_COMPARE(data2[1], -2.0f);
output2.unmap();
#endif
}
void TransformFeedbackGLTest::attachRanges() {
@ -477,6 +495,9 @@ void TransformFeedbackGLTest::attachRanges() {
MAGNUM_VERIFY_NO_GL_ERROR();
#ifdef MAGNUM_TARGET_WEBGL
CORRADE_SKIP("Can't map buffers on WebGL.");
#else
auto data1 = Containers::arrayCast<const Vector2>(output1.mapRead(256, 2*sizeof(Vector2)));
CORRADE_COMPARE(data1[0], Vector2(1.0f, -1.0f));
CORRADE_COMPARE(data1[1], Vector2(0.0f, 0.0f));
@ -486,6 +507,7 @@ void TransformFeedbackGLTest::attachRanges() {
CORRADE_COMPARE(data2[0], 0.0f);
CORRADE_COMPARE(data2[1], -2.0f);
output2.unmap();
#endif
}
#ifndef MAGNUM_TARGET_GLES

Loading…
Cancel
Save