Open 3D Engine Atom Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::RPI::AttachmentReadback Class Referencefinal

#include <AttachmentReadback.h>


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.

Detailed Description

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.

Member Function Documentation

◆ IsReady()

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

◆ ReadPassAttachment()

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.

readbackNameis 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
mipsRangeIf 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.

The documentation for this class was generated from the following file: