From e0e8ddcae247c75ea901c509e4409bdd0c900a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 24 Jun 2022 15:26:34 +0200 Subject: [PATCH] GL: document ImageFlag behavior in *Framebuffer::read(). No actual change compared to previous state, which is exactly how I envisioned this -- the most common and default case being the implicit one. --- src/Magnum/GL/AbstractFramebuffer.cpp | 2 +- src/Magnum/GL/AbstractFramebuffer.h | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Magnum/GL/AbstractFramebuffer.cpp b/src/Magnum/GL/AbstractFramebuffer.cpp index adaf038b4..56c34196c 100644 --- a/src/Magnum/GL/AbstractFramebuffer.cpp +++ b/src/Magnum/GL/AbstractFramebuffer.cpp @@ -376,7 +376,7 @@ void AbstractFramebuffer::read(const Range2Di& rectangle, Image2D& image) { data = Containers::Array{dataSize}; /* Replace the storage, proxy to the function taking a view */ - image = Image2D{image.storage(), image.format(), image.formatExtra(), image.pixelSize(), rectangle.size(), std::move(data)}; + image = Image2D{image.storage(), image.format(), image.formatExtra(), image.pixelSize(), rectangle.size(), std::move(data), ImageFlags2D{}}; read(rectangle, MutableImageView2D(image)); } diff --git a/src/Magnum/GL/AbstractFramebuffer.h b/src/Magnum/GL/AbstractFramebuffer.h index 2aa742a15..eb7f817af 100644 --- a/src/Magnum/GL/AbstractFramebuffer.h +++ b/src/Magnum/GL/AbstractFramebuffer.h @@ -383,10 +383,11 @@ class MAGNUM_GL_EXPORT AbstractFramebuffer { * @param image Image where to put the data * * Image parameters like format and type of pixel data are taken from - * given image. The storage is not reallocated if it is large enough to - * contain the new data --- however if you want to read into existing - * memory or *ensure* a reallocation does not happen, use - * @ref read(const Range2Di&, const MutableImageView2D&) instead. + * given image. @ref ImageFlags of @p image get cleared. The storage + * is not reallocated if it is large enough to contain the new data + * --- however if you want to read into existing memory or *ensure* a + * reallocation does not happen, use @ref read(const Range2Di&, const MutableImageView2D&) + * instead. * * On OpenGL ES 2.0 and WebGL 1.0, if @ref PixelStorage::skip() is set, * the functionality is emulated by adjusting the data pointer. If @@ -418,7 +419,9 @@ class MAGNUM_GL_EXPORT AbstractFramebuffer { * Compared to @ref read(const Range2Di&, Image2D&) the function * reads the pixels into the memory provided by @p image, expecting * it's not @cpp nullptr @ce and its size is the same as @p rectangle - * size. + * size. Any set of @ref ImageFlags is allowed in @p image --- e.g., + * it's possible to read a 2D framebuffer to an image marked as 1D + * array. */ void read(const Range2Di& rectangle, const MutableImageView2D& image);