Browse Source

Implemented EXT_texture_border_clamp AEP extension.

Replaced NV_texture_border_clamp enum values with EXT ones, as this is a
superset of the NV extension.
pull/107/head
Vladimír Vondruš 11 years ago
parent
commit
4276d65a75
  1. 2
      doc/opengl-support.dox
  2. 52
      src/Magnum/AbstractTexture.cpp
  3. 6
      src/Magnum/AbstractTexture.h
  4. 22
      src/Magnum/CubeMapTexture.h
  5. 2
      src/Magnum/Implementation/TextureState.cpp
  6. 2
      src/Magnum/Implementation/TextureState.h
  7. 6
      src/Magnum/Sampler.h
  8. 18
      src/Magnum/Test/CubeMapTextureGLTest.cpp
  9. 20
      src/Magnum/Test/TextureArrayGLTest.cpp
  10. 32
      src/Magnum/Test/TextureGLTest.cpp
  11. 22
      src/Magnum/Texture.h
  12. 16
      src/Magnum/TextureArray.h

2
doc/opengl-support.dox

@ -366,7 +366,7 @@ Extension | Status
@es_extension{EXT,gpu_shader5} | done (shading language only) @es_extension{EXT,gpu_shader5} | done (shading language only)
@es_extension{EXT,shader_io_blocks} | done (shading language only) @es_extension{EXT,shader_io_blocks} | done (shading language only)
@es_extension{EXT,tessellation_shader} | | @es_extension{EXT,tessellation_shader} | |
@es_extension{EXT,texture_border_clamp} | | @es_extension{EXT,texture_border_clamp} | done
@es_extension{EXT,texture_buffer} | | @es_extension{EXT,texture_buffer} | |
@es_extension{EXT,texture_cube_map_array} | | @es_extension{EXT,texture_cube_map_array} | |
@es_extension{EXT,primitive_bounding_box} | | @es_extension{EXT,primitive_bounding_box} | |

52
src/Magnum/AbstractTexture.cpp

@ -332,23 +332,37 @@ void AbstractTexture::setLodBias(const Float bias) {
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
void AbstractTexture::setBorderColor(const Color4& color) { void AbstractTexture::setBorderColor(const Color4& color) {
#ifndef MAGNUM_TARGET_GLES (this->*Context::current()->state().texture->parameterfvImplementation)(
(this->*Context::current()->state().texture->parameterfvImplementation)(GL_TEXTURE_BORDER_COLOR, color.data()); #ifndef MAGNUM_TARGET_GLES
#else GL_TEXTURE_BORDER_COLOR,
(this->*Context::current()->state().texture->parameterfvImplementation)(GL_TEXTURE_BORDER_COLOR_NV, color.data()); #else
#endif GL_TEXTURE_BORDER_COLOR_EXT,
#endif
color.data());
} }
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
void AbstractTexture::setBorderColor(const Vector4ui& color) { void AbstractTexture::setBorderColor(const Vector4ui& color) {
(this->*Context::current()->state().texture->parameterIuivImplementation)(GL_TEXTURE_BORDER_COLOR, color.data()); (this->*Context::current()->state().texture->parameterIuivImplementation)(
#ifndef MAGNUM_TARGET_GLES
GL_TEXTURE_BORDER_COLOR,
#else
GL_TEXTURE_BORDER_COLOR_EXT,
#endif
color.data());
} }
void AbstractTexture::setBorderColor(const Vector4i& color) { void AbstractTexture::setBorderColor(const Vector4i& color) {
(this->*Context::current()->state().texture->parameterIivImplementation)(GL_TEXTURE_BORDER_COLOR, color.data()); (this->*Context::current()->state().texture->parameterIivImplementation)(
#ifndef MAGNUM_TARGET_GLES
GL_TEXTURE_BORDER_COLOR,
#else
GL_TEXTURE_BORDER_COLOR_EXT,
#endif
color.data());
} }
#endif #endif
#endif
void AbstractTexture::setMaxAnisotropy(const Float anisotropy) { void AbstractTexture::setMaxAnisotropy(const Float anisotropy) {
(this->*Context::current()->state().texture->setMaxAnisotropyImplementation)(anisotropy); (this->*Context::current()->state().texture->setMaxAnisotropyImplementation)(anisotropy);
@ -926,12 +940,18 @@ void AbstractTexture::parameterImplementationDSAEXT(GLenum parameter, const GLfl
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void AbstractTexture::parameterIImplementationDefault(GLenum parameter, const GLuint* values) { void AbstractTexture::parameterIImplementationDefault(GLenum parameter, const GLuint* values) {
bindInternal(); bindInternal();
glTexParameterIuiv(_target, parameter, values); #ifndef MAGNUM_TARGET_GLES
glTexParameterIuiv
#else
glTexParameterIuivEXT
#endif
(_target, parameter, values);
} }
#ifndef MAGNUM_TARGET_GLES
void AbstractTexture::parameterIImplementationDSA(const GLenum parameter, const GLuint* const values) { void AbstractTexture::parameterIImplementationDSA(const GLenum parameter, const GLuint* const values) {
glTextureParameterIuiv(_id, parameter, values); glTextureParameterIuiv(_id, parameter, values);
} }
@ -940,12 +960,19 @@ void AbstractTexture::parameterIImplementationDSAEXT(GLenum parameter, const GLu
_flags |= ObjectFlag::Created; _flags |= ObjectFlag::Created;
glTextureParameterIuivEXT(_id, _target, parameter, values); glTextureParameterIuivEXT(_id, _target, parameter, values);
} }
#endif
void AbstractTexture::parameterIImplementationDefault(GLenum parameter, const GLint* values) { void AbstractTexture::parameterIImplementationDefault(GLenum parameter, const GLint* values) {
bindInternal(); bindInternal();
glTexParameterIiv(_target, parameter, values); #ifndef MAGNUM_TARGET_GLES
glTexParameterIiv
#else
glTexParameterIivEXT
#endif
(_target, parameter, values);
} }
#ifndef MAGNUM_TARGET_GLES
void AbstractTexture::parameterIImplementationDSA(const GLenum parameter, const GLint* const values) { void AbstractTexture::parameterIImplementationDSA(const GLenum parameter, const GLint* const values) {
glTextureParameterIiv(_id, parameter, values); glTextureParameterIiv(_id, parameter, values);
} }
@ -955,6 +982,7 @@ void AbstractTexture::parameterIImplementationDSAEXT(GLenum parameter, const GLi
glTextureParameterIivEXT(_id, _target, parameter, values); glTextureParameterIivEXT(_id, _target, parameter, values);
} }
#endif #endif
#endif
void AbstractTexture::setMaxAnisotropyImplementationNoOp(GLfloat) {} void AbstractTexture::setMaxAnisotropyImplementationNoOp(GLfloat) {}

6
src/Magnum/AbstractTexture.h

@ -368,11 +368,11 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
#endif #endif
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
void setBorderColor(const Color4& color); void setBorderColor(const Color4& color);
#endif #ifndef MAGNUM_TARGET_GLES2
#ifndef MAGNUM_TARGET_GLES
void setBorderColor(const Vector4i& color); void setBorderColor(const Vector4i& color);
void setBorderColor(const Vector4ui& color); void setBorderColor(const Vector4ui& color);
#endif #endif
#endif
void setMaxAnisotropy(Float anisotropy); void setMaxAnisotropy(Float anisotropy);
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
void setSRGBDecode(bool decode); void setSRGBDecode(bool decode);
@ -440,7 +440,7 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject {
void MAGNUM_LOCAL parameterImplementationDefault(GLenum parameter, const GLint* values); void MAGNUM_LOCAL parameterImplementationDefault(GLenum parameter, const GLint* values);
#endif #endif
void MAGNUM_LOCAL parameterImplementationDefault(GLenum parameter, const GLfloat* values); void MAGNUM_LOCAL parameterImplementationDefault(GLenum parameter, const GLfloat* values);
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void MAGNUM_LOCAL parameterIImplementationDefault(GLenum parameter, const GLuint* values); void MAGNUM_LOCAL parameterIImplementationDefault(GLenum parameter, const GLuint* values);
void MAGNUM_LOCAL parameterIImplementationDefault(GLenum parameter, const GLint* values); void MAGNUM_LOCAL parameterIImplementationDefault(GLenum parameter, const GLint* values);
#endif #endif

22
src/Magnum/CubeMapTexture.h

@ -257,16 +257,17 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* *
* See @ref Texture::setBorderColor(const Color4&) for more * See @ref Texture::setBorderColor(const Color4&) for more
* information. * information.
* @requires_es_extension Extension @es_extension{NV,texture_border_clamp} * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,texture_border_clamp} or
* @es_extension{NV,texture_border_clamp}
* @requires_gles Border clamp is not available in WebGL. * @requires_gles Border clamp is not available in WebGL.
*/ */
CubeMapTexture& setBorderColor(const Color4& color) { CubeMapTexture& setBorderColor(const Color4& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
return *this; return *this;
} }
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
/** /**
* @copybrief Texture::setBorderColor(const Vector4ui&) * @copybrief Texture::setBorderColor(const Vector4ui&)
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
@ -274,8 +275,11 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* See @ref Texture::setBorderColor(const Vector4ui&) for more * See @ref Texture::setBorderColor(const Vector4ui&) for more
* information. * information.
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Border clamp is available only for float textures in * @requires_gles30 Not defined in OpenGL ES 2.0.
* OpenGL ES. Border clamp is not available in WebGL. * @requires_es_extension Extension
* @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,texture_border_clamp}
* @requires_gles Border clamp is not available in WebGL.
*/ */
CubeMapTexture& setBorderColor(const Vector4ui& color) { CubeMapTexture& setBorderColor(const Vector4ui& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
@ -284,14 +288,18 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
/** @overload /** @overload
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Border clamp is available only for float textures in * @requires_gles30 Not defined in OpenGL ES 2.0.
* OpenGL ES. Border clamp is not available in WebGL. * @requires_es_extension Extension
* @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,texture_border_clamp}
* @requires_gles Border clamp is not available in WebGL.
*/ */
CubeMapTexture& setBorderColor(const Vector4i& color) { CubeMapTexture& setBorderColor(const Vector4i& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
return *this; return *this;
} }
#endif #endif
#endif
/** /**
* @copybrief Texture::setMaxAnisotropy() * @copybrief Texture::setMaxAnisotropy()

2
src/Magnum/Implementation/TextureState.cpp

@ -165,7 +165,7 @@ TextureState::TextureState(Context& context, std::vector<std::string>& extension
parameterivImplementation = &AbstractTexture::parameterImplementationDefault; parameterivImplementation = &AbstractTexture::parameterImplementationDefault;
#endif #endif
parameterfvImplementation = &AbstractTexture::parameterImplementationDefault; parameterfvImplementation = &AbstractTexture::parameterImplementationDefault;
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
parameterIuivImplementation = &AbstractTexture::parameterIImplementationDefault; parameterIuivImplementation = &AbstractTexture::parameterIImplementationDefault;
parameterIivImplementation = &AbstractTexture::parameterIImplementationDefault; parameterIivImplementation = &AbstractTexture::parameterIImplementationDefault;
#endif #endif

2
src/Magnum/Implementation/TextureState.h

@ -48,7 +48,7 @@ struct TextureState {
void(AbstractTexture::*parameterivImplementation)(GLenum, const GLint*); void(AbstractTexture::*parameterivImplementation)(GLenum, const GLint*);
#endif #endif
void(AbstractTexture::*parameterfvImplementation)(GLenum, const GLfloat*); void(AbstractTexture::*parameterfvImplementation)(GLenum, const GLfloat*);
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void(AbstractTexture::*parameterIuivImplementation)(GLenum, const GLuint*); void(AbstractTexture::*parameterIuivImplementation)(GLenum, const GLuint*);
void(AbstractTexture::*parameterIivImplementation)(GLenum, const GLint*); void(AbstractTexture::*parameterIivImplementation)(GLenum, const GLint*);
#endif #endif

6
src/Magnum/Sampler.h

@ -121,13 +121,15 @@ class MAGNUM_EXPORT Sampler {
* Clamp to border color. Coordinates out of range will be clamped * Clamp to border color. Coordinates out of range will be clamped
* to border color (set with * to border color (set with
* @ref Texture::setBorderColor() "*Texture::setBorderColor()"). * @ref Texture::setBorderColor() "*Texture::setBorderColor()").
* @requires_es_extension Extension @es_extension{NV,texture_border_clamp} * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,texture_border_clamp} or
* @es_extension{NV,texture_border_clamp}
* @requires_gles Border clamp is not available in WebGL. * @requires_gles Border clamp is not available in WebGL.
*/ */
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
ClampToBorder = GL_CLAMP_TO_BORDER, ClampToBorder = GL_CLAMP_TO_BORDER,
#else #else
ClampToBorder = GL_CLAMP_TO_BORDER_NV, ClampToBorder = GL_CLAMP_TO_BORDER_EXT,
#endif #endif
#endif #endif

18
src/Magnum/Test/CubeMapTextureGLTest.cpp

@ -56,7 +56,7 @@ struct CubeMapTextureGLTest: AbstractOpenGLTester {
void samplingMaxLevel(); void samplingMaxLevel();
void samplingCompare(); void samplingCompare();
#endif #endif
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void samplingBorderInteger(); void samplingBorderInteger();
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -107,7 +107,7 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() {
&CubeMapTextureGLTest::samplingMaxLevel, &CubeMapTextureGLTest::samplingMaxLevel,
&CubeMapTextureGLTest::samplingCompare, &CubeMapTextureGLTest::samplingCompare,
#endif #endif
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
&CubeMapTextureGLTest::samplingBorderInteger, &CubeMapTextureGLTest::samplingBorderInteger,
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -278,10 +278,15 @@ void CubeMapTextureGLTest::samplingCompare() {
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void CubeMapTextureGLTest::samplingBorderInteger() { void CubeMapTextureGLTest::samplingBorderInteger() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_integer>()) if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_integer>())
CORRADE_SKIP(Extensions::GL::EXT::texture_integer::string() + std::string(" is not supported.")); CORRADE_SKIP(Extensions::GL::EXT::texture_integer::string() + std::string(" is not supported."));
#else
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_border_clamp>())
CORRADE_SKIP(Extensions::GL::EXT::texture_border_clamp::string() + std::string(" is not supported."));
#endif
CubeMapTexture a; CubeMapTexture a;
a.setWrapping(Sampler::Wrapping::ClampToBorder) a.setWrapping(Sampler::Wrapping::ClampToBorder)
@ -312,9 +317,10 @@ void CubeMapTextureGLTest::samplingDepthStencilMode() {
#endif #endif
#ifdef MAGNUM_TARGET_GLES #ifdef MAGNUM_TARGET_GLES
void CubeMapTextureGLTest::samplingBorder2D() { void CubeMapTextureGLTest::samplingBorder() {
if(!Context::current()->isExtensionSupported<Extensions::GL::NV::texture_border_clamp>()) if(!Context::current()->isExtensionSupported<Extensions::GL::NV::texture_border_clamp>() &&
CORRADE_SKIP(Extensions::GL::NV::texture_border_clamp::string() + std::string(" is not supported.")); !Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_border_clamp>())
CORRADE_SKIP("No required extension is supported.");
CubeMapTexture texture; CubeMapTexture texture;
texture.setWrapping(Sampler::Wrapping::ClampToBorder) texture.setWrapping(Sampler::Wrapping::ClampToBorder)

20
src/Magnum/Test/TextureArrayGLTest.cpp

@ -79,7 +79,11 @@ struct TextureArrayGLTest: AbstractOpenGLTester {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void samplingBorderInteger1D(); void samplingBorderInteger1D();
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void samplingBorderInteger2D(); void samplingBorderInteger2D();
#endif
#ifndef MAGNUM_TARGET_GLES
void samplingDepthStencilMode1D(); void samplingDepthStencilMode1D();
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -172,7 +176,11 @@ TextureArrayGLTest::TextureArrayGLTest() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
&TextureArrayGLTest::samplingBorderInteger1D, &TextureArrayGLTest::samplingBorderInteger1D,
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
&TextureArrayGLTest::samplingBorderInteger2D, &TextureArrayGLTest::samplingBorderInteger2D,
#endif
#ifndef MAGNUM_TARGET_GLES
&TextureArrayGLTest::samplingDepthStencilMode1D, &TextureArrayGLTest::samplingDepthStencilMode1D,
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -524,12 +532,17 @@ void TextureArrayGLTest::samplingCompare2D() {
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void TextureArrayGLTest::samplingBorderInteger2D() { void TextureArrayGLTest::samplingBorderInteger2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_array>()) if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_array>())
CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported.")); CORRADE_SKIP(Extensions::GL::EXT::texture_array::string() + std::string(" is not supported."));
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_integer>()) if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_integer>())
CORRADE_SKIP(Extensions::GL::EXT::texture_integer::string() + std::string(" is not supported.")); CORRADE_SKIP(Extensions::GL::EXT::texture_integer::string() + std::string(" is not supported."));
#else
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_border_clamp>())
CORRADE_SKIP(Extensions::GL::EXT::texture_border_clamp::string() + std::string(" is not supported."));
#endif
Texture2DArray a; Texture2DArray a;
a.setWrapping(Sampler::Wrapping::ClampToBorder) a.setWrapping(Sampler::Wrapping::ClampToBorder)
@ -563,8 +576,9 @@ void TextureArrayGLTest::samplingDepthStencilMode2D() {
#ifdef MAGNUM_TARGET_GLES #ifdef MAGNUM_TARGET_GLES
void TextureArrayGLTest::samplingBorder2D() { void TextureArrayGLTest::samplingBorder2D() {
if(!Context::current()->isExtensionSupported<Extensions::GL::NV::texture_border_clamp>()) if(!Context::current()->isExtensionSupported<Extensions::GL::NV::texture_border_clamp>() &&
CORRADE_SKIP(Extensions::GL::NV::texture_border_clamp::string() + std::string(" is not supported.")); !Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_border_clamp>())
CORRADE_SKIP("No required extension is supported.");
Texture2DArray texture; Texture2DArray texture;
texture.setWrapping(Sampler::Wrapping::ClampToBorder) texture.setWrapping(Sampler::Wrapping::ClampToBorder)

32
src/Magnum/Test/TextureGLTest.cpp

@ -89,8 +89,12 @@ struct TextureGLTest: AbstractOpenGLTester {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
void samplingBorderInteger1D(); void samplingBorderInteger1D();
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void samplingBorderInteger2D(); void samplingBorderInteger2D();
void samplingBorderInteger3D(); void samplingBorderInteger3D();
#endif
#ifndef MAGNUM_TARGET_GLES
void samplingDepthStencilMode1D(); void samplingDepthStencilMode1D();
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -214,8 +218,12 @@ TextureGLTest::TextureGLTest() {
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
&TextureGLTest::samplingBorderInteger1D, &TextureGLTest::samplingBorderInteger1D,
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
&TextureGLTest::samplingBorderInteger2D, &TextureGLTest::samplingBorderInteger2D,
&TextureGLTest::samplingBorderInteger3D, &TextureGLTest::samplingBorderInteger3D,
#endif
#ifndef MAGNUM_TARGET_GLES
&TextureGLTest::samplingDepthStencilMode1D, &TextureGLTest::samplingDepthStencilMode1D,
#endif #endif
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -617,10 +625,15 @@ void TextureGLTest::samplingCompare2D() {
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void TextureGLTest::samplingBorderInteger2D() { void TextureGLTest::samplingBorderInteger2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_integer>()) if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_integer>())
CORRADE_SKIP(Extensions::GL::EXT::texture_integer::string() + std::string(" is not supported.")); CORRADE_SKIP(Extensions::GL::EXT::texture_integer::string() + std::string(" is not supported."));
#else
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_border_clamp>())
CORRADE_SKIP(Extensions::GL::EXT::texture_border_clamp::string() + std::string(" is not supported."));
#endif
Texture2D a; Texture2D a;
a.setWrapping(Sampler::Wrapping::ClampToBorder) a.setWrapping(Sampler::Wrapping::ClampToBorder)
@ -652,8 +665,9 @@ void TextureGLTest::samplingDepthStencilMode2D() {
#ifdef MAGNUM_TARGET_GLES #ifdef MAGNUM_TARGET_GLES
void TextureGLTest::samplingBorder2D() { void TextureGLTest::samplingBorder2D() {
if(!Context::current()->isExtensionSupported<Extensions::GL::NV::texture_border_clamp>()) if(!Context::current()->isExtensionSupported<Extensions::GL::NV::texture_border_clamp>() &&
CORRADE_SKIP(Extensions::GL::NV::texture_border_clamp::string() + std::string(" is not supported.")); !Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_border_clamp>())
CORRADE_SKIP("No required extension is supported.");
Texture2D texture; Texture2D texture;
texture.setWrapping(Sampler::Wrapping::ClampToBorder) texture.setWrapping(Sampler::Wrapping::ClampToBorder)
@ -734,10 +748,15 @@ void TextureGLTest::samplingMaxLevel3D() {
} }
#endif #endif
#ifndef MAGNUM_TARGET_GLES #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
void TextureGLTest::samplingBorderInteger3D() { void TextureGLTest::samplingBorderInteger3D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_integer>()) if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_integer>())
CORRADE_SKIP(Extensions::GL::EXT::texture_integer::string() + std::string(" is not supported.")); CORRADE_SKIP(Extensions::GL::EXT::texture_integer::string() + std::string(" is not supported."));
#else
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_border_clamp>())
CORRADE_SKIP(Extensions::GL::EXT::texture_border_clamp::string() + std::string(" is not supported."));
#endif
Texture3D a; Texture3D a;
a.setWrapping(Sampler::Wrapping::ClampToBorder) a.setWrapping(Sampler::Wrapping::ClampToBorder)
@ -774,8 +793,9 @@ void TextureGLTest::samplingBorder3D() {
CORRADE_SKIP(Extensions::GL::OES::texture_3D::string() + std::string(" is not supported.")); CORRADE_SKIP(Extensions::GL::OES::texture_3D::string() + std::string(" is not supported."));
#endif #endif
if(!Context::current()->isExtensionSupported<Extensions::GL::NV::texture_border_clamp>()) if(!Context::current()->isExtensionSupported<Extensions::GL::NV::texture_border_clamp>() &&
CORRADE_SKIP(Extensions::GL::NV::texture_border_clamp::string() + std::string(" is not supported.")); !Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_border_clamp>())
CORRADE_SKIP("No required extension is supported.");
Texture3D texture; Texture3D texture;
texture.setWrapping(Sampler::Wrapping::ClampToBorder) texture.setWrapping(Sampler::Wrapping::ClampToBorder)

22
src/Magnum/Texture.h

@ -366,16 +366,17 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* @fn_gl_extension{TextureParameter,EXT,direct_state_access}, * @fn_gl_extension{TextureParameter,EXT,direct_state_access},
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{TexParameter} with @def_gl{TEXTURE_BORDER_COLOR} * @fn_gl{TexParameter} with @def_gl{TEXTURE_BORDER_COLOR}
* @requires_es_extension Extension @es_extension{NV,texture_border_clamp} * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,texture_border_clamp} or
* @es_extension{NV,texture_border_clamp}
* @requires_gles Border clamp is not available in WebGL. * @requires_gles Border clamp is not available in WebGL.
*/ */
Texture<dimensions>& setBorderColor(const Color4& color) { Texture<dimensions>& setBorderColor(const Color4& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
return *this; return *this;
} }
#endif
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES2
/** /**
* @brief Set border color for integer texture * @brief Set border color for integer texture
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
@ -391,8 +392,11 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
* eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and * eventually @fn_gl{ActiveTexture}, @fn_gl{BindTexture} and
* @fn_gl{TexParameter} with @def_gl{TEXTURE_BORDER_COLOR} * @fn_gl{TexParameter} with @def_gl{TEXTURE_BORDER_COLOR}
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Border clamp is available only for float textures in * @requires_gles30 Not defined in OpenGL ES 2.0.
* OpenGL ES. Border clamp is not available in WebGL. * @requires_es_extension Extension
* @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,texture_border_clamp}
* @requires_gles Border clamp is not available in WebGL.
*/ */
Texture<dimensions>& setBorderColor(const Vector4ui& color) { Texture<dimensions>& setBorderColor(const Vector4ui& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
@ -401,14 +405,18 @@ template<UnsignedInt dimensions> class Texture: public AbstractTexture {
/** @overload /** @overload
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Border clamp is available only for float textures in * @requires_gles30 Not defined in OpenGL ES 2.0.
* OpenGL ES. Border clamp is not available in WebGL. * @requires_es_extension Extension
* @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,texture_border_clamp}
* @requires_gles Border clamp is not available in WebGL.
*/ */
Texture<dimensions>& setBorderColor(const Vector4i& color) { Texture<dimensions>& setBorderColor(const Vector4i& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
return *this; return *this;
} }
#endif #endif
#endif
/** /**
* @brief Set max anisotropy * @brief Set max anisotropy

16
src/Magnum/TextureArray.h

@ -248,16 +248,16 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* *
* See @ref Texture::setBorderColor(const Color4&) for more * See @ref Texture::setBorderColor(const Color4&) for more
* information. * information.
* @requires_es_extension Extension @es_extension{NV,texture_border_clamp} * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/
* @es_extension{EXT,texture_border_clamp} or
* @es_extension{NV,texture_border_clamp}
* @requires_gles Border clamp is not available in WebGL. * @requires_gles Border clamp is not available in WebGL.
*/ */
TextureArray<dimensions>& setBorderColor(const Color4& color) { TextureArray<dimensions>& setBorderColor(const Color4& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
return *this; return *this;
} }
#endif
#ifndef MAGNUM_TARGET_GLES
/** /**
* @copybrief Texture::setBorderColor(const Vector4ui&) * @copybrief Texture::setBorderColor(const Vector4ui&)
* @return Reference to self (for method chaining) * @return Reference to self (for method chaining)
@ -265,8 +265,9 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
* See @ref Texture::setBorderColor(const Vector4ui&) for more * See @ref Texture::setBorderColor(const Vector4ui&) for more
* information. * information.
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Border clamp is available only for float textures in * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/
* OpenGL ES. Border clamp is not available in WebGL. * @es_extension{EXT,texture_border_clamp}
* @requires_gles Border clamp is not available in WebGL.
*/ */
TextureArray<dimensions>& setBorderColor(const Vector4ui& color) { TextureArray<dimensions>& setBorderColor(const Vector4ui& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);
@ -275,8 +276,9 @@ template<UnsignedInt dimensions> class TextureArray: public AbstractTexture {
/** @overload /** @overload
* @requires_gl30 Extension @extension{EXT,texture_integer} * @requires_gl30 Extension @extension{EXT,texture_integer}
* @requires_gl Border clamp is available only for float textures in * @requires_es_extension Extension @es_extension{ANDROID,extension_pack_es31a}/
* OpenGL ES. Border clamp is not available in WebGL. * @es_extension{EXT,texture_border_clamp}
* @requires_gles Border clamp is not available in WebGL.
*/ */
TextureArray<dimensions>& setBorderColor(const Vector4i& color) { TextureArray<dimensions>& setBorderColor(const Vector4i& color) {
AbstractTexture::setBorderColor(color); AbstractTexture::setBorderColor(color);

Loading…
Cancel
Save