Browse Source

DebugTools: reorder and document to make the non-orthogonality obvious.

Also apparently ordering of the functions in the *source* file is
important for Doxygen and the header order gets ignored completely. What
the hell.
pull/141/head
Vladimír Vondruš 10 years ago
parent
commit
da8bf1a184
  1. 28
      src/Magnum/DebugTools/TextureImage.cpp
  2. 63
      src/Magnum/DebugTools/TextureImage.h

28
src/Magnum/DebugTools/TextureImage.cpp

@ -166,10 +166,9 @@ void textureSubImage(Texture2D& texture, const Int level, const Range2Di& range,
.read(range, image); .read(range, image);
} }
void textureSubImage(CubeMapTexture& texture, const CubeMapCoordinate coordinate, const Int level, const Range2Di& range, Image2D& image) { Image2D textureSubImage(Texture2D& texture, const Int level, const Range2Di& range, Image2D&& image) {
Framebuffer fb{range}; textureSubImage(texture, level, range, image);
fb.attachCubeMapTexture(Framebuffer::ColorAttachment{0}, texture, coordinate, level) return std::move(image);
.read(range, image);
} }
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -186,16 +185,16 @@ void textureSubImage(Texture2D& texture, const Int level, const Range2Di& range,
.read(range, image, usage); .read(range, image, usage);
} }
void textureSubImage(CubeMapTexture& texture, const CubeMapCoordinate coordinate, const Int level, const Range2Di& range, BufferImage2D& image, const BufferUsage usage) { BufferImage2D textureSubImage(Texture2D& texture, const Int level, const Range2Di& range, BufferImage2D&& image, const BufferUsage usage) {
Framebuffer fb{range}; textureSubImage(texture, level, range, image, usage);
fb.attachCubeMapTexture(Framebuffer::ColorAttachment{0}, texture, coordinate, level) return std::move(image);
.read(range, image, usage);
} }
#endif #endif
Image2D textureSubImage(Texture2D& texture, const Int level, const Range2Di& range, Image2D&& image) { void textureSubImage(CubeMapTexture& texture, const CubeMapCoordinate coordinate, const Int level, const Range2Di& range, Image2D& image) {
textureSubImage(texture, level, range, image); Framebuffer fb{range};
return std::move(image); fb.attachCubeMapTexture(Framebuffer::ColorAttachment{0}, texture, coordinate, level)
.read(range, image);
} }
Image2D textureSubImage(CubeMapTexture& texture, const CubeMapCoordinate coordinate, const Int level, const Range2Di& range, Image2D&& image) { Image2D textureSubImage(CubeMapTexture& texture, const CubeMapCoordinate coordinate, const Int level, const Range2Di& range, Image2D&& image) {
@ -204,9 +203,10 @@ Image2D textureSubImage(CubeMapTexture& texture, const CubeMapCoordinate coordin
} }
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
BufferImage2D textureSubImage(Texture2D& texture, const Int level, const Range2Di& range, BufferImage2D&& image, const BufferUsage usage) { void textureSubImage(CubeMapTexture& texture, const CubeMapCoordinate coordinate, const Int level, const Range2Di& range, BufferImage2D& image, const BufferUsage usage) {
textureSubImage(texture, level, range, image, usage); Framebuffer fb{range};
return std::move(image); fb.attachCubeMapTexture(Framebuffer::ColorAttachment{0}, texture, coordinate, level)
.read(range, image, usage);
} }
BufferImage2D textureSubImage(CubeMapTexture& texture, const CubeMapCoordinate coordinate, const Int level, const Range2Di& range, BufferImage2D&& image, const BufferUsage usage) { BufferImage2D textureSubImage(CubeMapTexture& texture, const CubeMapCoordinate coordinate, const Int level, const Range2Di& range, BufferImage2D&& image, const BufferUsage usage) {

63
src/Magnum/DebugTools/TextureImage.h

@ -37,10 +37,10 @@ namespace Magnum { namespace DebugTools {
/** /**
@brief Read range of given texture mip level to image @brief Read range of given texture mip level to image
Emulates @ref Texture::subImage() "*Texture::subImage()" call on platforms that Emulates @ref Texture2D::subImage() call on platforms that don't support it
don't support it (such as OpenGL ES) by creating a framebuffer object and using (such as OpenGL ES) by creating a framebuffer object and using
@ref Framebuffer::read(). On desktop OpenGL, if @extension{ARB,get_texture_sub_image} @ref Framebuffer::read(). On desktop OpenGL, if @extension{ARB,get_texture_sub_image}
is available, it's just an alias to @ref Texture::subImage() "*Texture::subImage()". is available, it's just an alias to @ref Texture2D::subImage().
Note that only @ref Magnum::PixelFormat "PixelFormat" and @ref PixelType values Note that only @ref Magnum::PixelFormat "PixelFormat" and @ref PixelType values
that are marked as framebuffer readable are supported. In addition, on OpenGL that are marked as framebuffer readable are supported. In addition, on OpenGL
@ -51,9 +51,6 @@ reinterpreted as @ref PixelType::UnsignedInt using additional shader and
*/ */
MAGNUM_DEBUGTOOLS_EXPORT void textureSubImage(Texture2D& texture, Int level, const Range2Di& range, Image2D& image); MAGNUM_DEBUGTOOLS_EXPORT void textureSubImage(Texture2D& texture, Int level, const Range2Di& range, Image2D& image);
/** @overload */
MAGNUM_DEBUGTOOLS_EXPORT void textureSubImage(CubeMapTexture& texture, CubeMapCoordinate coordinate, Int level, const Range2Di& range, Image2D& image);
/** /**
@brief Read range of given texture mip level to image @brief Read range of given texture mip level to image
@ -64,16 +61,36 @@ Image2D image = DebugTools::textureSubImage(texture, 0, rect, {PixelFormat::RGBA
*/ */
MAGNUM_DEBUGTOOLS_EXPORT Image2D textureSubImage(Texture2D& texture, Int level, const Range2Di& range, Image2D&& image); MAGNUM_DEBUGTOOLS_EXPORT Image2D textureSubImage(Texture2D& texture, Int level, const Range2Di& range, Image2D&& image);
/** @overload */ /**
@brief Read range of given cube map texture coordinate mip level to image
Emulates @ref CubeMapTexture::subImage() call on platforms that don't support
it (such as OpenGL ES) by creating a framebuffer object and using
@ref Framebuffer::read().
Note that only @ref Magnum::PixelFormat "PixelFormat" and @ref PixelType values
that are marked as framebuffer readable are supported.
*/
MAGNUM_DEBUGTOOLS_EXPORT void textureSubImage(CubeMapTexture& texture, CubeMapCoordinate coordinate, Int level, const Range2Di& range, Image2D& image);
/**
@brief Read range of given cube map texture coordinate mip level to image
Convenience alternative to the above, example usage:
@code
Image2D image = DebugTools::textureSubImage(texture, CubeMapCoordinate::PositiveX, 0, rect, {PixelFormat::RGBA, PixelType::UnsignedByte});
@endcode
*/
MAGNUM_DEBUGTOOLS_EXPORT Image2D textureSubImage(CubeMapTexture& texture, CubeMapCoordinate coordinate, Int level, const Range2Di& range, Image2D&& image); MAGNUM_DEBUGTOOLS_EXPORT Image2D textureSubImage(CubeMapTexture& texture, CubeMapCoordinate coordinate, Int level, const Range2Di& range, Image2D&& image);
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
/** /**
@brief Read range of given texture mip level to buffer image @brief Read range of given texture mip level to buffer image
Emulates @ref Texture::subImage() "*Texture::subImage()" call on platforms that Emulates @ref Texture2D::subImage() call on platforms that don't support it
don't support it (such as OpenGL ES) by creating a framebuffer object and using (such as OpenGL ES) by creating a framebuffer object and using
@ref Framebuffer::read(). @ref Framebuffer::read(). On desktop OpenGL, if @extension{ARB,get_texture_sub_image}
is available, it's just an alias to @ref Texture2D::subImage().
Note that only @ref Magnum::PixelFormat "PixelFormat" and @ref PixelType values Note that only @ref Magnum::PixelFormat "PixelFormat" and @ref PixelType values
that are marked as framebuffer readable are supported. that are marked as framebuffer readable are supported.
@ -82,9 +99,6 @@ that are marked as framebuffer readable are supported.
*/ */
MAGNUM_DEBUGTOOLS_EXPORT void textureSubImage(Texture2D& texture, Int level, const Range2Di& range, BufferImage2D& image, BufferUsage usage); MAGNUM_DEBUGTOOLS_EXPORT void textureSubImage(Texture2D& texture, Int level, const Range2Di& range, BufferImage2D& image, BufferUsage usage);
/** @overload */
MAGNUM_DEBUGTOOLS_EXPORT void textureSubImage(CubeMapTexture& texture, CubeMapCoordinate coordinate, Int level, const Range2Di& range, BufferImage2D& image, BufferUsage usage);
/** /**
@brief Read range of given texture mip level to buffer image @brief Read range of given texture mip level to buffer image
@ -95,7 +109,28 @@ BufferImage2D image = DebugTools::textureSubImage(texture, 0, rect, {PixelFormat
*/ */
MAGNUM_DEBUGTOOLS_EXPORT BufferImage2D textureSubImage(Texture2D& texture, Int level, const Range2Di& range, BufferImage2D&& image, BufferUsage usage); MAGNUM_DEBUGTOOLS_EXPORT BufferImage2D textureSubImage(Texture2D& texture, Int level, const Range2Di& range, BufferImage2D&& image, BufferUsage usage);
/** @overload */ /**
@brief Read range of given cube map texture coordinate mip level to buffer image
Emulates @ref CubeMapTexture::subImage() call on platforms that don't support
it (such as OpenGL ES) by creating a framebuffer object and using
@ref Framebuffer::read().
Note that only @ref Magnum::PixelFormat "PixelFormat" and @ref PixelType values
that are marked as framebuffer readable are supported.
@requires_gles30 Pixel buffer objects are not available in OpenGL ES 2.0.
@requires_webgl20 Pixel buffer objects are not available in WebGL 1.0.
*/
MAGNUM_DEBUGTOOLS_EXPORT void textureSubImage(CubeMapTexture& texture, CubeMapCoordinate coordinate, Int level, const Range2Di& range, BufferImage2D& image, BufferUsage usage);
/**
@brief Read range of given cube map texture coordinate mip level to buffer image
Convenience alternative to the above, example usage:
@code
BufferImage2D image = DebugTools::textureSubImage(texture, CubeMapCoordinate::PositiveX, 0, rect, {PixelFormat::RGBA, PixelType::UnsignedByte}, BufferUsage::StaticRead);
@endcode
*/
MAGNUM_DEBUGTOOLS_EXPORT BufferImage2D textureSubImage(CubeMapTexture& texture, CubeMapCoordinate coordinate, Int level, const Range2Di& range, BufferImage2D&& image, BufferUsage usage); MAGNUM_DEBUGTOOLS_EXPORT BufferImage2D textureSubImage(CubeMapTexture& texture, CubeMapCoordinate coordinate, Int level, const Range2Di& range, BufferImage2D&& image, BufferUsage usage);
#endif #endif

Loading…
Cancel
Save