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::RHI::Image Class Reference

#include <Image.h>

Inherits AZ::RHI::Resource.

Inherited by AZ::DX12::Image, AZ::Metal::Image, AZ::Null::Image, and AZ::Vulkan::Image.

Public Member Functions

 AZ_RTTI (Image, "{39FFE66C-805A-41AD-9092-91327D51F64B}", Resource)
 
const ImageDescriptorGetDescriptor () const
 
void GetSubresourceLayouts (const ImageSubresourceRange &subresourceRange, ImageSubresourceLayout *subresourceLayouts, size_t *totalSizeInBytes) const
 
void ReportMemoryUsage (MemoryStatisticsBuilder &builder) const override
 
uint32_t GetResidentMipLevel () const
 
HardwareQueueClassMask GetSupportedQueueMask () const
 
const ImageFrameAttachmentGetFrameAttachment () const
 
Ptr< ImageViewGetImageView (const ImageViewDescriptor &imageViewDescriptor)
 
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.
 
bool IsStreamable () const
 Returns whether the image has sub-resources which can be evicted from or streamed into the device memory.
 
- Public Member Functions inherited from AZ::RHI::Resource
 AZ_RTTI (Resource, "{9D02CDAC-80EB-4B77-8E62-849AC6E69206}", DeviceObject)
 
bool IsAttachment () const
 Returns whether the resource is currently an attachment on a frame graph.
 
void Shutdown () override final
 Shuts down the buffer by detaching it from its parent pool.
 
const ResourcePoolGetPool () const
 
ResourcePoolGetPool ()
 
uint32_t GetVersion () const
 
virtual void ReportMemoryUsage (MemoryStatisticsBuilder &builder) const =0
 Reports memory usage of this image to the memory statistics builder.
 
const FrameAttachmentGetFrameAttachment () const
 Returns the frame attachment associated with this image (if it exists).
 
void InvalidateViews ()
 
bool IsInResourceCache (const ImageViewDescriptor &imageViewDescriptor)
 Returns true if the ResourceView is in the cache.
 
bool IsInResourceCache (const BufferViewDescriptor &bufferViewDescriptor)
 
void EraseResourceView (ResourceView *resourceView) const
 Removes the provided ResourceView from the cache.
 
- Public Member Functions inherited from AZ::RHI::DeviceObject
 AZ_RTTI (DeviceObject, "{17D34F71-944C-4AF5-9823-627474C4C0A6}", Object)
 
bool IsInitialized () const
 Returns whether the device object is initialized.
 
DeviceGetDevice () 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::Resource
Ptr< ImageViewGetResourceView (const ImageViewDescriptor &imageViewDescriptor) const
 Returns view based on the descriptor.
 
Ptr< BufferViewGetResourceView (const BufferViewDescriptor &bufferViewDescriptor) const
 
- Protected Member Functions inherited from AZ::RHI::DeviceObject
void Init (Device &device)
 The derived class should call this method to assign the device.
 
void Shutdown () override
 Clears the current bound device to null.
 
- Protected Member Functions inherited from AZ::RHI::Object
void add_ref () const
 
void release () const
 

Friends

class ImagePoolBase
 
class StreamingImagePool
 

Additional Inherited Members

- 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
ImageView 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, where a value of 0 is the highest detailed mip.

◆ GetSubresourceLayouts()

void AZ::RHI::Image::GetSubresourceLayouts ( const ImageSubresourceRange subresourceRange,
ImageSubresourceLayout subresourceLayouts,
size_t *  totalSizeInBytes 
) 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.

◆ ReportMemoryUsage()

void AZ::RHI::Image::ReportMemoryUsage ( MemoryStatisticsBuilder builder) const
overridevirtual

This implementation estimates memory usage using the descriptor. Platforms may override to report more accurate memory usage.

Implements AZ::RHI::Resource.


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