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

#include <Image.h>

Inherits AZ::RHI::Resource.

Public Member Functions

 AZ_CLASS_ALLOCATOR (Image, AZ::SystemAllocator, 0)
 
 AZ_RTTI (Image, "{39FFE66C-805A-41AD-9092-91327D51F64B}", Resource)
 
 AZ_RHI_MULTI_DEVICE_OBJECT_GETTER (Image)
 
const ImageDescriptorGetDescriptor () const
 
Ptr< ImageViewBuildImageView (const ImageViewDescriptor &imageViewDescriptor)
 Returns the multi-device DeviceImageView.
 
void GetSubresourceLayout (ImageSubresourceLayout &subresourceLayout, ImageAspectFlags aspectFlags=ImageAspectFlags::All) const
 
HardwareQueueClassMask GetSupportedQueueMask () const
 
const ImageFrameAttachmentGetFrameAttachment () const
 
uint32_t GetResidentMipLevel () const
 
bool IsStreamable () const
 Returns whether the image has sub-resources which can be evicted from or streamed into the device memory.
 
ImageAspectFlags GetAspectFlags () const
 Returns the aspects that are included in the image.
 
const HashValue64 GetHash () const
 Get the hash associated with the passed image descriptor.
 
void Shutdown () override final
 Shuts down the resource by detaching it from its parent pool.
 
bool IsInResourceCache (const ImageViewDescriptor &imageViewDescriptor)
 Returns true if the DeviceResourceView is in the cache of all single device images.
 
- Public Member Functions inherited from AZ::RHI::Resource
 AZ_RTTI (Resource, "{613AED98-48FD-4453-98F8-6956D2133489}", MultiDeviceObject)
 
bool IsAttachment () const
 Returns whether the resource is currently an attachment on a frame graph.
 
const ResourcePoolGetPool () const
 
ResourcePoolGetPool ()
 
uint32_t GetVersion () const
 
const FrameAttachmentGetFrameAttachment () const
 Returns the frame attachment associated with this image (if it exists).
 
void InvalidateViews ()
 
- Public Member Functions inherited from AZ::RHI::MultiDeviceObject
 AZ_RTTI (MultiDeviceObject, "{17D34F71-944C-4AF5-9823-627474C4C0A6}", Object)
 
bool IsInitialized () const
 Returns whether the device object is initialized.
 
AZ_FORCE_INLINE bool IsDeviceSet (int deviceIndex) const
 
MultiDevice::DeviceMask GetDeviceMask () const
 
- Public Member Functions inherited from AZ::RHI::Object
 AZ_RTTI (Object, "{E43378F1-2331-4173-94B8-990ED20E6003}")
 
void SetName (const Name &name)
 Sets the name of the object.
 
const Name & GetName () const
 Returns the name set on the object by SetName.
 
uint32_t use_count ()
 Returns the current use count of the object.
 

Protected Member Functions

virtual void SetDescriptor (const ImageDescriptor &descriptor)
 
- Protected Member Functions inherited from AZ::RHI::MultiDeviceObject
void Init (MultiDevice::DeviceMask deviceMask)
 The derived class should call this method to assign the device.
 
template<typename T >
AZ_FORCE_INLINE void IterateDevices (T callback)
 Helper method that will iterate over all selected devices and call the provided callback.
 
template<typename T , typename U >
AZ_FORCE_INLINE decltype(auto) IterateObjects (U callback)
 
template<typename T , typename U >
AZ_FORCE_INLINE decltype(auto) IterateObjects (U callback) const
 
template<typename T >
AZ_FORCE_INLINE Ptr< T > GetDeviceObject (int deviceIndex) const
 
- Protected Member Functions inherited from AZ::RHI::Object
void add_ref () const
 
void release () const
 

Friends

class ImagePoolBase
 
class ImagePool
 
class TransientAttachmentPool
 
class StreamingImagePool
 
class SwapChain
 

Additional Inherited Members

- Static Public Member Functions inherited from AZ::RHI::MultiDeviceObject
template<typename T >
static AZ_FORCE_INLINE void IterateDevices (MultiDevice::DeviceMask deviceMask, T callback)
 
- Protected Attributes inherited from AZ::RHI::MultiDeviceObject
AZStd::unordered_map< int, Ptr< DeviceObject > > m_deviceObjects
 A map of all device-specific objects, indexed by the device index.
 
- Protected Attributes inherited from AZ::RHI::Object
AZStd::atomic_int m_useCount = 0
 

Detailed Description

Image represents a collection of Image Subresources, where each subresource comprises a one to three dimensional grid of pixels. Images are divided into an array of mip-map chains. A mip map chain is a list of subresources, progressively halved on each axis, down to a 1x1 pixel base image. If an array is used, each array 'slice' is its own mip chain. All mip chains in an array share the same size.

Subresources are organized by a linear indexing scheme: mipSliceOffset + arraySliceOffset * arraySize. The total number of subresources is equal to mipLevels * arraySize. All subresources share the same pixel format.

See also
DeviceImageView on how to interpret contents of an image.

Member Function Documentation

◆ GetDescriptor()

const ImageDescriptor & AZ::RHI::Image::GetDescriptor ( ) const

Returns the image descriptor used to initialize the image. If the image is uninitialized, the contents are considered undefined.

◆ GetFrameAttachment()

const ImageFrameAttachment * AZ::RHI::Image::GetFrameAttachment ( ) const

Returns the image frame attachment if the image is currently attached. This is assigned when the image is imported into the frame scheduler (which is reset every frame). This value will be null for non-attachment images.

◆ GetResidentMipLevel()

uint32_t AZ::RHI::Image::GetResidentMipLevel ( ) const

Returns the most detailed mip level currently resident in memory on any device, where a value of 0 is the highest detailed mip.

◆ GetSubresourceLayout()

void AZ::RHI::Image::GetSubresourceLayout ( ImageSubresourceLayout subresourceLayout,
ImageAspectFlags  aspectFlags = ImageAspectFlags::All 
) const

Computes the subresource layouts and total size of the image contents, if represented linearly. Effectively, this data represents how to store the image in a buffer resource. Naturally, if the image contents are swizzled in device memory, the layouts will differ from the actual physical memory footprint. Use this data to facilitate transfers between buffers and images.

Parameters
subresourceRangeThe range of subresources in the image to consider when computing subresource layouts.
subresourceLayouts[Optional] If specified, fills the provided array with computed subresource layout results. The size of the array must be at least the number of subresources specified in the subresource range (number of mip slices * number of array slices).
totalSizeInBytes[Optional] If specified, will be filled with the total size necessary to contain all subresources.

◆ GetSupportedQueueMask()

HardwareQueueClassMask AZ::RHI::Image::GetSupportedQueueMask ( ) const

Returns the set of queue classes that are supported for usage as an attachment on the frame scheduler. Effectively, for a scope of a specific hardware class to use the image as an attachment, the queue must be present in this mask. This does not apply to non-attachment images on the Compute / Graphics queue.

◆ Shutdown()

void AZ::RHI::Image::Shutdown ( )
finaloverridevirtual

Shuts down the resource by detaching it from its parent pool.

Implements AZ::RHI::Resource.


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