LiteFX 0.3.1.2022
Computer Graphics Engine
LiteFX::Rendering::Backends::DirectX12Image Class Reference

Implements a DirectX12 IImage. More...

#include <image.h>

Inherits LiteFX::Rendering::Backends::IDirectX12Image, LiteFX::Resource< THandle >, and LiteFX::Rendering::StateResource.

Classes

class  DirectX12ImageImpl
 

Public Member Functions

 DirectX12Image (const DirectX12Device &device, ComPtr< ID3D12Resource > &&image, const Size3d &extent, const Format &format, const ImageDimensions &dimension, const UInt32 &levels, const UInt32 &layers, const MultiSamplingLevel &samples, const bool &writable, const ResourceState &initialState, AllocatorPtr allocator=nullptr, AllocationPtr &&allocation=nullptr, const String &name="")
 
 DirectX12Image (DirectX12Image &&)=delete
 
 DirectX12Image (const DirectX12Image &)=delete
 
virtual ~DirectX12Image () noexcept
 
virtual const UInt32elements () const noexcept override
 Gets the number of sub-resources inside the memory chunk. More...
 
virtual size_t size () const noexcept override
 Gets the size (in bytes) of the aligned memory chunk. More...
 
virtual size_t elementSize () const noexcept override
 Returns the size of a single element within the buffer. If there is only one element, this is equal to size. More...
 
virtual size_t elementAlignment () const noexcept override
 Returns the alignment of a single element. More...
 
virtual size_t alignedElementSize () const noexcept override
 Returns the actual size of the element in device memory. More...
 
virtual const bool & writable () const noexcept override
 Returns true, if the resource can be bound to a read/write descriptor. More...
 
virtual const ResourceState & state (const UInt32 &subresource=0) const override
 Returns the current state of the resource. More...
 
virtual ResourceState & state (const UInt32 &subresource=0) override
 Returns a reference of the current state of the resource. More...
 
virtual size_t size (const UInt32 &level) const noexcept override
 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. More...
 
virtual Size3d extent (const UInt32 &level=0) const noexcept override
 Gets the extent of the image at a certain mip-map level. More...
 
virtual const Format & format () const noexcept override
 Gets the internal format of the image. More...
 
virtual const ImageDimensions & dimensions () const noexcept override
 Gets the images dimensionality. More...
 
virtual const UInt32levels () const noexcept override
 Gets the number of mip-map levels of the image. More...
 
virtual const UInt32layers () const noexcept override
 Gets the number of layers (slices) of the image. More...
 
virtual const UInt32planes () const noexcept override
 Returns the number of planes of the image resource. More...
 
virtual const MultiSamplingLevel & samples () const noexcept override
 Gets the number of samples of the texture. More...
 
virtual AllocatorPtr allocator () const noexcept
 
virtual const D3D12MA::Allocation * allocationInfo () const noexcept
 
- Public Member Functions inherited from LiteFX::Rendering::Backends::IDirectX12Image
virtual ~IDirectX12Image () noexcept=default
 
- Public Member Functions inherited from LiteFX::Rendering::IImage
virtual ~IImage () noexcept=default
 
virtual size_t size (const 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. More...
 
virtual Size3d extent (const UInt32 &level=0) const noexcept=0
 Gets the extent of the image at a certain mip-map level. More...
 
virtual const Format & format () const noexcept=0
 Gets the internal format of the image. More...
 
virtual const ImageDimensions & dimensions () const noexcept=0
 Gets the images dimensionality. More...
 
virtual const UInt32levels () const noexcept=0
 Gets the number of mip-map levels of the image. More...
 
virtual const UInt32layers () const noexcept=0
 Gets the number of layers (slices) of the image. More...
 
virtual const UInt32planes () const noexcept=0
 Returns the number of planes of the image resource. More...
 
virtual const MultiSamplingLevel & samples () const noexcept=0
 Gets the number of samples of the texture. More...
 
virtual UInt32 subresourceId (const UInt32 &level, const UInt32 &layer, const UInt32 &plane) const noexcept
 
- Public Member Functions inherited from LiteFX::Rendering::IDeviceMemory
virtual ~IDeviceMemory () noexcept=default
 
virtual const UInt32elements () const noexcept=0
 Gets the number of sub-resources inside the memory chunk. More...
 
virtual size_t size () const noexcept=0
 Gets the size (in bytes) of the aligned memory chunk. More...
 
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. More...
 
virtual size_t elementAlignment () const noexcept=0
 Returns the alignment of a single element. More...
 
virtual size_t alignedElementSize () const noexcept=0
 Returns the actual size of the element in device memory. More...
 
virtual const bool & writable () const noexcept=0
 Returns true, if the resource can be bound to a read/write descriptor. More...
 
virtual const ResourceState & state (const UInt32 &subresource=0) const =0
 Returns the current state of the resource. More...
 
virtual ResourceState & state (const UInt32 &subresource=0)=0
 Returns a reference of the current state of the resource. More...
 
- Public Member Functions inherited from LiteFX::Rendering::IStateResource
virtual ~IStateResource () noexcept=default
 
virtual const Stringname () const noexcept=0
 Returns the name of the resource. More...
 
- Public Member Functions inherited from LiteFX::IResource< ComPtr< ID3D12Resource > >
virtual ~IResource () noexcept=default
 
virtual const ComPtr< ID3D12Resource > & handle () const noexcept=0
 Returns the resource managed by the class. More...
 
- Public Member Functions inherited from LiteFX::Resource< THandle >
 Resource (const Resource &)=delete
 
 Resource (Resource &&)=delete
 
virtual ~Resource () noexcept=default
 
const THandle & handle () const noexcept override
 Returns the resource managed by the class. More...
 
- Public Member Functions inherited from LiteFX::IResource< THandle >
virtual ~IResource () noexcept=default
 
virtual const THandle & handle () const noexcept=0
 Returns the resource managed by the class. More...
 
- Public Member Functions inherited from LiteFX::Rendering::StateResource
 StateResource (StringView name)
 Initializes a new state resource instance. More...
 
 StateResource (StateResource &&)=delete
 
 StateResource (const StateResource &)=delete
 
virtual ~StateResource () noexcept
 
virtual const Stringname () const noexcept override
 Returns the name of the resource. More...
 

Static Public Member Functions

static UniquePtr< DirectX12Imageallocate (const DirectX12Device &device, AllocatorPtr allocator, const Size3d &extent, const Format &format, const ImageDimensions &dimension, const UInt32 &levels, const UInt32 &layers, const MultiSamplingLevel &samples, const bool &writable, const ResourceState &initialState, const D3D12_RESOURCE_DESC &resourceDesc, const D3D12MA::ALLOCATION_DESC &allocationDesc)
 
static UniquePtr< DirectX12Imageallocate (const String &name, const DirectX12Device &device, AllocatorPtr allocator, const Size3d &extent, const Format &format, const ImageDimensions &dimension, const UInt32 &levels, const UInt32 &layers, const MultiSamplingLevel &samples, const bool &writable, const ResourceState &initialState, const D3D12_RESOURCE_DESC &resourceDesc, const D3D12MA::ALLOCATION_DESC &allocationDesc)
 

Additional Inherited Members

- Protected Member Functions inherited from LiteFX::IResource< ComPtr< ID3D12Resource > >
virtual ComPtr< ID3D12Resource > & handle () noexcept=0
 Returns the resource managed by the class. More...
 
- Protected Member Functions inherited from LiteFX::Resource< THandle >
 Resource (const THandle handle) noexcept
 Initializes the managed resource. More...
 
THandle & handle () noexcept override
 Returns the resource managed by the class. More...
 
virtual THandle & handle () noexcept=0
 Returns the resource managed by the class. More...
 
- Protected Member Functions inherited from LiteFX::Rendering::StateResource
 StateResource () noexcept
 
Stringname () noexcept
 

Detailed Description

Implements a DirectX12 IImage.

Constructor & Destructor Documentation

◆ DirectX12Image() [1/3]

DirectX12Image::DirectX12Image ( const DirectX12Device device,
ComPtr< ID3D12Resource > &&  image,
const Size3d extent,
const Format &  format,
const ImageDimensions &  dimension,
const UInt32 levels,
const UInt32 layers,
const MultiSamplingLevel &  samples,
const bool &  writable,
const ResourceState &  initialState,
AllocatorPtr  allocator = nullptr,
AllocationPtr &&  allocation = nullptr,
const String name = "" 
)
explicit

◆ DirectX12Image() [2/3]

LiteFX::Rendering::Backends::DirectX12Image::DirectX12Image ( DirectX12Image &&  )
delete

◆ DirectX12Image() [3/3]

LiteFX::Rendering::Backends::DirectX12Image::DirectX12Image ( const DirectX12Image )
delete

◆ ~DirectX12Image()

DirectX12Image::~DirectX12Image ( )
virtualdefaultnoexcept

Member Function Documentation

◆ alignedElementSize()

size_t DirectX12Image::alignedElementSize ( ) const
overridevirtualnoexcept

Returns the actual size of the element in device memory.

Implements LiteFX::Rendering::IDeviceMemory.

◆ allocate() [1/2]

UniquePtr< DirectX12Image > DirectX12Image::allocate ( const DirectX12Device device,
AllocatorPtr  allocator,
const Size3d extent,
const Format &  format,
const ImageDimensions &  dimension,
const UInt32 levels,
const UInt32 layers,
const MultiSamplingLevel &  samples,
const bool &  writable,
const ResourceState &  initialState,
const D3D12_RESOURCE_DESC &  resourceDesc,
const D3D12MA::ALLOCATION_DESC &  allocationDesc 
)
static

◆ allocate() [2/2]

UniquePtr< DirectX12Image > DirectX12Image::allocate ( const String name,
const DirectX12Device device,
AllocatorPtr  allocator,
const Size3d extent,
const Format &  format,
const ImageDimensions &  dimension,
const UInt32 levels,
const UInt32 layers,
const MultiSamplingLevel &  samples,
const bool &  writable,
const ResourceState &  initialState,
const D3D12_RESOURCE_DESC &  resourceDesc,
const D3D12MA::ALLOCATION_DESC &  allocationDesc 
)
static

◆ allocationInfo()

const D3D12MA::Allocation * DirectX12Image::allocationInfo ( ) const
virtualnoexcept

◆ allocator()

AllocatorPtr DirectX12Image::allocator ( ) const
virtualnoexcept

◆ dimensions()

const ImageDimensions & DirectX12Image::dimensions ( ) const
overridevirtualnoexcept

Gets the images dimensionality.

Implements LiteFX::Rendering::IImage.

◆ elementAlignment()

size_t DirectX12Image::elementAlignment ( ) const
overridevirtualnoexcept

Returns the alignment of a single element.

Implements LiteFX::Rendering::IDeviceMemory.

◆ elements()

const UInt32 & DirectX12Image::elements ( ) const
overridevirtualnoexcept

Gets the number of sub-resources inside the memory chunk.

Implements LiteFX::Rendering::IDeviceMemory.

◆ elementSize()

size_t DirectX12Image::elementSize ( ) const
overridevirtualnoexcept

Returns the size of a single element within the buffer. If there is only one element, this is equal to size.

Implements LiteFX::Rendering::IDeviceMemory.

◆ extent()

Size3d DirectX12Image::extent ( const UInt32 level = 0) const
overridevirtualnoexcept

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

Implements LiteFX::Rendering::IImage.

◆ format()

const Format & DirectX12Image::format ( ) const
overridevirtualnoexcept

Gets the internal format of the image.

Implements LiteFX::Rendering::IImage.

◆ layers()

const UInt32 & DirectX12Image::layers ( ) const
overridevirtualnoexcept

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

Implements LiteFX::Rendering::IImage.

◆ levels()

const UInt32 & DirectX12Image::levels ( ) const
overridevirtualnoexcept

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

Implements LiteFX::Rendering::IImage.

◆ planes()

const UInt32 & DirectX12Image::planes ( ) const
overridevirtualnoexcept

Returns the number of planes of the image resource.

Implements LiteFX::Rendering::IImage.

◆ samples()

const MultiSamplingLevel & DirectX12Image::samples ( ) const
overridevirtualnoexcept

Gets the number of samples of the texture.

Implements LiteFX::Rendering::IImage.

◆ size() [1/2]

size_t DirectX12Image::size ( ) const
overridevirtualnoexcept

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

Implements LiteFX::Rendering::IDeviceMemory.

◆ size() [2/2]

size_t DirectX12Image::size ( const UInt32 level) const
overridevirtualnoexcept

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.

Implements LiteFX::Rendering::IImage.

◆ state() [1/2]

const ResourceState & DirectX12Image::state ( const UInt32 subresource = 0) const
overridevirtual

Returns the current state of the resource.

Implements LiteFX::Rendering::IDeviceMemory.

◆ state() [2/2]

ResourceState & DirectX12Image::state ( const UInt32 subresource = 0)
overridevirtual

Returns a reference of the current state of the resource.

Implements LiteFX::Rendering::IDeviceMemory.

◆ writable()

const bool & DirectX12Image::writable ( ) const
overridevirtualnoexcept

Returns true, if the resource can be bound to a read/write descriptor.

Implements LiteFX::Rendering::IDeviceMemory.