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
#ifndef MAGNUM_TARGET_GLES
#ifndef MAGNUM_TARGET_GLES2
Int AbstractTexture::maxColorSamples() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>())
#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<Extensions::GL::ARB::texture_multisample>())
#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<Extensions::GL::ARB::texture_multisample>())
#else
if(!Context::current()->isVersionSupported(Version::GLES310))
#endif
return 0;
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();
#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

5
src/Magnum/Implementation/TextureState.cpp

@ -50,8 +50,11 @@ TextureState::TextureState(Context& context, std::vector<std::string>& 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 */

8
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<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})
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()

Loading…
Cancel
Save