@ -41,52 +41,6 @@
namespace Magnum {
AbstractTexture : : BindImplementation AbstractTexture : : bindImplementation =
& AbstractTexture : : bindImplementationDefault ;
AbstractTexture : : ParameteriImplementation AbstractTexture : : parameteriImplementation =
& AbstractTexture : : parameterImplementationDefault ;
AbstractTexture : : ParameterfImplementation AbstractTexture : : parameterfImplementation =
& AbstractTexture : : parameterImplementationDefault ;
AbstractTexture : : ParameterfvImplementation AbstractTexture : : parameterfvImplementation =
& AbstractTexture : : parameterImplementationDefault ;
AbstractTexture : : SetMaxAnisotropyImplementation AbstractTexture : : setMaxAnisotropyImplementation =
& AbstractTexture : : setMaxAnisotropyImplementationNoOp ;
# ifndef MAGNUM_TARGET_GLES
AbstractTexture : : GetLevelParameterivImplementation AbstractTexture : : getLevelParameterivImplementation =
& AbstractTexture : : getLevelParameterImplementationDefault ;
# endif
AbstractTexture : : MipmapImplementation AbstractTexture : : mipmapImplementation =
& AbstractTexture : : mipmapImplementationDefault ;
# ifndef MAGNUM_TARGET_GLES
AbstractTexture : : Storage1DImplementation AbstractTexture : : storage1DImplementation =
& AbstractTexture : : storageImplementationFallback ;
# endif
AbstractTexture : : Storage2DImplementation AbstractTexture : : storage2DImplementation =
& AbstractTexture : : storageImplementationFallback ;
AbstractTexture : : Storage3DImplementation AbstractTexture : : storage3DImplementation =
& AbstractTexture : : storageImplementationFallback ;
# ifndef MAGNUM_TARGET_GLES
AbstractTexture : : GetImageImplementation AbstractTexture : : getImageImplementation =
& AbstractTexture : : getImageImplementationDefault ;
AbstractTexture : : Image1DImplementation AbstractTexture : : image1DImplementation =
& AbstractTexture : : imageImplementationDefault ;
# endif
AbstractTexture : : Image2DImplementation AbstractTexture : : image2DImplementation =
& AbstractTexture : : imageImplementationDefault ;
AbstractTexture : : Image3DImplementation AbstractTexture : : image3DImplementation =
& AbstractTexture : : imageImplementationDefault ;
# ifndef MAGNUM_TARGET_GLES
AbstractTexture : : SubImage1DImplementation AbstractTexture : : subImage1DImplementation =
& AbstractTexture : : subImageImplementationDefault ;
# endif
AbstractTexture : : SubImage2DImplementation AbstractTexture : : subImage2DImplementation =
& AbstractTexture : : subImageImplementationDefault ;
AbstractTexture : : SubImage3DImplementation AbstractTexture : : subImage3DImplementation =
& AbstractTexture : : subImageImplementationDefault ;
AbstractTexture : : InvalidateImageImplementation AbstractTexture : : invalidateImageImplementation = & AbstractTexture : : invalidateImageImplementationNoOp ;
AbstractTexture : : InvalidateSubImageImplementation AbstractTexture : : invalidateSubImageImplementation = & AbstractTexture : : invalidateSubImageImplementationNoOp ;
Int AbstractTexture : : maxLayers ( ) { return Shader : : maxCombinedTextureImageUnits ( ) ; }
# ifndef MAGNUM_TARGET_GLES
@ -160,7 +114,7 @@ void AbstractTexture::bind(Int layer) {
/* If already bound in given layer, nothing to do */
if ( textureState - > bindings [ layer ] = = _id ) return ;
( this - > * bindImplementation ) ( layer ) ;
( this - > * Context : : current ( ) - > state ( ) . texture - > bindImplementation ) ( layer ) ;
}
void AbstractTexture : : bindImplementationDefault ( GLint layer ) {
@ -185,16 +139,39 @@ AbstractTexture& AbstractTexture::setMinificationFilter(Sampler::Filter filter,
CORRADE_ASSERT ( _target ! = GL_TEXTURE_RECTANGLE | | mipmap = = Sampler : : Mipmap : : Base , " AbstractTexture: rectangle textures cannot have mipmaps " , * this ) ;
# endif
( this - > * parameteriImplementation ) ( GL_TEXTURE_MIN_FILTER , GLint ( filter ) | GLint ( mipmap ) ) ;
( this - > * Context : : current ( ) - > state ( ) . texture - > parameteriImplementation ) ( GL_TEXTURE_MIN_FILTER , GLint ( filter ) | GLint ( mipmap ) ) ;
return * this ;
}
AbstractTexture & AbstractTexture : : setMagnificationFilter ( const Sampler : : Filter filter ) {
( this - > * Context : : current ( ) - > state ( ) . texture - > parameteriImplementation ) ( GL_TEXTURE_MAG_FILTER , GLint ( filter ) ) ;
return * this ;
}
AbstractTexture & AbstractTexture : : setBorderColor ( const Color4 & color ) {
# ifndef MAGNUM_TARGET_GLES
( this - > * Context : : current ( ) - > state ( ) . texture - > parameterfvImplementation ) ( GL_TEXTURE_BORDER_COLOR , color . data ( ) ) ;
# else
( this - > * Context : : current ( ) - > state ( ) . texture - > parameterfvImplementation ) ( GL_TEXTURE_BORDER_COLOR_NV , color . data ( ) ) ;
# endif
return * this ;
}
AbstractTexture & AbstractTexture : : setMaxAnisotropy ( const Float anisotropy ) {
( this - > * Context : : current ( ) - > state ( ) . texture - > setMaxAnisotropyImplementation ) ( anisotropy ) ;
return * this ;
}
void AbstractTexture : : invalidateImage ( const Int level ) {
( this - > * Context : : current ( ) - > state ( ) . texture - > invalidateImageImplementation ) ( level ) ;
}
AbstractTexture & AbstractTexture : : generateMipmap ( ) {
# ifndef MAGNUM_TARGET_GLES
CORRADE_ASSERT ( _target ! = GL_TEXTURE_RECTANGLE , " AbstractTexture: rectangle textures cannot have mipmaps " , * this ) ;
# endif
( this - > * mipmapImplementation ) ( ) ;
( this - > * Context : : current ( ) - > state ( ) . texture - > mipmapImplementation ) ( ) ;
return * this ;
}
@ -226,65 +203,6 @@ void AbstractTexture::bindInternal() {
glBindTexture ( _target , ( textureState - > bindings [ internalLayer ] = _id ) ) ;
}
void AbstractTexture : : initializeContextBasedFunctionality ( Context & context ) {
/* Resize bindings array to hold all possible layers */
context . state ( ) . texture - > bindings . resize ( maxLayers ( ) ) ;
# ifndef MAGNUM_TARGET_GLES
if ( context . isExtensionSupported < Extensions : : GL : : EXT : : direct_state_access > ( ) ) {
Debug ( ) < < " AbstractTexture: using " < < Extensions : : GL : : EXT : : direct_state_access : : string ( ) < < " features " ;
bindImplementation = & AbstractTexture : : bindImplementationDSA ;
parameteriImplementation = & AbstractTexture : : parameterImplementationDSA ;
parameterfImplementation = & AbstractTexture : : parameterImplementationDSA ;
parameterfvImplementation = & AbstractTexture : : parameterImplementationDSA ;
getLevelParameterivImplementation = & AbstractTexture : : getLevelParameterImplementationDSA ;
mipmapImplementation = & AbstractTexture : : mipmapImplementationDSA ;
getImageImplementation = & AbstractTexture : : getImageImplementationDSA ;
image1DImplementation = & AbstractTexture : : imageImplementationDSA ;
image2DImplementation = & AbstractTexture : : imageImplementationDSA ;
image3DImplementation = & AbstractTexture : : imageImplementationDSA ;
subImage1DImplementation = & AbstractTexture : : subImageImplementationDSA ;
subImage2DImplementation = & AbstractTexture : : subImageImplementationDSA ;
subImage3DImplementation = & AbstractTexture : : subImageImplementationDSA ;
}
if ( context . isExtensionSupported < Extensions : : GL : : ARB : : invalidate_subdata > ( ) ) {
Debug ( ) < < " AbstractTexture: using " < < Extensions : : GL : : ARB : : invalidate_subdata : : string ( ) < < " features " ;
invalidateImageImplementation = & AbstractTexture : : invalidateImageImplementationARB ;
invalidateSubImageImplementation = & AbstractTexture : : invalidateSubImageImplementationARB ;
}
if ( context . isExtensionSupported < Extensions : : GL : : ARB : : robustness > ( ) & &
! context . isExtensionSupported < Extensions : : GL : : EXT : : direct_state_access > ( ) ) {
Debug ( ) < < " AbstractTexture: using " < < Extensions : : GL : : ARB : : robustness : : string ( ) < < " features " ;
getImageImplementation = & AbstractTexture : : getImageImplementationRobustness ;
}
if ( context . isExtensionSupported < Extensions : : GL : : ARB : : texture_storage > ( ) ) {
Debug ( ) < < " AbstractTexture: using " < < Extensions : : GL : : ARB : : texture_storage : : string ( ) < < " features " ;
if ( context . isExtensionSupported < Extensions : : GL : : EXT : : direct_state_access > ( ) ) {
storage1DImplementation = & AbstractTexture : : storageImplementationDSA ;
storage2DImplementation = & AbstractTexture : : storageImplementationDSA ;
storage3DImplementation = & AbstractTexture : : storageImplementationDSA ;
} else {
storage1DImplementation = & AbstractTexture : : storageImplementationDefault ;
storage2DImplementation = & AbstractTexture : : storageImplementationDefault ;
storage3DImplementation = & AbstractTexture : : storageImplementationDefault ;
}
}
# endif
if ( context . isExtensionSupported < Extensions : : GL : : EXT : : texture_filter_anisotropic > ( ) ) {
Debug ( ) < < " AbstractTexture: using " < < Extensions : : GL : : EXT : : texture_filter_anisotropic : : string ( ) < < " features " ;
setMaxAnisotropyImplementation = & AbstractTexture : : setMaxAnisotropyImplementationExt ;
}
}
ColorFormat AbstractTexture : : imageFormatForInternalFormat ( const TextureFormat internalFormat ) {
switch ( internalFormat ) {
case TextureFormat : : Red :
@ -690,7 +608,7 @@ void AbstractTexture::parameterImplementationDSA(GLenum parameter, const GLfloat
void AbstractTexture : : setMaxAnisotropyImplementationNoOp ( GLfloat ) { }
void AbstractTexture : : setMaxAnisotropyImplementationExt ( GLfloat anisotropy ) {
( this - > * parameterfImplementation ) ( GL_TEXTURE_MAX_ANISOTROPY_EXT , anisotropy ) ;
( this - > * Context : : current ( ) - > state ( ) . texture - > parameterfImplementation ) ( GL_TEXTURE_MAX_ANISOTROPY_EXT , anisotropy ) ;
}
# ifndef MAGNUM_TARGET_GLES
@ -712,7 +630,7 @@ void AbstractTexture::storageImplementationFallback(const GLenum target, const G
const ColorType type = imageTypeForInternalFormat ( internalFormat ) ;
for ( GLsizei level = 0 ; level ! = levels ; + + level ) {
( this - > * image1DImplementation ) ( target , level , internalFormat , Math : : max ( Math : : Vector < 1 , GLsizei > ( 1 ) , size > > level ) , format , type , nullptr ) ;
( this - > * Context : : current ( ) - > state ( ) . texture - > image1DImplementation ) ( target , level , internalFormat , Math : : max ( Math : : Vector < 1 , GLsizei > ( 1 ) , size > > level ) , format , type , nullptr ) ;
}
}
@ -748,7 +666,7 @@ void AbstractTexture::storageImplementationFallback(const GLenum target, const G
# endif
{
for ( GLsizei level = 0 ; level ! = levels ; + + level ) {
( this - > * image2DImplementation ) ( target , level , internalFormat , Math : : max ( Vector2i ( 1 ) , size > > level ) , format , type , nullptr ) ;
( this - > * Context : : current ( ) - > state ( ) . texture - > image2DImplementation ) ( target , level , internalFormat , Math : : max ( Vector2i ( 1 ) , size > > level ) , format , type , nullptr ) ;
}
/* Cube map additionally needs to specify all faces */
@ -760,14 +678,14 @@ void AbstractTexture::storageImplementationFallback(const GLenum target, const G
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y ,
GL_TEXTURE_CUBE_MAP_POSITIVE_Z ,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z } )
( this - > * image2DImplementation ) ( face , level , internalFormat , Math : : max ( Vector2i ( 1 ) , size > > level ) , format , type , nullptr ) ;
( this - > * Context : : current ( ) - > state ( ) . texture - > image2DImplementation ) ( face , level , internalFormat , Math : : max ( Vector2i ( 1 ) , size > > level ) , format , type , nullptr ) ;
}
# ifndef MAGNUM_TARGET_GLES
/* Array texture is not scaled in "layer" dimension */
} else if ( target = = GL_TEXTURE_1D_ARRAY ) {
for ( GLsizei level = 0 ; level ! = levels ; + + level ) {
( this - > * image2DImplementation ) ( target , level , internalFormat , Math : : max ( Vector2i ( 1 ) , size > > level ) , format , type , nullptr ) ;
( this - > * Context : : current ( ) - > state ( ) . texture - > image2DImplementation ) ( target , level , internalFormat , Math : : max ( Vector2i ( 1 ) , size > > level ) , format , type , nullptr ) ;
}
# endif
@ -808,7 +726,7 @@ void AbstractTexture::storageImplementationFallback(GLenum target, GLsizei level
# endif
{
for ( GLsizei level = 0 ; level ! = levels ; + + level ) {
( this - > * image3DImplementation ) ( target , level , internalFormat , Math : : max ( Vector3i ( 1 ) , size > > level ) , format , type , nullptr ) ;
( this - > * Context : : current ( ) - > state ( ) . texture - > image3DImplementation ) ( target , level , internalFormat , Math : : max ( Vector3i ( 1 ) , size > > level ) , format , type , nullptr ) ;
}
# ifndef MAGNUM_TARGET_GLES2
@ -821,7 +739,7 @@ void AbstractTexture::storageImplementationFallback(GLenum target, GLsizei level
# endif
{
for ( GLsizei level = 0 ; level ! = levels ; + + level ) {
( this - > * image3DImplementation ) ( target , level , internalFormat , Math : : max ( Vector3i ( 1 ) , size > > level ) , format , type , nullptr ) ;
( this - > * Context : : current ( ) - > state ( ) . texture - > image3DImplementation ) ( target , level , internalFormat , Math : : max ( Vector3i ( 1 ) , size > > level ) , format , type , nullptr ) ;
}
# endif
@ -991,7 +909,7 @@ template<UnsignedInt dimensions> void AbstractTexture::image(GLenum target, GLin
const Math : : Vector < dimensions , Int > size = DataHelper < dimensions > : : imageSize ( this , target , level ) ;
const std : : size_t dataSize = size . product ( ) * image . pixelSize ( ) ;
char * data = new char [ dataSize ] ;
( this - > * getImageImplementation ) ( target , level , image . format ( ) , image . type ( ) , dataSize , data ) ;
( this - > * Context : : current ( ) - > state ( ) . texture - > getImageImplementation ) ( target , level , image . format ( ) , image . type ( ) , dataSize , data ) ;
image . setData ( image . format ( ) , image . type ( ) , size , data ) ;
}
@ -1006,7 +924,7 @@ template<UnsignedInt dimensions> void AbstractTexture::image(GLenum target, GLin
image . setData ( image . format ( ) , image . type ( ) , size , nullptr , usage ) ;
image . buffer ( ) . bind ( Buffer : : Target : : PixelPack ) ;
( this - > * getImageImplementation ) ( target , level , image . format ( ) , image . type ( ) , dataSize , nullptr ) ;
( this - > * Context : : current ( ) - > state ( ) . texture - > getImageImplementation ) ( target , level , image . format ( ) , image . type ( ) , dataSize , nullptr ) ;
}
template void MAGNUM_EXPORT AbstractTexture : : image < 1 > ( GLenum , GLint , BufferImage < 1 > & , BufferUsage ) ;
@ -1019,45 +937,63 @@ template void MAGNUM_EXPORT AbstractTexture::image<3>(GLenum, GLint, BufferImage
# ifndef MAGNUM_TARGET_GLES
Math : : Vector < 1 , GLint > AbstractTexture : : DataHelper < 1 > : : imageSize ( AbstractTexture * texture , GLenum target , GLint level ) {
Math : : Vector < 1 , GLint > value ;
( texture - > * getLevelParameterivImplementation ) ( target , level , GL_TEXTURE_WIDTH , & value [ 0 ] ) ;
( texture - > * Context : : current ( ) - > state ( ) . texture - > getLevelParameterivImplementation ) ( target , level , GL_TEXTURE_WIDTH , & value [ 0 ] ) ;
return value ;
}
Vector2i AbstractTexture : : DataHelper < 2 > : : imageSize ( AbstractTexture * texture , GLenum target , GLint level ) {
const Implementation : : TextureState & state = * Context : : current ( ) - > state ( ) . texture ;
Vector2i value ;
( texture - > * getLevelParameterivImplementation ) ( target , level , GL_TEXTURE_WIDTH , & value [ 0 ] ) ;
( texture - > * getLevelParameterivImplementation ) ( target , level , GL_TEXTURE_HEIGHT , & value [ 1 ] ) ;
( texture - > * state . getLevelParameterivImplementation ) ( target , level , GL_TEXTURE_WIDTH , & value [ 0 ] ) ;
( texture - > * state . getLevelParameterivImplementation ) ( target , level , GL_TEXTURE_HEIGHT , & value [ 1 ] ) ;
return value ;
}
Vector3i AbstractTexture : : DataHelper < 3 > : : imageSize ( AbstractTexture * texture , GLenum target , GLint level ) {
const Implementation : : TextureState & state = * Context : : current ( ) - > state ( ) . texture ;
Vector3i value ;
( texture - > * getLevelParameterivImplementation ) ( target , level , GL_TEXTURE_WIDTH , & value [ 0 ] ) ;
( texture - > * getLevelParameterivImplementation ) ( target , level , GL_TEXTURE_HEIGHT , & value [ 1 ] ) ;
( texture - > * getLevelParameterivImplementation ) ( target , level , GL_TEXTURE_DEPTH , & value [ 2 ] ) ;
( texture - > * state . getLevelParameterivImplementation ) ( target , level , GL_TEXTURE_WIDTH , & value [ 0 ] ) ;
( texture - > * state . getLevelParameterivImplementation ) ( target , level , GL_TEXTURE_HEIGHT , & value [ 1 ] ) ;
( texture - > * state . getLevelParameterivImplementation ) ( target , level , GL_TEXTURE_DEPTH , & value [ 2 ] ) ;
return value ;
}
# endif
# ifndef MAGNUM_TARGET_GLES
void AbstractTexture : : DataHelper < 1 > : : setStorage ( AbstractTexture * const texture , const GLenum target , const GLsizei levels , const TextureFormat internalFormat , const Math : : Vector < 1 , GLsizei > & size ) {
( texture - > * Context : : current ( ) - > state ( ) . texture - > storage1DImplementation ) ( target , levels , internalFormat , size ) ;
}
# endif
void AbstractTexture : : DataHelper < 2 > : : setStorage ( AbstractTexture * const texture , const GLenum target , const GLsizei levels , const TextureFormat internalFormat , const Vector2i & size ) {
( texture - > * Context : : current ( ) - > state ( ) . texture - > storage2DImplementation ) ( target , levels , internalFormat , size ) ;
}
void AbstractTexture : : DataHelper < 3 > : : setStorage ( AbstractTexture * const texture , const GLenum target , const GLsizei levels , const TextureFormat internalFormat , const Vector3i & size ) {
( texture - > * Context : : current ( ) - > state ( ) . texture - > storage3DImplementation ) ( target , levels , internalFormat , size ) ;
}
# ifndef MAGNUM_TARGET_GLES
void AbstractTexture : : DataHelper < 1 > : : setImage ( AbstractTexture * const texture , const GLenum target , const GLint level , const TextureFormat internalFormat , const ImageReference1D & image ) {
Buffer : : unbind ( Buffer : : Target : : PixelUnpack ) ;
( texture - > * image1DImplementation ) ( target , level , internalFormat , image . size ( ) , image . format ( ) , image . type ( ) , image . data ( ) ) ;
( texture - > * Context : : current ( ) - > state ( ) . texture - > image1DImplementation ) ( target , level , internalFormat , image . size ( ) , image . format ( ) , image . type ( ) , image . data ( ) ) ;
}
void AbstractTexture : : DataHelper < 1 > : : setImage ( AbstractTexture * const texture , const GLenum target , const GLint level , const TextureFormat internalFormat , BufferImage1D & image ) {
image . buffer ( ) . bind ( Buffer : : Target : : PixelUnpack ) ;
( texture - > * image1DImplementation ) ( target , level , internalFormat , image . size ( ) , image . format ( ) , image . type ( ) , nullptr ) ;
( texture - > * Context : : current ( ) - > state ( ) . texture - > image1DImplementation ) ( target , level , internalFormat , image . size ( ) , image . format ( ) , image . type ( ) , nullptr ) ;
}
void AbstractTexture : : DataHelper < 1 > : : setSubImage ( AbstractTexture * const texture , const GLenum target , const GLint level , const Math : : Vector < 1 , GLint > & offset , const ImageReference1D & image ) {
Buffer : : unbind ( Buffer : : Target : : PixelUnpack ) ;
( texture - > * subImage1DImplementation ) ( target , level , offset , image . size ( ) , image . format ( ) , image . type ( ) , image . data ( ) ) ;
( texture - > * Context : : current ( ) - > state ( ) . texture - > subImage1DImplementation ) ( target , level , offset , image . size ( ) , image . format ( ) , image . type ( ) , image . data ( ) ) ;
}
void AbstractTexture : : DataHelper < 1 > : : setSubImage ( AbstractTexture * const texture , const GLenum target , const GLint level , const Math : : Vector < 1 , GLint > & offset , BufferImage1D & image ) {
image . buffer ( ) . bind ( Buffer : : Target : : PixelUnpack ) ;
( texture - > * subImage1DImplementation ) ( target , level , offset , image . size ( ) , image . format ( ) , image . type ( ) , nullptr ) ;
( texture - > * Context : : current ( ) - > state ( ) . texture - > subImage1DImplementation ) ( target , level , offset , image . size ( ) , image . format ( ) , image . type ( ) , nullptr ) ;
}
# endif
@ -1065,13 +1001,13 @@ void AbstractTexture::DataHelper<2>::setImage(AbstractTexture* const texture, co
# ifndef MAGNUM_TARGET_GLES2
Buffer : : unbind ( Buffer : : Target : : PixelUnpack ) ;
# endif
( texture - > * image2DImplementation ) ( target , level , internalFormat , image . size ( ) , image . format ( ) , image . type ( ) , image . data ( ) ) ;
( texture - > * Context : : current ( ) - > state ( ) . texture - > image2DImplementation ) ( target , level , internalFormat , image . size ( ) , image . format ( ) , image . type ( ) , image . data ( ) ) ;
}
# ifndef MAGNUM_TARGET_GLES2
void AbstractTexture : : DataHelper < 2 > : : setImage ( AbstractTexture * const texture , const GLenum target , const GLint level , const TextureFormat internalFormat , BufferImage2D & image ) {
image . buffer ( ) . bind ( Buffer : : Target : : PixelUnpack ) ;
( texture - > * image2DImplementation ) ( target , level , internalFormat , image . size ( ) , image . format ( ) , image . type ( ) , nullptr ) ;
( texture - > * Context : : current ( ) - > state ( ) . texture - > image2DImplementation ) ( target , level , internalFormat , image . size ( ) , image . format ( ) , image . type ( ) , nullptr ) ;
}
# endif
@ -1079,13 +1015,13 @@ void AbstractTexture::DataHelper<2>::setSubImage(AbstractTexture* const texture,
# ifndef MAGNUM_TARGET_GLES2
Buffer : : unbind ( Buffer : : Target : : PixelUnpack ) ;
# endif
( texture - > * subImage2DImplementation ) ( target , level , offset , image . size ( ) , image . format ( ) , image . type ( ) , image . data ( ) ) ;
( texture - > * Context : : current ( ) - > state ( ) . texture - > subImage2DImplementation ) ( target , level , offset , image . size ( ) , image . format ( ) , image . type ( ) , image . data ( ) ) ;
}
# ifndef MAGNUM_TARGET_GLES2
void AbstractTexture : : DataHelper < 2 > : : setSubImage ( AbstractTexture * const texture , const GLenum target , const GLint level , const Vector2i & offset , BufferImage2D & image ) {
image . buffer ( ) . bind ( Buffer : : Target : : PixelUnpack ) ;
( texture - > * subImage2DImplementation ) ( target , level , offset , image . size ( ) , image . format ( ) , image . type ( ) , nullptr ) ;
( texture - > * Context : : current ( ) - > state ( ) . texture - > subImage2DImplementation ) ( target , level , offset , image . size ( ) , image . format ( ) , image . type ( ) , nullptr ) ;
}
# endif
@ -1093,13 +1029,13 @@ void AbstractTexture::DataHelper<3>::setImage(AbstractTexture* const texture, co
# ifndef MAGNUM_TARGET_GLES2
Buffer : : unbind ( Buffer : : Target : : PixelUnpack ) ;
# endif
( texture - > * image3DImplementation ) ( target , level , internalFormat , image . size ( ) , image . format ( ) , image . type ( ) , image . data ( ) ) ;
( texture - > * Context : : current ( ) - > state ( ) . texture - > image3DImplementation ) ( target , level , internalFormat , image . size ( ) , image . format ( ) , image . type ( ) , image . data ( ) ) ;
}
# ifndef MAGNUM_TARGET_GLES2
void AbstractTexture : : DataHelper < 3 > : : setImage ( AbstractTexture * const texture , const GLenum target , const GLint level , const TextureFormat internalFormat , BufferImage3D & image ) {
image . buffer ( ) . bind ( Buffer : : Target : : PixelUnpack ) ;
( texture - > * image3DImplementation ) ( target , level , internalFormat , image . size ( ) , image . format ( ) , image . type ( ) , nullptr ) ;
( texture - > * Context : : current ( ) - > state ( ) . texture - > image3DImplementation ) ( target , level , internalFormat , image . size ( ) , image . format ( ) , image . type ( ) , nullptr ) ;
}
# endif
@ -1107,13 +1043,33 @@ void AbstractTexture::DataHelper<3>::setSubImage(AbstractTexture* const texture,
# ifndef MAGNUM_TARGET_GLES2
Buffer : : unbind ( Buffer : : Target : : PixelUnpack ) ;
# endif
( texture - > * subImage3DImplementation ) ( target , level , offset , image . size ( ) , image . format ( ) , image . type ( ) , image . data ( ) ) ;
( texture - > * Context : : current ( ) - > state ( ) . texture - > subImage3DImplementation ) ( target , level , offset , image . size ( ) , image . format ( ) , image . type ( ) , image . data ( ) ) ;
}
# ifndef MAGNUM_TARGET_GLES2
void AbstractTexture : : DataHelper < 3 > : : setSubImage ( AbstractTexture * const texture , const GLenum target , const GLint level , const Vector3i & offset , BufferImage3D & image ) {
image . buffer ( ) . bind ( Buffer : : Target : : PixelUnpack ) ;
( texture - > * subImage3DImplementation ) ( target , level , offset , image . size ( ) , image . format ( ) , image . type ( ) , nullptr ) ;
( texture - > * Context : : current ( ) - > state ( ) . texture - > subImage3DImplementation ) ( target , level , offset , image . size ( ) , image . format ( ) , image . type ( ) , nullptr ) ;
}
# endif
# ifndef MAGNUM_TARGET_GLES
void AbstractTexture : : DataHelper < 1 > : : invalidateSubImage ( AbstractTexture * const texture , const GLint level , const Math : : Vector < 1 , GLint > & offset , const Math : : Vector < 1 , GLint > & size ) {
( texture - > * Context : : current ( ) - > state ( ) . texture - > invalidateSubImageImplementation ) ( level , { offset [ 0 ] , 0 , 0 } , { size [ 0 ] , 1 , 1 } ) ;
}
# endif
void AbstractTexture : : DataHelper < 2 > : : invalidateSubImage ( AbstractTexture * const texture , const GLint level , const Vector2i & offset , const Vector2i & size ) {
( texture - > * Context : : current ( ) - > state ( ) . texture - > invalidateSubImageImplementation ) ( level , { offset , 0 } , { size , 1 } ) ;
}
void AbstractTexture : : DataHelper < 3 > : : invalidateSubImage ( AbstractTexture * const texture , const GLint level , const Vector3i & offset , const Vector3i & size ) {
( texture - > * Context : : current ( ) - > state ( ) . texture - > invalidateSubImageImplementation ) ( level , offset , size ) ;
}
# ifndef MAGNUM_TARGET_GLES
void AbstractTexture : : DataHelper < 1 > : : setWrapping ( AbstractTexture * const texture , const Array1D < Sampler : : Wrapping > & wrapping ) {
( texture - > * Context : : current ( ) - > state ( ) . texture - > parameteriImplementation ) ( GL_TEXTURE_WRAP_S , GLint ( wrapping . x ( ) ) ) ;
}
# endif
@ -1122,15 +1078,19 @@ void AbstractTexture::DataHelper<2>::setWrapping(AbstractTexture* texture, const
CORRADE_ASSERT ( texture - > _target ! = GL_TEXTURE_RECTANGLE | | ( ( wrapping . x ( ) = = Sampler : : Wrapping : : ClampToEdge | | wrapping . x ( ) = = Sampler : : Wrapping : : ClampToBorder ) & & ( wrapping . y ( ) = = Sampler : : Wrapping : : ClampToEdge | | wrapping . y ( ) = = Sampler : : Wrapping : : ClampToBorder ) ) , " Texture2D::setWrapping(): rectangle texture must be clamped to border or to edge " , ) ;
# endif
( texture - > * parameteriImplementation ) ( GL_TEXTURE_WRAP_S , GLint ( wrapping . x ( ) ) ) ;
( texture - > * parameteriImplementation ) ( GL_TEXTURE_WRAP_T , GLint ( wrapping . y ( ) ) ) ;
const Implementation : : TextureState & state = * Context : : current ( ) - > state ( ) . texture ;
( texture - > * state . parameteriImplementation ) ( GL_TEXTURE_WRAP_S , GLint ( wrapping . x ( ) ) ) ;
( texture - > * state . parameteriImplementation ) ( GL_TEXTURE_WRAP_T , GLint ( wrapping . y ( ) ) ) ;
}
void AbstractTexture : : DataHelper < 3 > : : setWrapping ( AbstractTexture * texture , const Array3D < Sampler : : Wrapping > & wrapping ) {
( texture - > * parameteriImplementation ) ( GL_TEXTURE_WRAP_S , GLint ( wrapping . x ( ) ) ) ;
( texture - > * parameteriImplementation ) ( GL_TEXTURE_WRAP_T , GLint ( wrapping . y ( ) ) ) ;
const Implementation : : TextureState & state = * Context : : current ( ) - > state ( ) . texture ;
( texture - > * state . parameteriImplementation ) ( GL_TEXTURE_WRAP_S , GLint ( wrapping . x ( ) ) ) ;
( texture - > * state . parameteriImplementation ) ( GL_TEXTURE_WRAP_T , GLint ( wrapping . y ( ) ) ) ;
# ifndef MAGNUM_TARGET_GLES
( texture - > * parameteriImplementation ) ( GL_TEXTURE_WRAP_R , GLint ( wrapping . z ( ) ) ) ;
( texture - > * state . parameteriImplementation ) ( GL_TEXTURE_WRAP_R , GLint ( wrapping . z ( ) ) ) ;
# endif
}
# endif