From ac0b63da0b0550a7afe00620c5b3f66ac4c21cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 13 Aug 2014 13:45:52 +0200 Subject: [PATCH] Enabled multisample texture limit queries in ES 3.1. --- src/Magnum/AbstractTexture.cpp | 14 +++++++++++++- src/Magnum/AbstractTexture.h | 20 ++++++++++---------- src/Magnum/Implementation/TextureState.cpp | 5 ++++- src/Magnum/Implementation/TextureState.h | 8 +++++--- src/Magnum/Test/CMakeLists.txt | 4 ++-- 5 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/Magnum/AbstractTexture.cpp b/src/Magnum/AbstractTexture.cpp index b4eba3edc..a27805bf1 100644 --- a/src/Magnum/AbstractTexture.cpp +++ b/src/Magnum/AbstractTexture.cpp @@ -62,9 +62,13 @@ Float AbstractTexture::maxLodBias() { } #endif -#ifndef MAGNUM_TARGET_GLES +#ifndef MAGNUM_TARGET_GLES2 Int AbstractTexture::maxColorSamples() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) + #else + if(!Context::current()->isVersionSupported(Version::GLES310)) + #endif return 0; GLint& value = Context::current()->state().texture->maxColorSamples; @@ -77,7 +81,11 @@ Int AbstractTexture::maxColorSamples() { } Int AbstractTexture::maxDepthSamples() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) + #else + if(!Context::current()->isVersionSupported(Version::GLES310)) + #endif return 0; GLint& value = Context::current()->state().texture->maxDepthSamples; @@ -90,7 +98,11 @@ Int AbstractTexture::maxDepthSamples() { } Int AbstractTexture::maxIntegerSamples() { + #ifndef MAGNUM_TARGET_GLES if(!Context::current()->isExtensionSupported()) + #else + if(!Context::current()->isVersionSupported(Version::GLES310)) + #endif return 0; GLint& value = Context::current()->state().texture->maxIntegerSamples; diff --git a/src/Magnum/AbstractTexture.h b/src/Magnum/AbstractTexture.h index 11de23750..1d0a9765d 100644 --- a/src/Magnum/AbstractTexture.h +++ b/src/Magnum/AbstractTexture.h @@ -153,15 +153,15 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { static Float maxLodBias(); #endif - #ifndef MAGNUM_TARGET_GLES + #ifndef MAGNUM_TARGET_GLES2 /** * @brief Max supported color sample count * * The result is cached, repeated queries don't result in repeated - * OpenGL calls. If extension @extension{ARB,texture_multisample} is - * not available, returns `0`. + * OpenGL calls. If neither extension @extension{ARB,texture_multisample} + * (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns `0`. * @see @fn_gl{Get} with @def_gl{MAX_COLOR_TEXTURE_SAMPLES} - * @requires_gl Multisample textures are not available in OpenGL ES. + * @requires_gles30 Not defined in OpenGL ES 2.0 */ static Int maxColorSamples(); @@ -169,10 +169,10 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { * @brief Max supported depth sample count * * The result is cached, repeated queries don't result in repeated - * OpenGL calls. If extension @extension{ARB,texture_multisample} is - * not available, returns `0`. + * OpenGL calls. If neither extension @extension{ARB,texture_multisample} + * (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns `0`. * @see @fn_gl{Get} with @def_gl{MAX_DEPTH_TEXTURE_SAMPLES} - * @requires_gl Multisample textures are not available in OpenGL ES. + * @requires_gles30 Not defined in OpenGL ES 2.0 */ static Int maxDepthSamples(); @@ -180,10 +180,10 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { * @brief Max supported integer sample count * * The result is cached, repeated queries don't result in repeated - * OpenGL calls. If extension @extension{ARB,texture_multisample} is - * not available, returns `0`. + * OpenGL calls. If neither extension @extension{ARB,texture_multisample} + * (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns `0`. * @see @fn_gl{Get} with @def_gl{MAX_INTEGER_SAMPLES} - * @requires_gl Multisample textures are not available in OpenGL ES. + * @requires_gles30 Not defined in OpenGL ES 2.0 */ static Int maxIntegerSamples(); #endif diff --git a/src/Magnum/Implementation/TextureState.cpp b/src/Magnum/Implementation/TextureState.cpp index cf2df73eb..78c5b9cec 100644 --- a/src/Magnum/Implementation/TextureState.cpp +++ b/src/Magnum/Implementation/TextureState.cpp @@ -50,8 +50,11 @@ TextureState::TextureState(Context& context, std::vector& extension maxLodBias{0.0f}, #endif maxMaxAnisotropy(0.0f), currentTextureUnit(0) + #ifndef MAGNUM_TARGET_GLES2 + , maxColorSamples(0), maxDepthSamples(0), maxIntegerSamples(0) + #endif #ifndef MAGNUM_TARGET_GLES - , maxColorSamples(0), maxDepthSamples(0), maxIntegerSamples(0), bufferOffsetAlignment(0) + , bufferOffsetAlignment(0) #endif { /* Bind implementation */ diff --git a/src/Magnum/Implementation/TextureState.h b/src/Magnum/Implementation/TextureState.h index 6fb7d3087..7773c25b3 100644 --- a/src/Magnum/Implementation/TextureState.h +++ b/src/Magnum/Implementation/TextureState.h @@ -99,11 +99,13 @@ struct TextureState { #endif GLfloat maxMaxAnisotropy; GLint currentTextureUnit; - #ifndef MAGNUM_TARGET_GLES + #ifndef MAGNUM_TARGET_GLES2 GLint maxColorSamples, maxDepthSamples, - maxIntegerSamples, - bufferOffsetAlignment; + maxIntegerSamples; + #endif + #ifndef MAGNUM_TARGET_GLES + GLint bufferOffsetAlignment; #endif std::vector> bindings; diff --git a/src/Magnum/Test/CMakeLists.txt b/src/Magnum/Test/CMakeLists.txt index eb8f51ff1..c04344f3b 100644 --- a/src/Magnum/Test/CMakeLists.txt +++ b/src/Magnum/Test/CMakeLists.txt @@ -78,14 +78,14 @@ if(BUILD_GL_TESTS) corrade_add_test(ShaderGLTest ShaderGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) if(NOT MAGNUM_TARGET_GLES2) - corrade_add_test(TextureArrayGLTest TextureArrayGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(BufferImageGLTest BufferImageGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + corrade_add_test(TextureArrayGLTest TextureArrayGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) + corrade_add_test(MultisampleTextureGLTest MultisampleTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) endif() if(NOT MAGNUM_TARGET_GLES) corrade_add_test(BufferTextureGLTest BufferTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(CubeMapTextureArrayGLTest CubeMapTextureArrayGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) - corrade_add_test(MultisampleTextureGLTest MultisampleTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(RectangleTextureGLTest RectangleTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) endif() endif()