#include <AttachmentReadback.h>
Classes | |
struct | MipInfo |
struct | ReadbackResult |
Public Types | |
enum class | ReadbackState : uint32_t { Uninitialized = 0 , Idle , AttachmentSet , Reading , Success , Failed } |
using | CallbackFunction = AZStd::function< void(const ReadbackResult &)> |
Public Member Functions | |
AZ_RTTI (AttachmentReadback, "{9C70ACD3-8694-4EF3-A556-9DA25BD1237C}") | |
AZ_CLASS_ALLOCATOR (AttachmentReadback, SystemAllocator) | |
AttachmentReadback (const RHI::ScopeId &scopeId) | |
bool | ReadPassAttachment (const PassAttachment *attachment, const AZ::Name &readbackName, const RHI::ImageSubresourceRange *mipsRange=nullptr) |
void | Reset () |
ReadbackState | GetReadbackState () |
void | SetCallback (CallbackFunction callback) |
Set a callback function which will be called when readback is finished or failed. | |
void | SetUserIdentifier (uint32_t userIdentifier) |
Set the using systems identifier tag. | |
bool | IsFinished () const |
Whether the previous readback is finished. | |
bool | IsReady () const |
void | FrameBegin (Pass::FramePrepareParams params) |
Prepare this scope producer for the frame. | |
Adds one or two scope producers (the second serves to decompose an MS Texture) which read back one or more mip levels for a particular attachment to CPU memory. Both buffer and image attachments are supported. In case of images it can also capture specific Mip Levels, as defined in the image view descriptors. Also, for images, Volume Texture image attachments (aka Texture3D) are supported too.
bool AZ::RPI::AttachmentReadback::IsReady | ( | ) | const |
Whether it's ready to readback an attachment Returns false if it's not initialized or it's in the process of readback from another attachment
bool AZ::RPI::AttachmentReadback::ReadPassAttachment | ( | const PassAttachment * | attachment, |
const AZ::Name & | readbackName, | ||
const RHI::ImageSubresourceRange * | mipsRange = nullptr |
||
) |
Reads back one or more mip levels from a single pass attachment.
readbackName | is the name for the readback buffer. And it will be saved in ReadbackResult::m_name. If the name is empty, a name will be generated automatically. Return true if the pass attachment readback request was submitted. The callback function set by SetCallback(CallbackFunction callback) will be called once the readback is finished |
mipsRange | If null, by default it is assumed that @attachment refers to Mip Level 0. When different than null, it is used to specify which mip levels to readback from. |