Browse Source

Extracted CubeMapTexture::Coordinate enum into CubeMapCoordinate.

Allows to break the dependency on the <Magnum/CubeMapTexture.h> header
in Framebuffer, TextureState and elsewhere. The old
CubeMapTexture::Coordinate enum is now just an alias, is marked as
deprecated and will be removed in a future release.
pull/141/head
Vladimír Vondruš 10 years ago
parent
commit
01e0292361
  1. 52
      src/Magnum/CubeMapTexture.cpp
  2. 116
      src/Magnum/CubeMapTexture.h
  3. 3
      src/Magnum/Framebuffer.cpp
  4. 6
      src/Magnum/Framebuffer.h
  5. 1
      src/Magnum/Implementation/TextureState.cpp
  6. 12
      src/Magnum/Implementation/TextureState.h
  7. 1
      src/Magnum/Magnum.h
  8. 1
      src/Magnum/Platform/magnum-info.cpp
  9. 144
      src/Magnum/Test/CubeMapTextureGLTest.cpp
  10. 11
      src/Magnum/Test/FramebufferGLTest.cpp

52
src/Magnum/CubeMapTexture.cpp

@ -157,7 +157,7 @@ CompressedBufferImage3D CubeMapTexture::compressedImage(const Int level, Compres
return std::move(image);
}
void CubeMapTexture::image(const Coordinate coordinate, const Int level, Image2D& image) {
void CubeMapTexture::image(const CubeMapCoordinate coordinate, const Int level, Image2D& image) {
const Vector2i size = imageSize(level);
const std::size_t dataSize = Implementation::imageDataSizeFor(image, size);
@ -172,12 +172,12 @@ void CubeMapTexture::image(const Coordinate coordinate, const Int level, Image2D
image.setData(image.storage(), image.format(), image.type(), size, std::move(data));
}
Image2D CubeMapTexture::image(const Coordinate coordinate, const Int level, Image2D&& image) {
Image2D CubeMapTexture::image(const CubeMapCoordinate coordinate, const Int level, Image2D&& image) {
this->image(coordinate, level, image);
return std::move(image);
}
void CubeMapTexture::image(const Coordinate coordinate, const Int level, BufferImage2D& image, const BufferUsage usage) {
void CubeMapTexture::image(const CubeMapCoordinate coordinate, const Int level, BufferImage2D& image, const BufferUsage usage) {
const Vector2i size = imageSize(level);
const std::size_t dataSize = Implementation::imageDataSizeFor(image, size);
@ -192,12 +192,12 @@ void CubeMapTexture::image(const Coordinate coordinate, const Int level, BufferI
(this->*Context::current().state().texture->getCubeImageImplementation)(coordinate, level, size, image.format(), image.type(), dataSize, nullptr);
}
BufferImage2D CubeMapTexture::image(const Coordinate coordinate, const Int level, BufferImage2D&& image, const BufferUsage usage) {
BufferImage2D CubeMapTexture::image(const CubeMapCoordinate coordinate, const Int level, BufferImage2D&& image, const BufferUsage usage) {
this->image(coordinate, level, image, usage);
return std::move(image);
}
void CubeMapTexture::compressedImage(const Coordinate coordinate, const Int level, CompressedImage2D& image) {
void CubeMapTexture::compressedImage(const CubeMapCoordinate coordinate, const Int level, CompressedImage2D& image) {
const Vector2i size = imageSize(level);
/* The function returns size of all six faces, divide the result to get size
of one face */
@ -217,12 +217,12 @@ void CubeMapTexture::compressedImage(const Coordinate coordinate, const Int leve
image.setData(image.storage(), CompressedPixelFormat(format), size, std::move(data));
}
CompressedImage2D CubeMapTexture::compressedImage(const Coordinate coordinate, const Int level, CompressedImage2D&& image) {
CompressedImage2D CubeMapTexture::compressedImage(const CubeMapCoordinate coordinate, const Int level, CompressedImage2D&& image) {
compressedImage(coordinate, level, image);
return std::move(image);
}
void CubeMapTexture::compressedImage(const Coordinate coordinate, const Int level, CompressedBufferImage2D& image, const BufferUsage usage) {
void CubeMapTexture::compressedImage(const CubeMapCoordinate coordinate, const Int level, CompressedBufferImage2D& image, const BufferUsage usage) {
const Vector2i size = imageSize(level);
/* The function returns size of all six faces, divide the result to get size
of one face */
@ -242,7 +242,7 @@ void CubeMapTexture::compressedImage(const Coordinate coordinate, const Int leve
(this->*Context::current().state().texture->getCompressedCubeImageImplementation)(coordinate, level, size, dataSize, nullptr);
}
CompressedBufferImage2D CubeMapTexture::compressedImage(const Coordinate coordinate, const Int level, CompressedBufferImage2D&& image, const BufferUsage usage) {
CompressedBufferImage2D CubeMapTexture::compressedImage(const CubeMapCoordinate coordinate, const Int level, CompressedBufferImage2D&& image, const BufferUsage usage) {
compressedImage(coordinate, level, image, usage);
return std::move(image);
}
@ -304,7 +304,7 @@ CubeMapTexture& CubeMapTexture::setCompressedSubImage(const Int level, const Vec
}
#endif
CubeMapTexture& CubeMapTexture::setSubImage(const Coordinate coordinate, const Int level, const Vector2i& offset, const ImageView2D& image) {
CubeMapTexture& CubeMapTexture::setSubImage(const CubeMapCoordinate coordinate, const Int level, const Vector2i& offset, const ImageView2D& image) {
#ifndef MAGNUM_TARGET_GLES2
Buffer::unbindInternal(Buffer::TargetHint::PixelUnpack);
#endif
@ -318,7 +318,7 @@ CubeMapTexture& CubeMapTexture::setSubImage(const Coordinate coordinate, const I
}
#ifndef MAGNUM_TARGET_GLES2
CubeMapTexture& CubeMapTexture::setSubImage(const Coordinate coordinate, const Int level, const Vector2i& offset, BufferImage2D& image) {
CubeMapTexture& CubeMapTexture::setSubImage(const CubeMapCoordinate coordinate, const Int level, const Vector2i& offset, BufferImage2D& image) {
image.buffer().bindInternal(Buffer::TargetHint::PixelUnpack);
image.storage().applyUnpack();
(this->*Context::current().state().texture->cubeSubImageImplementation)(coordinate, level, offset, image.size(), image.format(), image.type(), nullptr);
@ -326,7 +326,7 @@ CubeMapTexture& CubeMapTexture::setSubImage(const Coordinate coordinate, const I
}
#endif
CubeMapTexture& CubeMapTexture::setCompressedSubImage(const Coordinate coordinate, const Int level, const Vector2i& offset, const CompressedImageView2D& image) {
CubeMapTexture& CubeMapTexture::setCompressedSubImage(const CubeMapCoordinate coordinate, const Int level, const Vector2i& offset, const CompressedImageView2D& image) {
#ifndef MAGNUM_TARGET_GLES2
Buffer::unbindInternal(Buffer::TargetHint::PixelUnpack);
#endif
@ -340,7 +340,7 @@ CubeMapTexture& CubeMapTexture::setCompressedSubImage(const Coordinate coordinat
}
#ifndef MAGNUM_TARGET_GLES2
CubeMapTexture& CubeMapTexture::setCompressedSubImage(const Coordinate coordinate, const Int level, const Vector2i& offset, CompressedBufferImage2D& image) {
CubeMapTexture& CubeMapTexture::setCompressedSubImage(const CubeMapCoordinate coordinate, const Int level, const Vector2i& offset, CompressedBufferImage2D& image) {
image.buffer().bindInternal(Buffer::TargetHint::PixelUnpack);
#ifndef MAGNUM_TARGET_GLES
/* Pixel storage is completely ignored for compressed images on ES, no need
@ -440,70 +440,70 @@ void CubeMapTexture::getCompressedImageImplementationDSASingleSliceWorkaround(co
glGetCompressedTextureSubImage(_id, level, 0, 0, face, size.x(), size.y(), 1, dataOffset + dataSize/6, static_cast<char*>(data) + dataSize*face/6);
}
void CubeMapTexture::getImageImplementationDefault(const Coordinate coordinate, const GLint level, const Vector2i&, const PixelFormat format, const PixelType type, std::size_t, GLvoid* const data) {
void CubeMapTexture::getImageImplementationDefault(const CubeMapCoordinate coordinate, const GLint level, const Vector2i&, const PixelFormat format, const PixelType type, std::size_t, GLvoid* const data) {
bindInternal();
glGetTexImage(GLenum(coordinate), level, GLenum(format), GLenum(type), data);
}
void CubeMapTexture::getCompressedImageImplementationDefault(const Coordinate coordinate, const GLint level, const Vector2i&, std::size_t, GLvoid* const data) {
void CubeMapTexture::getCompressedImageImplementationDefault(const CubeMapCoordinate coordinate, const GLint level, const Vector2i&, std::size_t, GLvoid* const data) {
bindInternal();
glGetCompressedTexImage(GLenum(coordinate), level, data);
}
void CubeMapTexture::getImageImplementationDSA(const Coordinate coordinate, const GLint level, const Vector2i& size, const PixelFormat format, const PixelType type, const std::size_t dataSize, GLvoid* const data) {
void CubeMapTexture::getImageImplementationDSA(const CubeMapCoordinate coordinate, const GLint level, const Vector2i& size, const PixelFormat format, const PixelType type, const std::size_t dataSize, GLvoid* const data) {
glGetTextureSubImage(_id, level, 0, 0, GLenum(coordinate) - GL_TEXTURE_CUBE_MAP_POSITIVE_X, size.x(), size.y(), 1, GLenum(format), GLenum(type), dataSize, data);
}
void CubeMapTexture::getCompressedImageImplementationDSA(const Coordinate coordinate, const GLint level, const Vector2i& size, const std::size_t dataSize, GLvoid* const data) {
void CubeMapTexture::getCompressedImageImplementationDSA(const CubeMapCoordinate coordinate, const GLint level, const Vector2i& size, const std::size_t dataSize, GLvoid* const data) {
glGetCompressedTextureSubImage(_id, level, 0, 0, GLenum(coordinate) - GL_TEXTURE_CUBE_MAP_POSITIVE_X, size.x(), size.y(), 1, dataSize, data);
}
void CubeMapTexture::getImageImplementationDSAEXT(const Coordinate coordinate, const GLint level, const Vector2i&, const PixelFormat format, const PixelType type, std::size_t, GLvoid* const data) {
void CubeMapTexture::getImageImplementationDSAEXT(const CubeMapCoordinate coordinate, const GLint level, const Vector2i&, const PixelFormat format, const PixelType type, std::size_t, GLvoid* const data) {
_flags |= ObjectFlag::Created;
glGetTextureImageEXT(_id, GLenum(coordinate), level, GLenum(format), GLenum(type), data);
}
void CubeMapTexture::getCompressedImageImplementationDSAEXT(const Coordinate coordinate, const GLint level, const Vector2i&, std::size_t, GLvoid* const data) {
void CubeMapTexture::getCompressedImageImplementationDSAEXT(const CubeMapCoordinate coordinate, const GLint level, const Vector2i&, std::size_t, GLvoid* const data) {
_flags |= ObjectFlag::Created;
glGetCompressedTextureImageEXT(_id, GLenum(coordinate), level, data);
}
void CubeMapTexture::getImageImplementationRobustness(const Coordinate coordinate, const GLint level, const Vector2i&, const PixelFormat format, const PixelType type, const std::size_t dataSize, GLvoid* const data) {
void CubeMapTexture::getImageImplementationRobustness(const CubeMapCoordinate coordinate, const GLint level, const Vector2i&, const PixelFormat format, const PixelType type, const std::size_t dataSize, GLvoid* const data) {
bindInternal();
glGetnTexImageARB(GLenum(coordinate), level, GLenum(format), GLenum(type), dataSize, data);
}
void CubeMapTexture::getCompressedImageImplementationRobustness(const Coordinate coordinate, const GLint level, const Vector2i&, const std::size_t dataSize, GLvoid* const data) {
void CubeMapTexture::getCompressedImageImplementationRobustness(const CubeMapCoordinate coordinate, const GLint level, const Vector2i&, const std::size_t dataSize, GLvoid* const data) {
bindInternal();
glGetnCompressedTexImageARB(GLenum(coordinate), level, dataSize, data);
}
#endif
void CubeMapTexture::subImageImplementationDefault(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const PixelFormat format, const PixelType type, const GLvoid* const data) {
void CubeMapTexture::subImageImplementationDefault(const CubeMapCoordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const PixelFormat format, const PixelType type, const GLvoid* const data) {
bindInternal();
glTexSubImage2D(GLenum(coordinate), level, offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), data);
}
void CubeMapTexture::compressedSubImageImplementationDefault(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const CompressedPixelFormat format, const GLvoid* const data, const GLsizei dataSize) {
void CubeMapTexture::compressedSubImageImplementationDefault(const CubeMapCoordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const CompressedPixelFormat format, const GLvoid* const data, const GLsizei dataSize) {
bindInternal();
glCompressedTexSubImage2D(GLenum(coordinate), level, offset.x(), offset.y(), size.x(), size.y(), GLenum(format), dataSize, data);
}
#ifndef MAGNUM_TARGET_GLES
void CubeMapTexture::subImageImplementationDSA(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const PixelFormat format, const PixelType type, const GLvoid* const data) {
void CubeMapTexture::subImageImplementationDSA(const CubeMapCoordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const PixelFormat format, const PixelType type, const GLvoid* const data) {
glTextureSubImage3D(_id, level, offset.x(), offset.y(), GLenum(coordinate) - GL_TEXTURE_CUBE_MAP_POSITIVE_X, size.x(), size.y(), 1, GLenum(format), GLenum(type), data);
}
void CubeMapTexture::compressedSubImageImplementationDSA(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const CompressedPixelFormat format, const GLvoid* const data, const GLsizei dataSize) {
void CubeMapTexture::compressedSubImageImplementationDSA(const CubeMapCoordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const CompressedPixelFormat format, const GLvoid* const data, const GLsizei dataSize) {
glCompressedTextureSubImage3D(_id, level, offset.x(), offset.y(), GLenum(coordinate) - GL_TEXTURE_CUBE_MAP_POSITIVE_X, size.x(), size.y(), 1, GLenum(format), dataSize, data);
}
void CubeMapTexture::subImageImplementationDSAEXT(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const PixelFormat format, const PixelType type, const GLvoid* const data) {
void CubeMapTexture::subImageImplementationDSAEXT(const CubeMapCoordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const PixelFormat format, const PixelType type, const GLvoid* const data) {
_flags |= ObjectFlag::Created;
glTextureSubImage2DEXT(_id, GLenum(coordinate), level, offset.x(), offset.y(), size.x(), size.y(), GLenum(format), GLenum(type), data);
}
void CubeMapTexture::compressedSubImageImplementationDSAEXT(const Coordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const CompressedPixelFormat format, const GLvoid* const data, const GLsizei dataSize) {
void CubeMapTexture::compressedSubImageImplementationDSAEXT(const CubeMapCoordinate coordinate, const GLint level, const Vector2i& offset, const Vector2i& size, const CompressedPixelFormat format, const GLvoid* const data, const GLsizei dataSize) {
_flags |= ObjectFlag::Created;
glCompressedTextureSubImage2DEXT(_id, GLenum(coordinate), level, offset.x(), offset.y(), size.x(), size.y(), GLenum(format), dataSize, data);
}

116
src/Magnum/CubeMapTexture.h

@ -26,7 +26,7 @@
*/
/** @file
* @brief Class @ref Magnum::CubeMapTexture
* @brief Class @ref Magnum::CubeMapTexture, enum @ref Magnum::CubeMapCoordinate
*/
#include "Magnum/AbstractTexture.h"
@ -35,6 +35,20 @@
namespace Magnum {
/**
@brief Cube map coordinate
@see @ref CubeMapTexture
*/
enum class CubeMapCoordinate: GLenum {
PositiveX = GL_TEXTURE_CUBE_MAP_POSITIVE_X, /**< +X cube side */
NegativeX = GL_TEXTURE_CUBE_MAP_NEGATIVE_X, /**< -X cube side */
PositiveY = GL_TEXTURE_CUBE_MAP_POSITIVE_Y, /**< +Y cube side */
NegativeY = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, /**< -Y cube side */
PositiveZ = GL_TEXTURE_CUBE_MAP_POSITIVE_Z, /**< +Z cube side */
NegativeZ = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z /**< -Z cube side */
};
/**
@brief Cube map texture
@ -64,8 +78,8 @@ CubeMapTexture texture;
texture.setMagnificationFilter(Sampler::Filter::Linear)
// ...
.setStorage(Math::log2(256)+1, TextureFormat::RGBA8, {256, 256})
.setSubImage(CubeMapTexture::Coordinate::PositiveX, 0, {}, positiveX)
.setSubImage(CubeMapTexture::Coordinate::NegativeX, 0, {}, negativeX)
.setSubImage(CubeMapCoordinate::PositiveX, 0, {}, positiveX)
.setSubImage(CubeMapCoordinate::NegativeX, 0, {}, negativeX)
// ...
@endcode
@ -83,15 +97,13 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
friend Implementation::TextureState;
public:
/** @brief Cube map coordinate */
enum class Coordinate: GLenum {
PositiveX = GL_TEXTURE_CUBE_MAP_POSITIVE_X, /**< +X cube side */
NegativeX = GL_TEXTURE_CUBE_MAP_NEGATIVE_X, /**< -X cube side */
PositiveY = GL_TEXTURE_CUBE_MAP_POSITIVE_Y, /**< +Y cube side */
NegativeY = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, /**< -Y cube side */
PositiveZ = GL_TEXTURE_CUBE_MAP_POSITIVE_Z, /**< +Z cube side */
NegativeZ = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z /**< -Z cube side */
};
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @copybrief CubeMapCoordinate
* @deprecated Use @ref CubeMapCoordinate instead.
*/
typedef CORRADE_DEPRECATED("use CubeMapCoordinate instead") CubeMapCoordinate Coordinate;
#endif
/**
* @brief Max supported size of one side of cube map texture
@ -187,7 +199,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* ES 3.0 and older.
* @requires_gles Shader image load/store is not available in WebGL.
*/
void bindImage(Int imageUnit, Int level, Coordinate coordinate, ImageAccess access, ImageFormat format) {
void bindImage(Int imageUnit, Int level, CubeMapCoordinate coordinate, ImageAccess access, ImageFormat format) {
bindImageInternal(imageUnit, level, false, GLenum(coordinate) - GL_TEXTURE_CUBE_MAP_POSITIVE_X, access, format);
}
@ -505,7 +517,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @copybrief imageSize()
* @deprecated Use @ref imageSize(Int) instead.
*/
CORRADE_DEPRECATED("use imageSize(Int) instead") Vector2i imageSize(Coordinate, Int level) {
CORRADE_DEPRECATED("use imageSize(Int) instead") Vector2i imageSize(CubeMapCoordinate, Int level) {
return imageSize(level);
}
#endif
@ -635,16 +647,16 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @requires_gl Texture image queries are not available in OpenGL ES or
* WebGL. See @ref Framebuffer::read() for possible workaround.
*/
void image(Coordinate coordinate, Int level, Image2D& image);
void image(CubeMapCoordinate coordinate, Int level, Image2D& image);
/** @overload
*
* Convenience alternative to the above, example usage:
* @code
* Image2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte});
* Image2D image = texture.image(CubeMapCoordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte});
* @endcode
*/
Image2D image(Coordinate coordinate, Int level, Image2D&& image);
Image2D image(CubeMapCoordinate coordinate, Int level, Image2D&& image);
/**
* @brief Read given mip level and coordinate of texture to buffer image
@ -655,16 +667,16 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @requires_gl Texture image queries are not available in OpenGL ES or
* WebGL. See @ref Framebuffer::read() for possible workaround.
*/
void image(Coordinate coordinate, Int level, BufferImage2D& image, BufferUsage usage);
void image(CubeMapCoordinate coordinate, Int level, BufferImage2D& image, BufferUsage usage);
/** @overload
*
* Convenience alternative to the above, example usage:
* @code
* BufferImage2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead);
* BufferImage2D image = texture.image(CubeMapCoordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead);
* @endcode
*/
BufferImage2D image(Coordinate coordinate, Int level, BufferImage2D&& image, BufferUsage usage);
BufferImage2D image(CubeMapCoordinate coordinate, Int level, BufferImage2D&& image, BufferUsage usage);
/**
* @brief Read given mip level and coordinate of compressed texture to image
@ -695,16 +707,16 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @requires_gl Texture image queries are not available in OpenGL ES or
* WebGL. See @ref Framebuffer::read() for possible workaround.
*/
void compressedImage(Coordinate coordinate, Int level, CompressedImage2D& image);
void compressedImage(CubeMapCoordinate coordinate, Int level, CompressedImage2D& image);
/** @overload
*
* Convenience alternative to the above, example usage:
* @code
* CompressedImage2D image = texture.compressedImage(CubeMapTexture::Coordinate::PositiveX, 0, {});
* CompressedImage2D image = texture.compressedImage(CubeMapCoordinate::PositiveX, 0, {});
* @endcode
*/
CompressedImage2D compressedImage(Coordinate coordinate, Int level, CompressedImage2D&& image);
CompressedImage2D compressedImage(CubeMapCoordinate coordinate, Int level, CompressedImage2D&& image);
/**
* @brief Read given mip level and coordinate of compressed texture to buffer image
@ -716,16 +728,16 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @requires_gl Texture image queries are not available in OpenGL ES or
* WebGL. See @ref Framebuffer::read() for possible workaround.
*/
void compressedImage(Coordinate coordinate, Int level, CompressedBufferImage2D& image, BufferUsage usage);
void compressedImage(CubeMapCoordinate coordinate, Int level, CompressedBufferImage2D& image, BufferUsage usage);
/** @overload
*
* Convenience alternative to the above, example usage:
* @code
* CompressedBufferImage2D image = texture.compressedImage(CubeMapTexture::Coordinate::PositiveX, 0, {}, BufferUsage::StaticRead);
* CompressedBufferImage2D image = texture.compressedImage(CubeMapCoordinate::PositiveX, 0, {}, BufferUsage::StaticRead);
* @endcode
*/
CompressedBufferImage2D compressedImage(Coordinate coordinate, Int level, CompressedBufferImage2D&& image, BufferUsage usage);
CompressedBufferImage2D compressedImage(CubeMapCoordinate coordinate, Int level, CompressedBufferImage2D&& image, BufferUsage usage);
/**
* @copybrief Texture::subImage(Int, const RangeTypeFor<dimensions, Int>&, Image&)
@ -825,7 +837,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @deprecated_gl Prefer to use @ref setStorage() and @ref setSubImage()
* instead.
*/
CubeMapTexture& setImage(Coordinate coordinate, Int level, TextureFormat internalFormat, const ImageView2D& image) {
CubeMapTexture& setImage(CubeMapCoordinate coordinate, Int level, TextureFormat internalFormat, const ImageView2D& image) {
DataHelper<2>::setImage(*this, GLenum(coordinate), level, internalFormat, image);
return *this;
}
@ -839,7 +851,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @deprecated_gl Prefer to use @ref setStorage() and @ref setSubImage()
* instead.
*/
CubeMapTexture& setImage(Coordinate coordinate, Int level, TextureFormat internalFormat, BufferImage2D& image) {
CubeMapTexture& setImage(CubeMapCoordinate coordinate, Int level, TextureFormat internalFormat, BufferImage2D& image) {
DataHelper<2>::setImage(*this, GLenum(coordinate), level, internalFormat, image);
return *this;
}
@ -852,7 +864,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @deprecated_gl Prefer to use @ref setStorage() and @ref setSubImage()
* instead.
*/
CubeMapTexture& setImage(Coordinate coordinate, Int level, TextureFormat internalFormat, BufferImage2D&& image) {
CubeMapTexture& setImage(CubeMapCoordinate coordinate, Int level, TextureFormat internalFormat, BufferImage2D&& image) {
return setImage(coordinate, level, internalFormat, image);
}
#endif
@ -866,7 +878,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @deprecated_gl Prefer to use @ref setStorage() and
* @ref setCompressedSubImage() instead.
*/
CubeMapTexture& setCompressedImage(Coordinate coordinate, Int level, const CompressedImageView2D& image) {
CubeMapTexture& setCompressedImage(CubeMapCoordinate coordinate, Int level, const CompressedImageView2D& image) {
DataHelper<2>::setCompressedImage(*this, GLenum(coordinate), level, image);
return *this;
}
@ -880,7 +892,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @deprecated_gl Prefer to use @ref setStorage() and
* @ref setCompressedSubImage() instead.
*/
CubeMapTexture& setCompressedImage(Coordinate coordinate, Int level, CompressedBufferImage2D& image) {
CubeMapTexture& setCompressedImage(CubeMapCoordinate coordinate, Int level, CompressedBufferImage2D& image) {
DataHelper<2>::setCompressedImage(*this, GLenum(coordinate), level, image);
return *this;
}
@ -893,7 +905,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @deprecated_gl Prefer to use @ref setStorage() and
* @ref setCompressedSubImage() instead.
*/
CubeMapTexture& setCompressedImage(Coordinate coordinate, Int level, CompressedBufferImage2D&& image) {
CubeMapTexture& setCompressedImage(CubeMapCoordinate coordinate, Int level, CompressedBufferImage2D&& image) {
return setCompressedImage(coordinate, level, image);
}
#endif
@ -968,7 +980,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
*
* See @ref Texture::setSubImage() for more information.
*/
CubeMapTexture& setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, const ImageView2D& image);
CubeMapTexture& setSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, const ImageView2D& image);
#ifndef MAGNUM_TARGET_GLES2
/** @overload
@ -977,7 +989,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @requires_webgl20 Pixel buffer objects are not available in WebGL
* 1.0.
*/
CubeMapTexture& setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, BufferImage2D& image);
CubeMapTexture& setSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, BufferImage2D& image);
/** @overload
* @requires_gles30 Pixel buffer objects are not available in OpenGL ES
@ -985,7 +997,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @requires_webgl20 Pixel buffer objects are not available in WebGL
* 1.0.
*/
CubeMapTexture& setSubImage(Coordinate coordinate, Int level, const Vector2i& offset, BufferImage2D&& image) {
CubeMapTexture& setSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, BufferImage2D&& image) {
return setSubImage(coordinate, level, offset, image);
}
#endif
@ -996,7 +1008,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
*
* See @ref Texture::setCompressedSubImage() for more information.
*/
CubeMapTexture& setCompressedSubImage(Coordinate coordinate, Int level, const Vector2i& offset, const CompressedImageView2D& image);
CubeMapTexture& setCompressedSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, const CompressedImageView2D& image);
#ifndef MAGNUM_TARGET_GLES2
/** @overload
@ -1005,7 +1017,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @requires_webgl20 Pixel buffer objects are not available in WebGL
* 1.0.
*/
CubeMapTexture& setCompressedSubImage(Coordinate coordinate, Int level, const Vector2i& offset, CompressedBufferImage2D& image);
CubeMapTexture& setCompressedSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, CompressedBufferImage2D& image);
/** @overload
* @requires_gles30 Pixel buffer objects are not available in OpenGL ES
@ -1013,7 +1025,7 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
* @requires_webgl20 Pixel buffer objects are not available in WebGL
* 1.0.
*/
CubeMapTexture& setCompressedSubImage(Coordinate coordinate, Int level, const Vector2i& offset, CompressedBufferImage2D&& image) {
CubeMapTexture& setCompressedSubImage(CubeMapCoordinate coordinate, Int level, const Vector2i& offset, CompressedBufferImage2D&& image) {
return setCompressedSubImage(coordinate, level, offset, image);
}
#endif
@ -1086,27 +1098,27 @@ class MAGNUM_EXPORT CubeMapTexture: public AbstractTexture {
void MAGNUM_LOCAL getCompressedImageImplementationDSA(GLint level, const Vector2i& size, std::size_t dataOffset, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getCompressedImageImplementationDSASingleSliceWorkaround(GLint level, const Vector2i& size, std::size_t dataOffset, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getImageImplementationDefault(Coordinate coordinate, GLint level, const Vector2i& size, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getImageImplementationDSA(Coordinate coordinate, GLint level, const Vector2i& size, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getImageImplementationDSAEXT(Coordinate coordinate, GLint level, const Vector2i& size, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getImageImplementationRobustness(Coordinate coordinate, GLint level, const Vector2i& size, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getImageImplementationDefault(CubeMapCoordinate coordinate, GLint level, const Vector2i& size, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getImageImplementationDSA(CubeMapCoordinate coordinate, GLint level, const Vector2i& size, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getImageImplementationDSAEXT(CubeMapCoordinate coordinate, GLint level, const Vector2i& size, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getImageImplementationRobustness(CubeMapCoordinate coordinate, GLint level, const Vector2i& size, PixelFormat format, PixelType type, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getCompressedImageImplementationDefault(Coordinate coordinate, GLint level, const Vector2i& size, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getCompressedImageImplementationDSA(Coordinate coordinate, GLint level, const Vector2i& size, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getCompressedImageImplementationDSAEXT(Coordinate coordinate, GLint level, const Vector2i& size, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getCompressedImageImplementationRobustness(Coordinate coordinate, GLint level, const Vector2i& size, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getCompressedImageImplementationDefault(CubeMapCoordinate coordinate, GLint level, const Vector2i& size, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getCompressedImageImplementationDSA(CubeMapCoordinate coordinate, GLint level, const Vector2i& size, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getCompressedImageImplementationDSAEXT(CubeMapCoordinate coordinate, GLint level, const Vector2i& size, std::size_t dataSize, GLvoid* data);
void MAGNUM_LOCAL getCompressedImageImplementationRobustness(CubeMapCoordinate coordinate, GLint level, const Vector2i& size, std::size_t dataSize, GLvoid* data);
#endif
void MAGNUM_LOCAL subImageImplementationDefault(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data);
void MAGNUM_LOCAL subImageImplementationDefault(CubeMapCoordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data);
#ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL subImageImplementationDSA(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data);
void MAGNUM_LOCAL subImageImplementationDSAEXT(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data);
void MAGNUM_LOCAL subImageImplementationDSA(CubeMapCoordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data);
void MAGNUM_LOCAL subImageImplementationDSAEXT(CubeMapCoordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, PixelFormat format, PixelType type, const GLvoid* data);
#endif
void MAGNUM_LOCAL compressedSubImageImplementationDefault(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, CompressedPixelFormat format, const GLvoid* data, GLsizei dataSize);
void MAGNUM_LOCAL compressedSubImageImplementationDefault(CubeMapCoordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, CompressedPixelFormat format, const GLvoid* data, GLsizei dataSize);
#ifndef MAGNUM_TARGET_GLES
void MAGNUM_LOCAL compressedSubImageImplementationDSA(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, CompressedPixelFormat format, const GLvoid* data, GLsizei dataSize);
void MAGNUM_LOCAL compressedSubImageImplementationDSAEXT(Coordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, CompressedPixelFormat format, const GLvoid* data, GLsizei dataSize);
void MAGNUM_LOCAL compressedSubImageImplementationDSA(CubeMapCoordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, CompressedPixelFormat format, const GLvoid* data, GLsizei dataSize);
void MAGNUM_LOCAL compressedSubImageImplementationDSAEXT(CubeMapCoordinate coordinate, GLint level, const Vector2i& offset, const Vector2i& size, CompressedPixelFormat format, const GLvoid* data, GLsizei dataSize);
#endif
};

3
src/Magnum/Framebuffer.cpp

@ -28,6 +28,7 @@
#include <Corrade/Containers/Array.h>
#include "Magnum/Context.h"
#include "Magnum/CubeMapTexture.h"
#include "Magnum/DefaultFramebuffer.h"
#include "Magnum/Extensions.h"
#include "Magnum/Image.h"
@ -236,7 +237,7 @@ Framebuffer& Framebuffer::attachTexture(const BufferAttachment attachment, Multi
}
#endif
Framebuffer& Framebuffer::attachCubeMapTexture(const BufferAttachment attachment, CubeMapTexture& texture, CubeMapTexture::Coordinate coordinate, const Int level) {
Framebuffer& Framebuffer::attachCubeMapTexture(const BufferAttachment attachment, CubeMapTexture& texture, CubeMapCoordinate coordinate, const Int level) {
(this->*Context::current().state().framebuffer->textureCubeMapImplementation)(attachment, GLenum(coordinate), texture.id(), level);
return *this;
}

6
src/Magnum/Framebuffer.h

@ -29,8 +29,10 @@
* @brief Class @ref Magnum::Framebuffer
*/
#include <Corrade/Containers/ArrayView.h>
#include "Magnum/AbstractFramebuffer.h"
#include "Magnum/CubeMapTexture.h"
#include "Magnum/Tags.h"
#ifdef _X11_XLIB_H_ /* Xlib.h, I hate you sincerely */
#undef Status
@ -658,7 +660,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje
* @fn_gl_extension{NamedFramebufferTexture2D,EXT,direct_state_access},
* eventually @fn_gl{BindFramebuffer} and @fn_gl2{FramebufferTexture2D,FramebufferTexture}
*/
Framebuffer& attachCubeMapTexture(BufferAttachment attachment, CubeMapTexture& texture, CubeMapTexture::Coordinate coordinate, Int level);
Framebuffer& attachCubeMapTexture(BufferAttachment attachment, CubeMapTexture& texture, CubeMapCoordinate coordinate, Int level);
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))
/**

1
src/Magnum/Implementation/TextureState.cpp

@ -28,6 +28,7 @@
#include <Corrade/Utility/Assert.h>
#include "Magnum/AbstractTexture.h"
#include "Magnum/CubeMapTexture.h"
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#include "Magnum/BufferTexture.h"
#endif

12
src/Magnum/Implementation/TextureState.h

@ -29,13 +29,15 @@
#include <vector>
#include <Corrade/Containers/Array.h>
#include "Magnum/CubeMapTexture.h"
#include "Magnum/Magnum.h"
#include "Magnum/OpenGL.h"
#if defined(_MSC_VER) && !defined(MAGNUM_TARGET_GLES2)
/* Otherwise the member function pointers will have different size based on
whether the header was included or not. CAUSES SERIOUS MEMORY CORRUPTION AND
IS NOT CAUGHT BY ANY WARNING WHATSOEVER! AARGH! */
#include "Magnum/BufferTexture.h"
#include "Magnum/CubeMapTexture.h"
#endif
namespace Magnum { namespace Implementation {
@ -104,12 +106,12 @@ struct TextureState {
#endif
#ifndef MAGNUM_TARGET_GLES
GLint(CubeMapTexture::*getCubeLevelCompressedImageSizeImplementation)(GLint);
void(CubeMapTexture::*getCubeImageImplementation)(CubeMapTexture::Coordinate, GLint, const Vector2i&, PixelFormat, PixelType, std::size_t, GLvoid*);
void(CubeMapTexture::*getCubeImageImplementation)(CubeMapCoordinate, GLint, const Vector2i&, PixelFormat, PixelType, std::size_t, GLvoid*);
void(CubeMapTexture::*getFullCompressedCubeImageImplementation)(GLint, const Vector2i&, std::size_t, std::size_t, GLvoid*);
void(CubeMapTexture::*getCompressedCubeImageImplementation)(CubeMapTexture::Coordinate, GLint, const Vector2i&, std::size_t, GLvoid*);
void(CubeMapTexture::*getCompressedCubeImageImplementation)(CubeMapCoordinate, GLint, const Vector2i&, std::size_t, GLvoid*);
#endif
void(CubeMapTexture::*cubeSubImageImplementation)(CubeMapTexture::Coordinate, GLint, const Vector2i&, const Vector2i&, PixelFormat, PixelType, const GLvoid*);
void(CubeMapTexture::*cubeCompressedSubImageImplementation)(CubeMapTexture::Coordinate, GLint, const Vector2i&, const Vector2i&, CompressedPixelFormat, const GLvoid*, GLsizei);
void(CubeMapTexture::*cubeSubImageImplementation)(CubeMapCoordinate, GLint, const Vector2i&, const Vector2i&, PixelFormat, PixelType, const GLvoid*);
void(CubeMapTexture::*cubeCompressedSubImageImplementation)(CubeMapCoordinate, GLint, const Vector2i&, const Vector2i&, CompressedPixelFormat, const GLvoid*, GLsizei);
GLint maxSize,
#if !(defined(MAGNUM_TARGET_WEBGL) && defined(MAGNUM_TARGET_GLES2))

1
src/Magnum/Magnum.h

@ -487,6 +487,7 @@ template<class T> using BasicColor4 CORRADE_DEPRECATED_ALIAS("use Math::Color4 i
class Context;
class CubeMapTexture;
enum class CubeMapCoordinate: GLenum;
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
class CubeMapTextureArray;
#endif

1
src/Magnum/Platform/magnum-info.cpp

@ -35,6 +35,7 @@
#include "Magnum/BufferTexture.h"
#endif
#include "Magnum/Context.h"
#include "Magnum/CubeMapTexture.h"
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)
#include "Magnum/CubeMapTextureArray.h"
#endif

144
src/Magnum/Test/CubeMapTextureGLTest.cpp

@ -289,7 +289,7 @@ void CubeMapTextureGLTest::bindImage() {
CubeMapTexture texture;
texture.setStorage(1, TextureFormat::RGBA8, Vector2i{32})
.bindImage(2, 0, CubeMapTexture::Coordinate::NegativeX, ImageAccess::ReadWrite, ImageFormat::RGBA8);
.bindImage(2, 0, CubeMapCoordinate::NegativeX, ImageAccess::ReadWrite, ImageFormat::RGBA8);
MAGNUM_VERIFY_NO_ERROR();
@ -482,14 +482,14 @@ namespace {
void CubeMapTextureGLTest::image() {
CubeMapTexture texture;
texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveX, 0, TextureFormat::RGBA8,
ImageView2D{_dataStorage, PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), unsafeSuffix(Data, _dataOffset)});
MAGNUM_VERIFY_NO_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
Image2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0,
Image2D image = texture.image(CubeMapCoordinate::PositiveX, 0,
{_dataStorage, PixelFormat::RGBA, PixelType::UnsignedByte});
MAGNUM_VERIFY_NO_ERROR();
@ -517,17 +517,17 @@ void CubeMapTextureGLTest::compressedImage() {
CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, unsafeSuffix(CompressedData, _compressedDataOffset)};
CubeMapTexture texture;
texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0, view)
.setCompressedImage(CubeMapTexture::Coordinate::NegativeX, 0, view)
.setCompressedImage(CubeMapTexture::Coordinate::PositiveY, 0, view)
.setCompressedImage(CubeMapTexture::Coordinate::NegativeY, 0, view)
.setCompressedImage(CubeMapTexture::Coordinate::PositiveZ, 0, view)
.setCompressedImage(CubeMapTexture::Coordinate::NegativeZ, 0, view);
texture.setCompressedImage(CubeMapCoordinate::PositiveX, 0, view)
.setCompressedImage(CubeMapCoordinate::NegativeX, 0, view)
.setCompressedImage(CubeMapCoordinate::PositiveY, 0, view)
.setCompressedImage(CubeMapCoordinate::NegativeY, 0, view)
.setCompressedImage(CubeMapCoordinate::PositiveZ, 0, view)
.setCompressedImage(CubeMapCoordinate::NegativeZ, 0, view);
MAGNUM_VERIFY_NO_ERROR();
#ifndef MAGNUM_TARGET_GLES
CompressedImage2D image = texture.compressedImage(CubeMapTexture::Coordinate::PositiveX, 0, {_compressedDataStorage});
CompressedImage2D image = texture.compressedImage(CubeMapCoordinate::PositiveX, 0, {_compressedDataStorage});
MAGNUM_VERIFY_NO_ERROR();
@ -541,14 +541,14 @@ void CubeMapTextureGLTest::compressedImage() {
#ifndef MAGNUM_TARGET_GLES2
void CubeMapTextureGLTest::imageBuffer() {
CubeMapTexture texture;
texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8, BufferImage2D{
texture.setImage(CubeMapCoordinate::PositiveX, 0, TextureFormat::RGBA8, BufferImage2D{
_dataStorage, PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), unsafeSuffix(Data, _dataOffset), BufferUsage::StaticDraw});
MAGNUM_VERIFY_NO_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
BufferImage2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0,
BufferImage2D image = texture.image(CubeMapCoordinate::PositiveX, 0,
{_dataStorage, PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data<UnsignedByte>();
@ -576,17 +576,17 @@ void CubeMapTextureGLTest::compressedImageBuffer() {
CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, unsafeSuffix(CompressedData, _compressedDataOffset), BufferUsage::StaticDraw};
CubeMapTexture texture;
texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0, buffer)
.setCompressedImage(CubeMapTexture::Coordinate::NegativeX, 0, buffer)
.setCompressedImage(CubeMapTexture::Coordinate::PositiveY, 0, buffer)
.setCompressedImage(CubeMapTexture::Coordinate::NegativeY, 0, buffer)
.setCompressedImage(CubeMapTexture::Coordinate::PositiveZ, 0, buffer)
.setCompressedImage(CubeMapTexture::Coordinate::NegativeZ, 0, buffer);
texture.setCompressedImage(CubeMapCoordinate::PositiveX, 0, buffer)
.setCompressedImage(CubeMapCoordinate::NegativeX, 0, buffer)
.setCompressedImage(CubeMapCoordinate::PositiveY, 0, buffer)
.setCompressedImage(CubeMapCoordinate::NegativeY, 0, buffer)
.setCompressedImage(CubeMapCoordinate::PositiveZ, 0, buffer)
.setCompressedImage(CubeMapCoordinate::NegativeZ, 0, buffer);
MAGNUM_VERIFY_NO_ERROR();
#ifndef MAGNUM_TARGET_GLES
CompressedBufferImage2D image = texture.compressedImage(CubeMapTexture::Coordinate::PositiveX, 0,
CompressedBufferImage2D image = texture.compressedImage(CubeMapCoordinate::PositiveX, 0,
{_compressedDataStorage}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data<UnsignedByte>();
@ -625,17 +625,17 @@ void CubeMapTextureGLTest::immutableCompressedImage() {
CubeMapTexture texture;
texture.setStorage(1, TextureFormat::CompressedRGBAS3tcDxt3, Vector2i{4})
.setCompressedSubImage(CubeMapTexture::Coordinate::PositiveX, 0, {}, view)
.setCompressedSubImage(CubeMapTexture::Coordinate::NegativeX, 0, {}, view)
.setCompressedSubImage(CubeMapTexture::Coordinate::PositiveY, 0, {}, view)
.setCompressedSubImage(CubeMapTexture::Coordinate::NegativeY, 0, {}, view)
.setCompressedSubImage(CubeMapTexture::Coordinate::PositiveZ, 0, {}, view)
.setCompressedSubImage(CubeMapTexture::Coordinate::NegativeZ, 0, {}, view);
.setCompressedSubImage(CubeMapCoordinate::PositiveX, 0, {}, view)
.setCompressedSubImage(CubeMapCoordinate::NegativeX, 0, {}, view)
.setCompressedSubImage(CubeMapCoordinate::PositiveY, 0, {}, view)
.setCompressedSubImage(CubeMapCoordinate::NegativeY, 0, {}, view)
.setCompressedSubImage(CubeMapCoordinate::PositiveZ, 0, {}, view)
.setCompressedSubImage(CubeMapCoordinate::NegativeZ, 0, {}, view);
MAGNUM_VERIFY_NO_ERROR();
#ifndef MAGNUM_TARGET_GLES
CompressedImage2D image = texture.compressedImage(CubeMapTexture::Coordinate::NegativeY, 0, {});
CompressedImage2D image = texture.compressedImage(CubeMapCoordinate::NegativeY, 0, {});
MAGNUM_VERIFY_NO_ERROR();
@ -827,26 +827,26 @@ namespace {
void CubeMapTextureGLTest::subImage() {
CubeMapTexture texture;
texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveX, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setImage(CubeMapTexture::Coordinate::NegativeX, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::NegativeX, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setImage(CubeMapTexture::Coordinate::PositiveY, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveY, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setImage(CubeMapTexture::Coordinate::NegativeY, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::NegativeY, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setImage(CubeMapTexture::Coordinate::PositiveZ, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveZ, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setImage(CubeMapTexture::Coordinate::NegativeZ, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::NegativeZ, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setSubImage(CubeMapTexture::Coordinate::PositiveX, 0, Vector2i(1), ImageView2D{
texture.setSubImage(CubeMapCoordinate::PositiveX, 0, Vector2i(1), ImageView2D{
_dataStorage, PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), unsafeSuffix(Data, _dataOffset)});
MAGNUM_VERIFY_NO_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
Image2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte});
Image2D image = texture.image(CubeMapCoordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte});
MAGNUM_VERIFY_NO_ERROR();
@ -872,24 +872,24 @@ void CubeMapTextureGLTest::compressedSubImage() {
not that far off, then continue as usual */
if(Context::current().isExtensionSupported<Extensions::GL::ARB::compressed_texture_pixel_storage>()) {
CubeMapTexture texture;
texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0,
texture.setCompressedImage(CubeMapCoordinate::PositiveX, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedImage(CubeMapTexture::Coordinate::NegativeX, 0,
texture.setCompressedImage(CubeMapCoordinate::NegativeX, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveY, 0,
texture.setCompressedImage(CubeMapCoordinate::PositiveY, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedImage(CubeMapTexture::Coordinate::NegativeY, 0,
texture.setCompressedImage(CubeMapCoordinate::NegativeY, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveZ, 0,
texture.setCompressedImage(CubeMapCoordinate::PositiveZ, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedImage(CubeMapTexture::Coordinate::NegativeZ, 0,
texture.setCompressedImage(CubeMapCoordinate::NegativeZ, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedSubImage(CubeMapTexture::Coordinate::PositiveX, 0, Vector2i{4}, CompressedImageView2D{
texture.setCompressedSubImage(CubeMapCoordinate::PositiveX, 0, Vector2i{4}, CompressedImageView2D{
CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{4}, CompressedData});
MAGNUM_VERIFY_NO_ERROR();
CompressedImage2D image = texture.compressedImage(CubeMapTexture::Coordinate::PositiveX, 0, {});
CompressedImage2D image = texture.compressedImage(CubeMapCoordinate::PositiveX, 0, {});
MAGNUM_VERIFY_NO_ERROR();
@ -901,19 +901,19 @@ void CubeMapTextureGLTest::compressedSubImage() {
#endif
CubeMapTexture texture;
texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0,
texture.setCompressedImage(CubeMapCoordinate::PositiveX, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedImage(CubeMapTexture::Coordinate::NegativeX, 0,
texture.setCompressedImage(CubeMapCoordinate::NegativeX, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveY, 0,
texture.setCompressedImage(CubeMapCoordinate::PositiveY, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedImage(CubeMapTexture::Coordinate::NegativeY, 0,
texture.setCompressedImage(CubeMapCoordinate::NegativeY, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveZ, 0,
texture.setCompressedImage(CubeMapCoordinate::PositiveZ, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedImage(CubeMapTexture::Coordinate::NegativeZ, 0,
texture.setCompressedImage(CubeMapCoordinate::NegativeZ, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedSubImage(CubeMapTexture::Coordinate::PositiveX, 0, Vector2i{4}, CompressedImageView2D{
texture.setCompressedSubImage(CubeMapCoordinate::PositiveX, 0, Vector2i{4}, CompressedImageView2D{
#ifndef MAGNUM_TARGET_GLES
_compressedDataStorage,
#endif
@ -922,7 +922,7 @@ void CubeMapTextureGLTest::compressedSubImage() {
MAGNUM_VERIFY_NO_ERROR();
#ifndef MAGNUM_TARGET_GLES
CompressedImage2D image = texture.compressedImage(CubeMapTexture::Coordinate::PositiveX, 0, {});
CompressedImage2D image = texture.compressedImage(CubeMapCoordinate::PositiveX, 0, {});
MAGNUM_VERIFY_NO_ERROR();
@ -942,26 +942,26 @@ void CubeMapTextureGLTest::compressedSubImage() {
#ifndef MAGNUM_TARGET_GLES2
void CubeMapTextureGLTest::subImageBuffer() {
CubeMapTexture texture;
texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveX, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setImage(CubeMapTexture::Coordinate::NegativeX, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::NegativeX, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setImage(CubeMapTexture::Coordinate::PositiveY, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveY, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setImage(CubeMapTexture::Coordinate::NegativeY, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::NegativeY, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setImage(CubeMapTexture::Coordinate::PositiveZ, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveZ, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setImage(CubeMapTexture::Coordinate::NegativeZ, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::NegativeZ, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(4), Zero));
texture.setSubImage(CubeMapTexture::Coordinate::PositiveX, 0, Vector2i(1), BufferImage2D{
texture.setSubImage(CubeMapCoordinate::PositiveX, 0, Vector2i(1), BufferImage2D{
_dataStorage, PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(2), unsafeSuffix(Data, _dataOffset), BufferUsage::StaticDraw});
MAGNUM_VERIFY_NO_ERROR();
/** @todo How to test this on ES? */
#ifndef MAGNUM_TARGET_GLES
BufferImage2D image = texture.image(CubeMapTexture::Coordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead);
BufferImage2D image = texture.image(CubeMapCoordinate::PositiveX, 0, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data<UnsignedByte>();
MAGNUM_VERIFY_NO_ERROR();
@ -981,19 +981,19 @@ void CubeMapTextureGLTest::compressedSubImageBuffer() {
#endif
CubeMapTexture texture;
texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveX, 0,
texture.setCompressedImage(CubeMapCoordinate::PositiveX, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedImage(CubeMapTexture::Coordinate::NegativeX, 0,
texture.setCompressedImage(CubeMapCoordinate::NegativeX, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveY, 0,
texture.setCompressedImage(CubeMapCoordinate::PositiveY, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedImage(CubeMapTexture::Coordinate::NegativeY, 0,
texture.setCompressedImage(CubeMapCoordinate::NegativeY, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedImage(CubeMapTexture::Coordinate::PositiveZ, 0,
texture.setCompressedImage(CubeMapCoordinate::PositiveZ, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedImage(CubeMapTexture::Coordinate::NegativeZ, 0,
texture.setCompressedImage(CubeMapCoordinate::NegativeZ, 0,
CompressedImageView2D{CompressedPixelFormat::RGBAS3tcDxt3, Vector2i{12}, CompressedZero});
texture.setCompressedSubImage(CubeMapTexture::Coordinate::PositiveX, 0, Vector2i{4}, CompressedBufferImage2D{
texture.setCompressedSubImage(CubeMapCoordinate::PositiveX, 0, Vector2i{4}, CompressedBufferImage2D{
#ifndef MAGNUM_TARGET_GLES
_compressedDataStorage,
#endif
@ -1002,7 +1002,7 @@ void CubeMapTextureGLTest::compressedSubImageBuffer() {
MAGNUM_VERIFY_NO_ERROR();
#ifndef MAGNUM_TARGET_GLES
CompressedBufferImage2D image = texture.compressedImage(CubeMapTexture::Coordinate::PositiveX, 0,
CompressedBufferImage2D image = texture.compressedImage(CubeMapCoordinate::PositiveX, 0,
{}, BufferUsage::StaticRead);
const auto imageData = image.buffer().data<UnsignedByte>();
@ -1139,17 +1139,17 @@ void CubeMapTextureGLTest::compressedSubImageQueryBuffer() {
void CubeMapTextureGLTest::generateMipmap() {
CubeMapTexture texture;
texture.setImage(CubeMapTexture::Coordinate::PositiveX, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveX, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32)));
texture.setImage(CubeMapTexture::Coordinate::PositiveY, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveY, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32)));
texture.setImage(CubeMapTexture::Coordinate::PositiveZ, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::PositiveZ, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32)));
texture.setImage(CubeMapTexture::Coordinate::NegativeX, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::NegativeX, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32)));
texture.setImage(CubeMapTexture::Coordinate::NegativeY, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::NegativeY, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32)));
texture.setImage(CubeMapTexture::Coordinate::NegativeZ, 0, TextureFormat::RGBA8,
texture.setImage(CubeMapCoordinate::NegativeZ, 0, TextureFormat::RGBA8,
ImageView2D(PixelFormat::RGBA, PixelType::UnsignedByte, Vector2i(32)));
/** @todo How to test this on ES? */

11
src/Magnum/Test/FramebufferGLTest.cpp

@ -25,6 +25,7 @@
#include "Magnum/configure.h"
#include "Magnum/Context.h"
#include "Magnum/CubeMapTexture.h"
#include "Magnum/Extensions.h"
#include "Magnum/Framebuffer.h"
#include "Magnum/Image.h"
@ -618,7 +619,7 @@ void FramebufferGLTest::attachCubeMapTexture() {
#else
color.setStorage(1, rgbaFormatES2, Vector2i(128));
#endif
framebuffer.attachCubeMapTexture(Framebuffer::ColorAttachment(0), color, CubeMapTexture::Coordinate::NegativeZ, 0);
framebuffer.attachCubeMapTexture(Framebuffer::ColorAttachment(0), color, CubeMapCoordinate::NegativeZ, 0);
CubeMapTexture depthStencil;
@ -632,11 +633,11 @@ void FramebufferGLTest::attachCubeMapTexture() {
#ifndef MAGNUM_TARGET_GLES2
depthStencil.setStorage(1, TextureFormat::Depth24Stencil8, Vector2i(128));
framebuffer.attachCubeMapTexture(Framebuffer::BufferAttachment::DepthStencil, depthStencil, CubeMapTexture::Coordinate::NegativeZ, 0);
framebuffer.attachCubeMapTexture(Framebuffer::BufferAttachment::DepthStencil, depthStencil, CubeMapCoordinate::NegativeZ, 0);
#else
depthStencil.setStorage(1, depthStencilFormatES2, Vector2i(128));
framebuffer.attachCubeMapTexture(Framebuffer::BufferAttachment::Depth, depthStencil, CubeMapTexture::Coordinate::NegativeZ, 0)
.attachCubeMapTexture(Framebuffer::BufferAttachment::Stencil, depthStencil, CubeMapTexture::Coordinate::NegativeZ, 0);
framebuffer.attachCubeMapTexture(Framebuffer::BufferAttachment::Depth, depthStencil, CubeMapCoordinate::NegativeZ, 0)
.attachCubeMapTexture(Framebuffer::BufferAttachment::Stencil, depthStencil, CubeMapCoordinate::NegativeZ, 0);
#endif
}
@ -645,7 +646,7 @@ void FramebufferGLTest::attachCubeMapTexture() {
Debug() << "Using" << Extensions::GL::OES::depth_texture::string();
depthStencil.setStorage(1, TextureFormat::DepthComponent16, Vector2i(128));
framebuffer.attachCubeMapTexture(Framebuffer::BufferAttachment::Depth, depthStencil, CubeMapTexture::Coordinate::NegativeZ, 0);
framebuffer.attachCubeMapTexture(Framebuffer::BufferAttachment::Depth, depthStencil, CubeMapCoordinate::NegativeZ, 0);
}
#endif

Loading…
Cancel
Save