Browse Source

Enabled multisample texture limit queries in ES 3.1.

pull/68/head
Vladimír Vondruš 12 years ago
parent
commit
ac0b63da0b
  1. 14
      src/Magnum/AbstractTexture.cpp
  2. 20
      src/Magnum/AbstractTexture.h
  3. 5
      src/Magnum/Implementation/TextureState.cpp
  4. 8
      src/Magnum/Implementation/TextureState.h
  5. 4
      src/Magnum/Test/CMakeLists.txt

14
src/Magnum/AbstractTexture.cpp

@ -62,9 +62,13 @@ Float AbstractTexture::maxLodBias() {
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
Int AbstractTexture::maxColorSamples() { Int AbstractTexture::maxColorSamples() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>()) if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
#else
if(!Context::current()->isVersionSupported(Version::GLES310))
#endif
return 0; return 0;
GLint& value = Context::current()->state().texture->maxColorSamples; GLint& value = Context::current()->state().texture->maxColorSamples;
@ -77,7 +81,11 @@ Int AbstractTexture::maxColorSamples() {
} }
Int AbstractTexture::maxDepthSamples() { Int AbstractTexture::maxDepthSamples() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>()) if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
#else
if(!Context::current()->isVersionSupported(Version::GLES310))
#endif
return 0; return 0;
GLint& value = Context::current()->state().texture->maxDepthSamples; GLint& value = Context::current()->state().texture->maxDepthSamples;
@ -90,7 +98,11 @@ Int AbstractTexture::maxDepthSamples() {
} }
Int AbstractTexture::maxIntegerSamples() { Int AbstractTexture::maxIntegerSamples() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>()) if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
#else
if(!Context::current()->isVersionSupported(Version::GLES310))
#endif
return 0; return 0;
GLint& value = Context::current()->state().texture->maxIntegerSamples; GLint& value = Context::current()->state().texture->maxIntegerSamples;

20
src/Magnum/AbstractTexture.h

@ -153,15 +153,15 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
static Float maxLodBias(); static Float maxLodBias();
#endif #endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
/** /**
* @brief Max supported color sample count * @brief Max supported color sample count
* *
* The result is cached, repeated queries don't result in repeated * The result is cached, repeated queries don't result in repeated
* OpenGL calls. If extension @extension{ARB,texture_multisample} is * OpenGL calls. If neither extension @extension{ARB,texture_multisample}
* not available, returns `0`. * (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} * @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(); static Int maxColorSamples();
@ -169,10 +169,10 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
* @brief Max supported depth sample count * @brief Max supported depth sample count
* *
* The result is cached, repeated queries don't result in repeated * The result is cached, repeated queries don't result in repeated
* OpenGL calls. If extension @extension{ARB,texture_multisample} is * OpenGL calls. If neither extension @extension{ARB,texture_multisample}
* not available, returns `0`. * (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} * @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(); static Int maxDepthSamples();
@ -180,10 +180,10 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
* @brief Max supported integer sample count * @brief Max supported integer sample count
* *
* The result is cached, repeated queries don't result in repeated * The result is cached, repeated queries don't result in repeated
* OpenGL calls. If extension @extension{ARB,texture_multisample} is * OpenGL calls. If neither extension @extension{ARB,texture_multisample}
* not available, returns `0`. * (part of OpenGL 3.2) nor OpenGL ES 3.1 is available, returns `0`.
* @see @fn_gl{Get} with @def_gl{MAX_INTEGER_SAMPLES} * @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(); static Int maxIntegerSamples();
#endif #endif

5
src/Magnum/Implementation/TextureState.cpp

@ -50,8 +50,11 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
maxLodBias{0.0f}, maxLodBias{0.0f},
#endif #endif
maxMaxAnisotropy(0.0f), currentTextureUnit(0) maxMaxAnisotropy(0.0f), currentTextureUnit(0)
#ifndef MAGNUM_TARGET_GLES2
, maxColorSamples(0), maxDepthSamples(0), maxIntegerSamples(0)
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
, maxColorSamples(0), maxDepthSamples(0), maxIntegerSamples(0), bufferOffsetAlignment(0) , bufferOffsetAlignment(0)
#endif #endif
{ {
/* Bind implementation */ /* Bind implementation */

8
src/Magnum/Implementation/TextureState.h

@ -99,11 +99,13 @@ struct TextureState {
#endif #endif
GLfloat maxMaxAnisotropy; GLfloat maxMaxAnisotropy;
GLint currentTextureUnit; GLint currentTextureUnit;
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
GLint maxColorSamples, GLint maxColorSamples,
maxDepthSamples, maxDepthSamples,
maxIntegerSamples, maxIntegerSamples;
bufferOffsetAlignment; #endif
#ifndef MAGNUM_TARGET_GLES
GLint bufferOffsetAlignment;
#endif #endif
std::vector<std::pair<GLenum, GLuint>> bindings; std::vector<std::pair<GLenum, GLuint>> bindings;

4
src/Magnum/Test/CMakeLists.txt

@ -78,14 +78,14 @@ if(BUILD_GL_TESTS)
corrade_add_test(ShaderGLTest ShaderGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(ShaderGLTest ShaderGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES})
if(NOT MAGNUM_TARGET_GLES2) 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(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() endif()
if(NOT MAGNUM_TARGET_GLES) if(NOT MAGNUM_TARGET_GLES)
corrade_add_test(BufferTextureGLTest BufferTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES}) corrade_add_test(BufferTextureGLTest BufferTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES})
corrade_add_test(CubeMapTextureArrayGLTest CubeMapTextureArrayGLTest.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}) corrade_add_test(RectangleTextureGLTest RectangleTextureGLTest.cpp LIBRARIES ${GL_TEST_LIBRARIES})
endif() endif()
endif() endif()

Loading…
Cancel
Save