mirror of https://github.com/mosra/magnum.git
21 changed files with 553 additions and 23 deletions
@ -0,0 +1,36 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013, 2014 |
||||
Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "CubeMapTexture.h" |
||||
|
||||
#include "Implementation/maxTextureSize.h" |
||||
|
||||
namespace Magnum { |
||||
|
||||
Vector2i CubeMapTexture::maxSize() { |
||||
return Vector2i{Implementation::maxCubeMapTextureSideSize()}; |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,45 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013, 2014 |
||||
Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "CubeMapTextureArray.h" |
||||
|
||||
#ifndef MAGNUM_TARGET_GLES |
||||
#include "Magnum/Context.h" |
||||
#include "Magnum/Extensions.h" |
||||
|
||||
#include "Implementation/maxTextureSize.h" |
||||
|
||||
namespace Magnum { |
||||
|
||||
Vector3i CubeMapTextureArray::maxSize() { |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_cube_map_array>()) |
||||
return {}; |
||||
|
||||
return Vector3i{Vector2i{Implementation::maxCubeMapTextureSideSize()}, |
||||
Implementation::maxTextureArrayLayers()}; |
||||
} |
||||
|
||||
} |
||||
#endif |
||||
@ -0,0 +1,77 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013, 2014 |
||||
Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "maxTextureSize.h" |
||||
|
||||
#include "Magnum/Context.h" |
||||
|
||||
#include "State.h" |
||||
#include "TextureState.h" |
||||
|
||||
namespace Magnum { namespace Implementation { |
||||
|
||||
GLint maxTextureSideSize() { |
||||
GLint& value = Context::current()->state().texture->maxSize; |
||||
|
||||
if(value == 0) |
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &value); |
||||
|
||||
return value; |
||||
} |
||||
|
||||
GLint max3DTextureDepth() { |
||||
GLint& value = Context::current()->state().texture->max3DSize; |
||||
|
||||
if(value == 0) |
||||
#ifndef MAGNUM_TARGET_GLES2 |
||||
glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &value); |
||||
#else |
||||
glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE_OES, &value); |
||||
#endif |
||||
|
||||
return value; |
||||
} |
||||
|
||||
#ifndef MAGNUM_TARGET_GLES2 |
||||
GLint maxTextureArrayLayers() { |
||||
GLint& value = Context::current()->state().texture->maxArrayLayers; |
||||
|
||||
if(value == 0) |
||||
glGetIntegerv(GL_MAX_ARRAY_TEXTURE_LAYERS, &value); |
||||
|
||||
return value; |
||||
} |
||||
#endif |
||||
|
||||
GLint maxCubeMapTextureSideSize() { |
||||
GLint& value = Context::current()->state().texture->maxCubeMapSize; |
||||
|
||||
if(value == 0) |
||||
glGetIntegerv(GL_MAX_CUBE_MAP_TEXTURE_SIZE, &value); |
||||
|
||||
return value; |
||||
} |
||||
|
||||
}} |
||||
@ -0,0 +1,39 @@
|
||||
#ifndef Magnum_Implementation_maxTextureSize_h |
||||
#define Magnum_Implementation_maxTextureSize_h |
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013, 2014 |
||||
Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "Magnum/OpenGL.h" |
||||
|
||||
namespace Magnum { namespace Implementation { |
||||
|
||||
GLint maxTextureSideSize(); |
||||
GLint max3DTextureDepth(); |
||||
GLint maxTextureArrayLayers(); |
||||
GLint maxCubeMapTextureSideSize(); |
||||
|
||||
}} |
||||
|
||||
#endif |
||||
@ -0,0 +1,51 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013, 2014 |
||||
Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "MultisampleTexture.h" |
||||
|
||||
#ifndef MAGNUM_TARGET_GLES |
||||
#include "Magnum/Context.h" |
||||
#include "Magnum/Extensions.h" |
||||
|
||||
#include "Implementation/maxTextureSize.h" |
||||
|
||||
namespace Magnum { namespace Implementation { |
||||
|
||||
template<> Vector2i MAGNUM_EXPORT maxMultisampleTextureSize<2>() { |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>()) |
||||
return {}; |
||||
|
||||
return Vector2i{Implementation::maxTextureSideSize()}; |
||||
} |
||||
|
||||
template<> Vector3i MAGNUM_EXPORT maxMultisampleTextureSize<3>() { |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_multisample>()) |
||||
return {}; |
||||
|
||||
return {Vector2i{Implementation::maxTextureSideSize()}, Implementation::max3DTextureDepth()}; |
||||
} |
||||
|
||||
}} |
||||
#endif |
||||
@ -0,0 +1,50 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013, 2014 |
||||
Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "RectangleTexture.h" |
||||
|
||||
#ifndef MAGNUM_TARGET_GLES |
||||
#include "Magnum/Context.h" |
||||
#include "Magnum/Extensions.h" |
||||
|
||||
#include "Implementation/State.h" |
||||
#include "Implementation/TextureState.h" |
||||
|
||||
namespace Magnum { |
||||
|
||||
Vector2i RectangleTexture::maxSize() { |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::ARB::texture_rectangle>()) |
||||
return {}; |
||||
|
||||
GLint& value = Context::current()->state().texture->maxRectangleSize; |
||||
|
||||
if(value == 0) |
||||
glGetIntegerv(GL_MAX_RECTANGLE_TEXTURE_SIZE, &value); |
||||
|
||||
return Vector2i{value}; |
||||
} |
||||
|
||||
} |
||||
#endif |
||||
@ -0,0 +1,54 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013, 2014 |
||||
Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "Texture.h" |
||||
|
||||
#include "Magnum/Context.h" |
||||
#include "Magnum/Extensions.h" |
||||
|
||||
#include "Implementation/maxTextureSize.h" |
||||
#include "Implementation/State.h" |
||||
#include "Implementation/TextureState.h" |
||||
|
||||
namespace Magnum { namespace Implementation { |
||||
|
||||
template<UnsignedInt dimensions> typename DimensionTraits<dimensions, Int>::VectorType maxTextureSize() { |
||||
return typename DimensionTraits<dimensions, Int>::VectorType{Implementation::maxTextureSideSize()}; |
||||
} |
||||
|
||||
#ifndef MAGNUM_TARGET_GLES |
||||
template MAGNUM_EXPORT Math::Vector<1, Int> maxTextureSize<1>(); |
||||
#endif |
||||
template MAGNUM_EXPORT Vector2i maxTextureSize<2>(); |
||||
|
||||
template<> MAGNUM_EXPORT Vector3i maxTextureSize<3>() { |
||||
#ifdef MAGNUM_TARGET_GLES2 |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::OES::texture_3D>()) |
||||
return {}; |
||||
#endif |
||||
return {Vector2i(Implementation::maxTextureSideSize()), Implementation::max3DTextureDepth()}; |
||||
} |
||||
|
||||
}} |
||||
@ -0,0 +1,58 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013, 2014 |
||||
Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "TextureArray.h" |
||||
|
||||
#ifndef MAGNUM_TARGET_GLES2 |
||||
#include "Magnum/Context.h" |
||||
#include "Magnum/Extensions.h" |
||||
|
||||
#include "Implementation/maxTextureSize.h" |
||||
|
||||
namespace Magnum { |
||||
|
||||
namespace { |
||||
template<UnsignedInt> struct VectorOrScalar; |
||||
template<> struct VectorOrScalar<1> { typedef Int Type; }; |
||||
template<> struct VectorOrScalar<2> { typedef Vector2i Type; }; |
||||
} |
||||
|
||||
template<UnsignedInt dimensions> typename DimensionTraits<dimensions+1, Int>::VectorType TextureArray<dimensions>::maxSize() { |
||||
#ifndef MAGNUM_TARGET_GLES |
||||
if(!Context::current()->isExtensionSupported<Extensions::GL::EXT::texture_array>()) |
||||
return {}; |
||||
#endif |
||||
|
||||
return {typename VectorOrScalar<dimensions>::Type{Implementation::maxTextureSideSize()}, |
||||
Implementation::maxTextureArrayLayers()}; |
||||
} |
||||
|
||||
#ifndef MAGNUM_TARGET_GLES |
||||
template class MAGNUM_EXPORT TextureArray<1>; |
||||
#endif |
||||
template class MAGNUM_EXPORT TextureArray<2>; |
||||
|
||||
} |
||||
#endif |
||||
Loading…
Reference in new issue