LiteFX 0.4.1.2025
Computer Graphics Engine
Loading...
Searching...
No Matches
LiteFX::Rendering::IImage Class Referenceabstract

Describes a generic image. More...

#include <rendering_api.hpp>

Inherits LiteFX::Rendering::IDeviceMemory, LiteFX::Rendering::IStateResource, and LiteFX::SharedObject.

Inherited by LiteFX::Rendering::Backends::IDirectX12Image [virtual], and LiteFX::Rendering::Backends::IVulkanImage [virtual].

Public Member Functions

 ~IImage () noexcept override=default
 
virtual size_t size (UInt32 level) const noexcept=0
 Returns the size (in bytes) of an image at a specified mip map level. If the image does not contain the provided mip map level, the method returns 0.
 
virtual Size3d extent (UInt32 level=0) const noexcept=0
 Gets the extent of the image at a certain mip-map level.
 
virtual Format format () const noexcept=0
 Gets the internal format of the image.
 
virtual ImageDimensions dimensions () const noexcept=0
 Gets the images dimensionality.
 
virtual UInt32 levels () const noexcept=0
 Gets the number of mip-map levels of the image.
 
virtual UInt32 layers () const noexcept=0
 Gets the number of layers (slices) of the image.
 
virtual UInt32 planes () const noexcept=0
 Returns the number of planes of the image resource.
 
virtual MultiSamplingLevel samples () const noexcept=0
 Gets the number of samples of the texture.
 
virtual UInt32 subresourceId (UInt32 level, UInt32 layer, UInt32 plane) const noexcept
 Returns the sub-resource ID for a combination of mip-map level , array layer and plane .
 
virtual void resolveSubresource (UInt32 subresource, UInt32 &plane, UInt32 &layer, UInt32 &level) const noexcept
 Returns the plane , layer and level for the provided subresource .
 
virtual size_t size () const noexcept=0
 Gets the size (in bytes) of the aligned memory chunk.
 
- Public Member Functions inherited from LiteFX::Rendering::IDeviceMemory
virtual ~IDeviceMemory () noexcept=default
 
virtual UInt32 elements () const noexcept=0
 Gets the number of sub-resources inside the memory chunk.
 
virtual size_t elementSize () const noexcept=0
 Returns the size of a single element within the buffer. If there is only one element, this is equal to size.
 
virtual size_t elementAlignment () const noexcept=0
 Returns the alignment of a single element.
 
virtual size_t alignedElementSize () const noexcept=0
 Returns the actual size of the element in device memory.
 
virtual ResourceUsage usage () const noexcept=0
 Returns the usage flags for the resource.
 
bool writable () const noexcept
 Returns true, if the resource can be bound to a read/write descriptor.
 
virtual UInt64 virtualAddress () const noexcept=0
 Gets the address of the resource in GPU memory.
 
- Public Member Functions inherited from LiteFX::Rendering::IStateResource
virtual ~IStateResource () noexcept=default
 Releases the state resource instance.
 
virtual const Stringname () const noexcept=0
 Returns the name of the resource.
 
- Public Member Functions inherited from LiteFX::SharedObject
virtual ~SharedObject () noexcept=default
 Destroys the shared object.
 
template<typename TSelf >
auto shared_from_this (this TSelf &&self) noexcept
 Returns a shared pointer to the current object instance.
 
template<typename TSelf >
auto weak_from_this (this TSelf &&self) noexcept -> WeakPtr< std::remove_reference_t< TSelf > >
 Returns a weak pointer to the current object instance.
 

Protected Member Functions

 IImage () noexcept=default
 
 IImage (IImage &&) noexcept=default
 
 IImage (const IImage &)=delete
 
IImageoperator= (IImage &&) noexcept=default
 
IImageoperator= (const IImage &)=delete
 
- Protected Member Functions inherited from LiteFX::Rendering::IDeviceMemory
 IDeviceMemory () noexcept=default
 
 IDeviceMemory (IDeviceMemory &&) noexcept=default
 
 IDeviceMemory (const IDeviceMemory &)=default
 
IDeviceMemoryoperator= (IDeviceMemory &&) noexcept=default
 
IDeviceMemoryoperator= (const IDeviceMemory &)=default
 
- Protected Member Functions inherited from LiteFX::Rendering::IStateResource
 IStateResource () noexcept=default
 
 IStateResource (const IStateResource &)=delete
 
 IStateResource (IStateResource &&) noexcept=default
 
IStateResourceoperator= (const IStateResource &)=delete
 
IStateResourceoperator= (IStateResource &&) noexcept=default
 
- Protected Member Functions inherited from LiteFX::SharedObject
 SharedObject () noexcept=default
 Initializes a new shared object.
 
 SharedObject (SharedObject &&) noexcept=default
 
 SharedObject (const SharedObject &)=default
 
SharedObjectoperator= (SharedObject &&) noexcept=default
 
SharedObjectoperator= (const SharedObject &)=default
 

Additional Inherited Members

- Static Protected Member Functions inherited from LiteFX::SharedObject
template<typename T , typename... TArgs>
static auto create (TArgs &&... args) -> SharedPtr< T >
 Generic factory method used to create instances of the shared object.
 

Detailed Description

Describes a generic image.

Constructor & Destructor Documentation

◆ IImage() [1/3]

LiteFX::Rendering::IImage::IImage ( )
protecteddefaultnoexcept

◆ IImage() [2/3]

LiteFX::Rendering::IImage::IImage ( IImage && )
protecteddefaultnoexcept

◆ IImage() [3/3]

LiteFX::Rendering::IImage::IImage ( const IImage & )
protecteddelete

◆ ~IImage()

LiteFX::Rendering::IImage::~IImage ( )
overridedefaultnoexcept

Member Function Documentation

◆ dimensions()

virtual ImageDimensions LiteFX::Rendering::IImage::dimensions ( ) const
pure virtualnoexcept

Gets the images dimensionality.

The dimensions imply various things, most importantly, which components of the extent are used. Note that cube maps behave like 2D images when the extent is used.

Returns
The images dimensionality.

Implemented in LiteFX::Rendering::Backends::DirectX12Image, and LiteFX::Rendering::Backends::VulkanImage.

◆ extent()

virtual Size3d LiteFX::Rendering::IImage::extent ( UInt32 level = 0) const
pure virtualnoexcept

Gets the extent of the image at a certain mip-map level.

Not all components of the extent are actually used. Check the dimensions to see, which components are required. The extent will be 0 for invalid mip-map levels and 1 or more for valid mip map levels.

Returns
The extent of the image at a certain mip-map level.
See also
dimensions

Implemented in LiteFX::Rendering::Backends::DirectX12Image, and LiteFX::Rendering::Backends::VulkanImage.

◆ format()

virtual Format LiteFX::Rendering::IImage::format ( ) const
pure virtualnoexcept

Gets the internal format of the image.

Returns
The internal format of the image.

Implemented in LiteFX::Rendering::Backends::DirectX12Image, and LiteFX::Rendering::Backends::VulkanImage.

◆ layers()

virtual UInt32 LiteFX::Rendering::IImage::layers ( ) const
pure virtualnoexcept

Gets the number of layers (slices) of the image.

Returns
The number of layers (slices) of the image.

Implemented in LiteFX::Rendering::Backends::DirectX12Image, and LiteFX::Rendering::Backends::VulkanImage.

◆ levels()

virtual UInt32 LiteFX::Rendering::IImage::levels ( ) const
pure virtualnoexcept

Gets the number of mip-map levels of the image.

Returns
The number of mip-map levels of the image.

Implemented in LiteFX::Rendering::Backends::DirectX12Image, and LiteFX::Rendering::Backends::VulkanImage.

◆ operator=() [1/2]

IImage & LiteFX::Rendering::IImage::operator= ( const IImage & )
protecteddelete

◆ operator=() [2/2]

IImage & LiteFX::Rendering::IImage::operator= ( IImage && )
protecteddefaultnoexcept

◆ planes()

virtual UInt32 LiteFX::Rendering::IImage::planes ( ) const
pure virtualnoexcept

Returns the number of planes of the image resource.

The number of planes is dictated by the image format.

Returns
The number of planes of the image resource.
See also
format

Implemented in LiteFX::Rendering::Backends::DirectX12Image, and LiteFX::Rendering::Backends::VulkanImage.

◆ resolveSubresource()

virtual void LiteFX::Rendering::IImage::resolveSubresource ( UInt32 subresource,
UInt32 & plane,
UInt32 & layer,
UInt32 & level ) const
inlinevirtualnoexcept

Returns the plane , layer and level for the provided subresource .

Parameters
subresourceThe sub-resource ID.
planeThe plane index of the sub-resource.
layerThe array layer of the sub-resource.
levelThe mip-map level of the sub-resource.
See also
subresourceId

◆ samples()

virtual MultiSamplingLevel LiteFX::Rendering::IImage::samples ( ) const
pure virtualnoexcept

Gets the number of samples of the texture.

Returns
The number of samples of the texture.

Implemented in LiteFX::Rendering::Backends::DirectX12Image, and LiteFX::Rendering::Backends::VulkanImage.

◆ size() [1/2]

virtual size_t LiteFX::Rendering::IDeviceMemory::size ( ) const
virtualnoexcept

Gets the size (in bytes) of the aligned memory chunk.

The size of the device memory block depends on different factors. The actual used memory of one element can be obtained by calling by the elementSize. For different reasons, though, elements may be required to be aligned to a certain size. The size of one aligned element is returned by alignedElementSize. The size of the memory block, the elements get aligned to is returned by elementAlignment.

Returns
The size (in bytes) of the memory chunk.
See also
elements, elementSize, elementAlignment, alignedElementSize

Implements LiteFX::Rendering::IDeviceMemory.

Reimplemented in LiteFX::Rendering::Backends::VulkanImage.

◆ size() [2/2]

virtual size_t LiteFX::Rendering::IImage::size ( UInt32 level) const
pure virtualnoexcept

Returns the size (in bytes) of an image at a specified mip map level. If the image does not contain the provided mip map level, the method returns 0.

Note that the size will only be returned for one layer. You have to multiply this value by the number of layers, if you want to receive the size of all layers of a certain mip-map level. This is especially important, if you use cube mapping, because this method will only return the size of one face.

Parameters
levelThe mip map level to return the size for.
Returns
The size (in bytes) of an image at a specified mip map level.

Implemented in LiteFX::Rendering::Backends::DirectX12Image, and LiteFX::Rendering::Backends::VulkanImage.

◆ subresourceId()

virtual UInt32 LiteFX::Rendering::IImage::subresourceId ( UInt32 level,
UInt32 layer,
UInt32 plane ) const
inlinevirtualnoexcept

Returns the sub-resource ID for a combination of mip-map level , array layer and plane .

Parameters
levelThe mip map level of the sub-resource.
layerThe array layer of the sub-resource.
planeThe plane of the sub-resource.
Returns
The sub-resource ID for the sub-resource.
See also
resolveSubresource