LiteFX 0.5.1.2025
Computer Graphics Engine
Loading...
Searching...
No Matches
LiteFX::Rendering::IGraphicsFactory Class Referenceabstract

The interface for a graphics factory. More...

#include <rendering_api.hpp>

Inherits LiteFX::SharedObject.

Inherited by LiteFX::Rendering::GraphicsFactory< DirectX12DescriptorLayout, IDirectX12Buffer, IDirectX12VertexBuffer, IDirectX12IndexBuffer, IDirectX12Image, IDirectX12Sampler, DirectX12BottomLevelAccelerationStructure, DirectX12TopLevelAccelerationStructure >, LiteFX::Rendering::GraphicsFactory< VulkanDescriptorLayout, IVulkanBuffer, IVulkanVertexBuffer, IVulkanIndexBuffer, IVulkanImage, IVulkanSampler, VulkanBottomLevelAccelerationStructure, VulkanTopLevelAccelerationStructure >, and LiteFX::Rendering::GraphicsFactory< TDescriptorLayout, TBuffer, TVertexBuffer, TIndexBuffer, TImage, TSampler, TBLAS, TTLAS >.

Public Member Functions

 ~IGraphicsFactory () noexcept override=default
 
virtual VirtualAllocator createAllocator (UInt64 overallMemory, AllocationAlgorithm algorithm=AllocationAlgorithm::Default) const =0
 Creates a virtual allocator that can be used to manage allocation from a custom block of memory.
 
virtual void beginDefragmentation (const ICommandQueue &queue, DefragmentationStrategy strategy=DefragmentationStrategy::Balanced, UInt64 maxBytesToMove=0u, UInt32 maxAllocationsToMove=0u) const =0
 Starts a defragmentation process for the resources allocated from the factory.
 
virtual UInt64 beginDefragmentationPass () const =0
 Starts a new defragmentation pass.
 
virtual bool endDefragmentationPass () const =0
 Ends a defragmentation pass.
 
virtual ResourceAllocationResult allocate (const ResourceAllocationInfo &allocationInfo, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Allocates a single resource as described by allocationInfo .
 
virtual Generator< ResourceAllocationResultallocate (Enumerable< const ResourceAllocationInfo & > allocationInfos, AllocationBehavior allocationBehavior=AllocationBehavior::Default, bool alias=false) const =0
 Allocates a set of resources as described by allocationInfos .
 
virtual bool canAlias (Enumerable< const ResourceAllocationInfo & > allocationInfos) const =0
 Checks if the resources described by allocationInfos can be overlapped.
 
SharedPtr< IBuffercreateBuffer (BufferType type, ResourceHeap heap, size_t elementSize, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates a buffer of type type .
 
bool tryCreateBuffer (SharedPtr< IBuffer > &buffer, BufferType type, ResourceHeap heap, size_t elementSize, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Tries to create a buffer of type type .
 
SharedPtr< IBuffercreateBuffer (const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates a buffer that can be bound to a specific descriptor.
 
bool tryCreateBuffer (SharedPtr< IBuffer > &buffer, const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Tries to create a buffer that can be bound to a specific descriptor.
 
SharedPtr< IBuffercreateBuffer (const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, UInt32 elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates a buffer that can be bound to a specific descriptor.
 
bool tryCreateBuffer (SharedPtr< IBuffer > &buffer, const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, UInt32 elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Tries to create a buffer that can be bound to a specific descriptor.
 
SharedPtr< IBuffercreateBuffer (const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, UInt32 elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates a buffer that can be bound to a descriptor of a specific descriptor set.
 
bool tryCreateBuffer (SharedPtr< IBuffer > &buffer, const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, UInt32 elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Tries to create a buffer that can be bound to a descriptor of a specific descriptor set.
 
SharedPtr< IBuffercreateBuffer (const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates a buffer that can be bound to a descriptor of a specific descriptor set.
 
bool tryCreateBuffer (SharedPtr< IBuffer > &buffer, const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Tries to create a buffer that can be bound to a descriptor of a specific descriptor set.
 
SharedPtr< IBuffercreateBuffer (const String &name, BufferType type, ResourceHeap heap, size_t elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates a buffer of type type .
 
bool tryCreateBuffer (SharedPtr< IBuffer > &buffer, const String &name, BufferType type, ResourceHeap heap, size_t elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Tries to create a buffer of type type .
 
SharedPtr< IBuffercreateBuffer (const String &name, const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates a buffer that can be bound to a specific descriptor.
 
bool tryCreateBuffer (SharedPtr< IBuffer > &buffer, const String &name, const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Tries to create a buffer that can be bound to a specific descriptor.
 
SharedPtr< IBuffercreateBuffer (const String &name, const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, size_t elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates a buffer that can be bound to a specific descriptor.
 
bool tryCreateBuffer (SharedPtr< IBuffer > &buffer, const String &name, const IDescriptorSetLayout &descriptorSet, UInt32 binding, ResourceHeap heap, size_t elementSize, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Tries to create a buffer that can be bound to a specific descriptor.
 
SharedPtr< IBuffercreateBuffer (const String &name, const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates a buffer that can be bound to a descriptor of a specific descriptor set.
 
bool tryCreateBuffer (SharedPtr< IBuffer > &buffer, const String &name, const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Tries to create a buffer that can be bound to a descriptor of a specific descriptor set.
 
SharedPtr< IBuffercreateBuffer (const String &name, const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, size_t elementSize, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates a buffer that can be bound to a descriptor of a specific descriptor set.
 
bool tryCreateBuffer (SharedPtr< IBuffer > &buffer, const String &name, const IPipeline &pipeline, UInt32 space, UInt32 binding, ResourceHeap heap, size_t elementSize, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Tries to create a buffer that can be bound to a descriptor of a specific descriptor set.
 
SharedPtr< IVertexBuffercreateVertexBuffer (const IVertexBufferLayout &layout, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates a vertex buffer, based on the layout .
 
bool tryCreateVertexBuffer (SharedPtr< IVertexBuffer > &buffer, const IVertexBufferLayout &layout, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Tries to create a vertex buffer, based on the layout .
 
SharedPtr< IVertexBuffercreateVertexBuffer (const String &name, const IVertexBufferLayout &layout, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates a vertex buffer, based on the layout .
 
bool tryCreateVertexBuffer (SharedPtr< IVertexBuffer > &buffer, const String &name, const IVertexBufferLayout &layout, ResourceHeap heap, UInt32 elements=1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Tries to create a vertex buffer, based on the layout .
 
SharedPtr< IIndexBuffercreateIndexBuffer (const IIndexBufferLayout &layout, ResourceHeap heap, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates an index buffer, based on the layout .
 
bool tryCreateIndexBuffer (SharedPtr< IIndexBuffer > &buffer, const IIndexBufferLayout &layout, ResourceHeap heap, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Tries to create an index buffer, based on the layout .
 
SharedPtr< IIndexBuffercreateIndexBuffer (const String &name, const IIndexBufferLayout &layout, ResourceHeap heap, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates an index buffer, based on the layout .
 
bool tryCreateIndexBuffer (SharedPtr< IIndexBuffer > &buffer, const String &name, const IIndexBufferLayout &layout, ResourceHeap heap, UInt32 elements, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Tries to create an index buffer, based on the layout .
 
SharedPtr< IImagecreateTexture (Format format, const Size3d &size, ImageDimensions dimension=ImageDimensions::DIM_2, UInt32 levels=1, UInt32 layers=1, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates a texture.
 
bool tryCreateTexture (SharedPtr< IImage > &image, Format format, const Size3d &size, ImageDimensions dimension=ImageDimensions::DIM_2, UInt32 levels=1, UInt32 layers=1, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Tries to create a texture.
 
SharedPtr< IImagecreateTexture (const String &name, Format format, const Size3d &size, ImageDimensions dimension=ImageDimensions::DIM_2, UInt32 levels=1, UInt32 layers=1, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates a texture.
 
bool tryCreateTexture (SharedPtr< IImage > &image, const String &name, Format format, const Size3d &size, ImageDimensions dimension=ImageDimensions::DIM_2, UInt32 levels=1, UInt32 layers=1, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Tries to create a texture.
 
Generator< SharedPtr< IImage > > createTextures (Format format, const Size3d &size, ImageDimensions dimension=ImageDimensions::DIM_2, UInt32 layers=1, UInt32 levels=1, MultiSamplingLevel samples=MultiSamplingLevel::x1, ResourceUsage usage=ResourceUsage::Default, AllocationBehavior allocationBehavior=AllocationBehavior::Default) const
 Creates a series of textures.
 
SharedPtr< ISamplercreateSampler (FilterMode magFilter=FilterMode::Nearest, FilterMode minFilter=FilterMode::Nearest, BorderMode borderU=BorderMode::Repeat, BorderMode borderV=BorderMode::Repeat, BorderMode borderW=BorderMode::Repeat, MipMapMode mipMapMode=MipMapMode::Nearest, Float mipMapBias=0.f, Float maxLod=std::numeric_limits< Float >::max(), Float minLod=0.f, Float anisotropy=0.f) const
 Creates a texture sampler.
 
SharedPtr< ISamplercreateSampler (const String &name, FilterMode magFilter=FilterMode::Nearest, FilterMode minFilter=FilterMode::Nearest, BorderMode borderU=BorderMode::Repeat, BorderMode borderV=BorderMode::Repeat, BorderMode borderW=BorderMode::Repeat, MipMapMode mipMapMode=MipMapMode::Nearest, Float mipMapBias=0.f, Float maxLod=std::numeric_limits< Float >::max(), Float minLod=0.f, Float anisotropy=0.f) const
 Creates a texture sampler.
 
Generator< SharedPtr< ISampler > > createSamplers (FilterMode magFilter=FilterMode::Nearest, FilterMode minFilter=FilterMode::Nearest, BorderMode borderU=BorderMode::Repeat, BorderMode borderV=BorderMode::Repeat, BorderMode borderW=BorderMode::Repeat, MipMapMode mipMapMode=MipMapMode::Nearest, Float mipMapBias=0.f, Float maxLod=std::numeric_limits< Float >::max(), Float minLod=0.f, Float anisotropy=0.f) const
 Creates a series of texture samplers.
 
UniquePtr< IBottomLevelAccelerationStructurecreateBottomLevelAccelerationStructure (AccelerationStructureFlags flags=AccelerationStructureFlags::None) const
 Creates a bottom-level acceleration structure.
 
UniquePtr< IBottomLevelAccelerationStructurecreateBottomLevelAccelerationStructure (StringView name, AccelerationStructureFlags flags=AccelerationStructureFlags::None) const
 Creates a bottom-level acceleration structure.
 
UniquePtr< ITopLevelAccelerationStructurecreateTopLevelAccelerationStructure (AccelerationStructureFlags flags=AccelerationStructureFlags::None) const
 Creates a top-level acceleration structure.
 
UniquePtr< ITopLevelAccelerationStructurecreateTopLevelAccelerationStructure (StringView name, AccelerationStructureFlags flags=AccelerationStructureFlags::None) const
 Creates a top-level acceleration structure.
 
virtual bool supportsResizableBaseAddressRegister () const noexcept=0
 Returns true, if the GPU supports resizable base address register (ReBAR) and false otherwise.
 
virtual Array< MemoryHeapStatisticsmemoryStatistics () const =0
 Returns an array of objects, that contain information about the current memory usage and available memory for a memory heap.
 
virtual DetailedMemoryStatistics detailedMemoryStatistics () const =0
 Returns detailed memory statistics.
 
- 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

 IGraphicsFactory () noexcept=default
 
 IGraphicsFactory (IGraphicsFactory &&) noexcept=default
 
 IGraphicsFactory (const IGraphicsFactory &)=default
 
IGraphicsFactoryoperator= (const IGraphicsFactory &)=default
 
IGraphicsFactoryoperator= (IGraphicsFactory &&) 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

The interface for a graphics factory.

Constructor & Destructor Documentation

◆ IGraphicsFactory() [1/3]

LiteFX::Rendering::IGraphicsFactory::IGraphicsFactory ( )
protecteddefaultnoexcept

◆ IGraphicsFactory() [2/3]

LiteFX::Rendering::IGraphicsFactory::IGraphicsFactory ( IGraphicsFactory && )
protecteddefaultnoexcept

◆ IGraphicsFactory() [3/3]

LiteFX::Rendering::IGraphicsFactory::IGraphicsFactory ( const IGraphicsFactory & )
protecteddefault

◆ ~IGraphicsFactory()

LiteFX::Rendering::IGraphicsFactory::~IGraphicsFactory ( )
overridedefaultnoexcept

Member Function Documentation

◆ allocate() [1/2]

virtual ResourceAllocationResult LiteFX::Rendering::IGraphicsFactory::allocate ( const ResourceAllocationInfo & allocationInfo,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inlinevirtual

Allocates a single resource as described by allocationInfo .

Parameters
allocationInfoThe description of the resource to allocate.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The resource allocation result.

◆ allocate() [2/2]

virtual Generator< ResourceAllocationResult > LiteFX::Rendering::IGraphicsFactory::allocate ( Enumerable< const ResourceAllocationInfo & > allocationInfos,
AllocationBehavior allocationBehavior = AllocationBehavior::Default,
bool alias = false ) const
pure virtual

Allocates a set of resources as described by allocationInfos .

If the alias parameter is set to true, the allocator attempts to overlap the resources in a single allocation, which saves memory. However, this implies that the resources must be properly synchronized and accessed according to the aliasing rules imposed by the backend. Most notably, you have to manually insert aliasing barriers to isolate access.

Note that overlapping arbitrary resource types might not be possible on each GPU. You can check if aliasing is supported for the desired resources by calling canAlias first. If aliasing is not possible, you can instead fallback to non-overlapping resources by setting the alias parameter to false accordingly. If you attempt to allocate aliasing resources on an unsupported GPU directly, this method will raise an error.

Parameters
allocationInfosThe description of the resources to allocate.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
aliastrue if the allocator should attempt to overlap the allocations and false otherwise.
Returns
A generator that returns the individual resources that have been allocated.
See also
canAlias
Exceptions
InvalidArgumentExceptionThrown, if the alias parameter is set to true, but the provided allocationInfos cannot be overlapped on the system's GPU.

Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.

◆ beginDefragmentation()

virtual void LiteFX::Rendering::IGraphicsFactory::beginDefragmentation ( const ICommandQueue & queue,
DefragmentationStrategy strategy = DefragmentationStrategy::Balanced,
UInt64 maxBytesToMove = 0u,
UInt32 maxAllocationsToMove = 0u ) const
pure virtual

Starts a defragmentation process for the resources allocated from the factory.

Defragmentation is an iterative process. Calling this method starts defragmentation, which is then advanced by alternating calls to beginDefragmentationPass and endDefragmentationPass. The process ends if endDefragmentationPass returns true.

During a defragmentation pass, a number of resources may get allocated and the memory and filled with memory from resources that will later be destroyed. Each iteration will only create a certain number of such move events, which is mainly influenced by the maxBytesToMove and maxAllocationsToMove parameters, as well as the provided strategy . This way, the number of moves per frame can be limited, which helps with keeping a steady frame rate.

Moving a resource happens by recording copy commands on a command buffer created from queue . If a resource does not need to be copied, for example because it only contains temporary data, you can set the IDeviceMemory::volatileMove property to true. This will only allocate a new resource, but wont copy the contents of the old allocation.

Calling beginDefragmentationPass returns the fence on that queue after which the move commands have been executed. You can either manually wait for the fence (e.g., by calling ICommandQueue::lastCompletedFence) or call endDefragmentationPass directly. Keep in mind that endDefragmentationPass blocks to wait for the last fence to finish, so you might want to consider the alternative approach if you are doing per-frame defragmentation.

Calling this method while another defragmentation process is active will raise an exception.

Parameters
queueThe queue to execute the move commands on.
strategyThe strategy to pack the fragmented memory.
maxBytesToMoveThe maximum number of bytes to move during this pass or 0, if no limitation should be imposed.
maxAllocationsToMoveThe maximum number of allocations to move during this pass or 0, if no limitation should be imposed.
Exceptions
RuntimeExceptionThrown, if another defragmentation process is currently running and has not yet finished.

Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.

◆ beginDefragmentationPass()

virtual UInt64 LiteFX::Rendering::IGraphicsFactory::beginDefragmentationPass ( ) const
pure virtual

Starts a new defragmentation pass.

Before calling this method, make sure you have started a defragmentation process by calling beginDefragmentation. If no defragmentation process is currently started, calling this method raises an exception.

You are expected to issue alternating calls to this method and endDefragmentationPass. This can happen either at the beginning or end of a frame, or on a separate thread.

In between a call to this method and endDefragmentationPass, the moved-from resources remain valid. Only after the move has finished and endDefragmentationPass has been called, they will get invalidated. This means, that you might have to update descriptor bindings for the resource. You can subscribe to the IDeviceMemory::moved event for this purpose. You might also want to issue a barrier to transition an image resource back into the required layout. Calling this method will leave the new resource in a ImageLayout::Common state.

See also
beginDefragmentation, endDefragmentationPass
Exceptions
RuntimeExceptionThrown, if no defragmentation process is currently active.

Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.

◆ canAlias()

virtual bool LiteFX::Rendering::IGraphicsFactory::canAlias ( Enumerable< const ResourceAllocationInfo & > allocationInfos) const
pure virtual

Checks if the resources described by allocationInfos can be overlapped.

Parameters
allocationInfosThe resource descriptions to check.
Returns
true, if the resources described by allocationInfos can be overlapped and false otherwise.
See also
allocate, ResourceAllocationInfo::AliasingOffset

Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.

◆ createAllocator()

virtual VirtualAllocator LiteFX::Rendering::IGraphicsFactory::createAllocator ( UInt64 overallMemory,
AllocationAlgorithm algorithm = AllocationAlgorithm::Default ) const
nodiscardpure virtual

Creates a virtual allocator that can be used to manage allocation from a custom block of memory.

Parameters
overallMemoryThe overall size (in bytes) of memory available to the allocator.
algorithmThe algorithm used to find a suitable block in the allocator memory.
Returns
The instance of the virtual allocator.

Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.

◆ createBottomLevelAccelerationStructure() [1/2]

UniquePtr< IBottomLevelAccelerationStructure > LiteFX::Rendering::IGraphicsFactory::createBottomLevelAccelerationStructure ( AccelerationStructureFlags flags = AccelerationStructureFlags::None) const
inline

Creates a bottom-level acceleration structure.

This method is only supported if the GraphicsDeviceFeature::RayTracing feature is enabled.

Parameters
flagsThe flags that define how the acceleration structure is built.
Returns
The bottom-level acceleration structure instance.
See also
IBottomLevelAccelerationStructure

◆ createBottomLevelAccelerationStructure() [2/2]

UniquePtr< IBottomLevelAccelerationStructure > LiteFX::Rendering::IGraphicsFactory::createBottomLevelAccelerationStructure ( StringView name,
AccelerationStructureFlags flags = AccelerationStructureFlags::None ) const
inline

Creates a bottom-level acceleration structure.

This method is only supported if the GraphicsDeviceFeature::RayTracing feature is enabled.

Parameters
nameThe name of the acceleration structure resource.
flagsThe flags that define how the acceleration structure is built.
Returns
The bottom-level acceleration structure instance.
See also
IBottomLevelAccelerationStructure

◆ createBuffer() [1/10]

SharedPtr< IBuffer > LiteFX::Rendering::IGraphicsFactory::createBuffer ( BufferType type,
ResourceHeap heap,
size_t elementSize,
UInt32 elements = 1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates a buffer of type type .

Parameters
typeThe type of the buffer.
heapThe heap to allocate the buffer on.
elementSizeThe size of an element in the buffer (in bytes).
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The instance of the buffer.

◆ createBuffer() [2/10]

SharedPtr< IBuffer > LiteFX::Rendering::IGraphicsFactory::createBuffer ( const IDescriptorSetLayout & descriptorSet,
UInt32 binding,
ResourceHeap heap,
UInt32 elements = 1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates a buffer that can be bound to a specific descriptor.

Parameters
descriptorSetThe layout of the descriptors parent descriptor set.
bindingThe binding point of the descriptor within the parent descriptor set.
heapThe heap to allocate the buffer on.
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The instance of the buffer.

◆ createBuffer() [3/10]

SharedPtr< IBuffer > LiteFX::Rendering::IGraphicsFactory::createBuffer ( const IDescriptorSetLayout & descriptorSet,
UInt32 binding,
ResourceHeap heap,
UInt32 elementSize,
UInt32 elements,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates a buffer that can be bound to a specific descriptor.

Parameters
descriptorSetThe layout of the descriptors parent descriptor set.
bindingThe binding point of the descriptor within the parent descriptor set.
heapThe heap to allocate the buffer on.
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The instance of the buffer.

◆ createBuffer() [4/10]

SharedPtr< IBuffer > LiteFX::Rendering::IGraphicsFactory::createBuffer ( const IPipeline & pipeline,
UInt32 space,
UInt32 binding,
ResourceHeap heap,
UInt32 elements = 1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates a buffer that can be bound to a descriptor of a specific descriptor set.

Parameters
pipelineThe pipeline that provides the descriptor set.
spaceThe space, the descriptor set is bound to.
bindingThe binding point of the descriptor within the parent descriptor set.
heapThe heap to allocate the buffer on.
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The instance of the buffer.

◆ createBuffer() [5/10]

SharedPtr< IBuffer > LiteFX::Rendering::IGraphicsFactory::createBuffer ( const IPipeline & pipeline,
UInt32 space,
UInt32 binding,
ResourceHeap heap,
UInt32 elementSize,
UInt32 elements,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates a buffer that can be bound to a descriptor of a specific descriptor set.

Parameters
pipelineThe pipeline that provides the descriptor set.
spaceThe space, the descriptor set is bound to.
bindingThe binding point of the descriptor within the parent descriptor set.
heapThe heap to allocate the buffer on.
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The instance of the buffer.

◆ createBuffer() [6/10]

SharedPtr< IBuffer > LiteFX::Rendering::IGraphicsFactory::createBuffer ( const String & name,
BufferType type,
ResourceHeap heap,
size_t elementSize,
UInt32 elements,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates a buffer of type type .

Parameters
nameThe name of the buffer.
typeThe type of the buffer.
heapThe heap to allocate the buffer on.
elementSizeThe size of an element in the buffer (in bytes).
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The instance of the buffer.

◆ createBuffer() [7/10]

SharedPtr< IBuffer > LiteFX::Rendering::IGraphicsFactory::createBuffer ( const String & name,
const IDescriptorSetLayout & descriptorSet,
UInt32 binding,
ResourceHeap heap,
size_t elementSize,
UInt32 elements,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates a buffer that can be bound to a specific descriptor.

Parameters
nameThe name of the buffer.
descriptorSetThe layout of the descriptors parent descriptor set.
bindingThe binding point of the descriptor within the parent descriptor set.
heapThe heap to allocate the buffer on.
elementSizeThe size of an element in the buffer (in bytes).
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The instance of the buffer.

◆ createBuffer() [8/10]

SharedPtr< IBuffer > LiteFX::Rendering::IGraphicsFactory::createBuffer ( const String & name,
const IDescriptorSetLayout & descriptorSet,
UInt32 binding,
ResourceHeap heap,
UInt32 elements = 1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates a buffer that can be bound to a specific descriptor.

Parameters
nameThe name of the buffer.
descriptorSetThe layout of the descriptors parent descriptor set.
bindingThe binding point of the descriptor within the parent descriptor set.
heapThe heap to allocate the buffer on.
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The instance of the buffer.

◆ createBuffer() [9/10]

SharedPtr< IBuffer > LiteFX::Rendering::IGraphicsFactory::createBuffer ( const String & name,
const IPipeline & pipeline,
UInt32 space,
UInt32 binding,
ResourceHeap heap,
size_t elementSize,
UInt32 elements = 1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates a buffer that can be bound to a descriptor of a specific descriptor set.

Parameters
nameThe name of the buffer.
pipelineThe pipeline that provides the descriptor set.
spaceThe space, the descriptor set is bound to.
bindingThe binding point of the descriptor within the parent descriptor set.
heapThe heap to allocate the buffer on.
elementSizeThe size of an element in the buffer (in bytes).
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The instance of the buffer.

◆ createBuffer() [10/10]

SharedPtr< IBuffer > LiteFX::Rendering::IGraphicsFactory::createBuffer ( const String & name,
const IPipeline & pipeline,
UInt32 space,
UInt32 binding,
ResourceHeap heap,
UInt32 elements = 1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates a buffer that can be bound to a descriptor of a specific descriptor set.

Parameters
nameThe name of the buffer.
pipelineThe pipeline that provides the descriptor set.
spaceThe space, the descriptor set is bound to.
bindingThe binding point of the descriptor within the parent descriptor set.
heapThe heap to allocate the buffer on.
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The instance of the buffer.

◆ createIndexBuffer() [1/2]

SharedPtr< IIndexBuffer > LiteFX::Rendering::IGraphicsFactory::createIndexBuffer ( const IIndexBufferLayout & layout,
ResourceHeap heap,
UInt32 elements,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates an index buffer, based on the layout .

An index buffer can be used by different RenderPipelines, as long as they share a common input assembler state.

The size of the buffer is computed from the element size index buffer layout, times the number of elements given by the elements parameter.

Parameters
layoutThe layout of the index buffer.
heapThe heap to allocate the buffer on.
elementsThe number of elements within the vertex buffer (i.e. the number of indices).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The instance of the index buffer.

◆ createIndexBuffer() [2/2]

SharedPtr< IIndexBuffer > LiteFX::Rendering::IGraphicsFactory::createIndexBuffer ( const String & name,
const IIndexBufferLayout & layout,
ResourceHeap heap,
UInt32 elements,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates an index buffer, based on the layout .

An index buffer can be used by different RenderPipelines, as long as they share a common input assembler state.

The size of the buffer is computed from the element size index buffer layout, times the number of elements given by the elements parameter.

Parameters
nameThe name of the buffer.
layoutThe layout of the index buffer.
heapThe heap to allocate the buffer on.
usageThe intended usage for the buffer.
elementsThe number of elements within the vertex buffer (i.e. the number of indices).
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The instance of the index buffer.

◆ createSampler() [1/2]

SharedPtr< ISampler > LiteFX::Rendering::IGraphicsFactory::createSampler ( const String & name,
FilterMode magFilter = FilterMode::Nearest,
FilterMode minFilter = FilterMode::Nearest,
BorderMode borderU = BorderMode::Repeat,
BorderMode borderV = BorderMode::Repeat,
BorderMode borderW = BorderMode::Repeat,
MipMapMode mipMapMode = MipMapMode::Nearest,
Float mipMapBias = 0.f,
Float maxLod = std::numeric_limits<Float>::max(),
Float minLod = 0.f,
Float anisotropy = 0.f ) const
inline

Creates a texture sampler.

Parameters
nameThe name of the sampler.
magFilterThe filter operation used for magnifying.
minFilterThe filter operation used for minifying.
borderUThe border mode along the U-axis.
borderVThe border mode along the V-axis.
borderWThe border mode along the W-axis.
mipMapModeThe mip map mode.
mipMapBiasThe mip map bias.
maxLodThe maximum level of detail value.
minLodThe minimum level of detail value.
anisotropyThe level of anisotropic filtering.
Returns
The instance of the sampler.
See also
createSamplers

◆ createSampler() [2/2]

SharedPtr< ISampler > LiteFX::Rendering::IGraphicsFactory::createSampler ( FilterMode magFilter = FilterMode::Nearest,
FilterMode minFilter = FilterMode::Nearest,
BorderMode borderU = BorderMode::Repeat,
BorderMode borderV = BorderMode::Repeat,
BorderMode borderW = BorderMode::Repeat,
MipMapMode mipMapMode = MipMapMode::Nearest,
Float mipMapBias = 0.f,
Float maxLod = std::numeric_limits<Float>::max(),
Float minLod = 0.f,
Float anisotropy = 0.f ) const
inline

Creates a texture sampler.

Parameters
magFilterThe filter operation used for magnifying.
minFilterThe filter operation used for minifying.
borderUThe border mode along the U-axis.
borderVThe border mode along the V-axis.
borderWThe border mode along the W-axis.
mipMapModeThe mip map mode.
mipMapBiasThe mip map bias.
maxLodThe maximum level of detail value.
minLodThe minimum level of detail value.
anisotropyThe level of anisotropic filtering.
Returns
The instance of the sampler.
See also
createSamplers

◆ createSamplers()

Generator< SharedPtr< ISampler > > LiteFX::Rendering::IGraphicsFactory::createSamplers ( FilterMode magFilter = FilterMode::Nearest,
FilterMode minFilter = FilterMode::Nearest,
BorderMode borderU = BorderMode::Repeat,
BorderMode borderV = BorderMode::Repeat,
BorderMode borderW = BorderMode::Repeat,
MipMapMode mipMapMode = MipMapMode::Nearest,
Float mipMapBias = 0.f,
Float maxLod = std::numeric_limits<Float>::max(),
Float minLod = 0.f,
Float anisotropy = 0.f ) const
inline

Creates a series of texture samplers.

Parameters
magFilterThe filter operation used for magnifying.
minFilterThe filter operation used for minifying.
borderUThe border mode along the U-axis.
borderVThe border mode along the V-axis.
borderWThe border mode along the W-axis.
mipMapModeThe mip map mode.
mipMapBiasThe mip map bias.
maxLodThe maximum level of detail value.
minLodThe minimum level of detail value.
anisotropyThe level of anisotropic filtering.
Returns
A generator for sampler instances.
See also
createSampler

◆ createTexture() [1/2]

SharedPtr< IImage > LiteFX::Rendering::IGraphicsFactory::createTexture ( const String & name,
Format format,
const Size3d & size,
ImageDimensions dimension = ImageDimensions::DIM_2,
UInt32 levels = 1,
UInt32 layers = 1,
MultiSamplingLevel samples = MultiSamplingLevel::x1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates a texture.

A texture in LiteFX is always backed by GPU-only visible memory and thus can only be transferred to/from. Thus you typically have to create a buffer using createBuffer first that holds the actual image bytes. You than can transfer/copy the contents into the texture.

Parameters
nameThe name of the texture image.
formatThe format of the texture image.
sizeThe dimensions of the texture.
dimensionThe dimensionality of the texture.
layersThe number of layers (slices) in this texture.
levelsThe number of mip map levels of the texture.
samplesThe number of samples, the texture should be sampled with.
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The instance of the texture.
See also
createTextures

◆ createTexture() [2/2]

SharedPtr< IImage > LiteFX::Rendering::IGraphicsFactory::createTexture ( Format format,
const Size3d & size,
ImageDimensions dimension = ImageDimensions::DIM_2,
UInt32 levels = 1,
UInt32 layers = 1,
MultiSamplingLevel samples = MultiSamplingLevel::x1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates a texture.

A texture in LiteFX is always backed by GPU-only visible memory and thus can only be transferred to/from. Thus you typically have to create a buffer using createBuffer first that holds the actual image bytes. You than can transfer/copy the contents into the texture.

Parameters
formatThe format of the texture image.
sizeThe dimensions of the texture.
dimensionThe dimensionality of the texture.
layersThe number of layers (slices) in this texture.
levelsThe number of mip map levels of the texture.
samplesThe number of samples, the texture should be sampled with.
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The instance of the texture.
See also
createTextures

◆ createTextures()

Generator< SharedPtr< IImage > > LiteFX::Rendering::IGraphicsFactory::createTextures ( Format format,
const Size3d & size,
ImageDimensions dimension = ImageDimensions::DIM_2,
UInt32 layers = 1,
UInt32 levels = 1,
MultiSamplingLevel samples = MultiSamplingLevel::x1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates a series of textures.

Parameters
formatThe format of the texture images.
sizeThe dimensions of the textures.
layersThe number of layers (slices) in this texture.
levelsThe number of mip map levels of the textures.
samplesThe number of samples, the textures should be sampled with.
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
A generator for texture instances.
See also
createTexture

◆ createTopLevelAccelerationStructure() [1/2]

UniquePtr< ITopLevelAccelerationStructure > LiteFX::Rendering::IGraphicsFactory::createTopLevelAccelerationStructure ( AccelerationStructureFlags flags = AccelerationStructureFlags::None) const
inline

Creates a top-level acceleration structure.

This method is only supported if the GraphicsDeviceFeature::RayTracing feature is enabled.

Parameters
flagsThe flags that define how the acceleration structure is built.
Returns
The top-level acceleration structure instance.
See also
ITopLevelAccelerationStructure

◆ createTopLevelAccelerationStructure() [2/2]

UniquePtr< ITopLevelAccelerationStructure > LiteFX::Rendering::IGraphicsFactory::createTopLevelAccelerationStructure ( StringView name,
AccelerationStructureFlags flags = AccelerationStructureFlags::None ) const
inline

Creates a top-level acceleration structure.

This method is only supported if the GraphicsDeviceFeature::RayTracing feature is enabled.

Parameters
nameThe name of the acceleration structure resource.
flagsThe flags that define how the acceleration structure is built.
Returns
The top-level acceleration structure instance.
See also
ITopLevelAccelerationStructure

◆ createVertexBuffer() [1/2]

SharedPtr< IVertexBuffer > LiteFX::Rendering::IGraphicsFactory::createVertexBuffer ( const IVertexBufferLayout & layout,
ResourceHeap heap,
UInt32 elements = 1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates a vertex buffer, based on the layout .

A vertex buffer can be used by different RenderPipelines, as long as they share a common input assembler state.

The size of the buffer is computed from the element size vertex buffer layout, times the number of elements given by the elements parameter.

Parameters
layoutThe layout of the vertex buffer.
heapThe heap to allocate the buffer on.
elementsThe number of elements within the vertex buffer (i.e. the number of vertices).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The instance of the vertex buffer.

◆ createVertexBuffer() [2/2]

SharedPtr< IVertexBuffer > LiteFX::Rendering::IGraphicsFactory::createVertexBuffer ( const String & name,
const IVertexBufferLayout & layout,
ResourceHeap heap,
UInt32 elements = 1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Creates a vertex buffer, based on the layout .

A vertex buffer can be used by different RenderPipelines, as long as they share a common input assembler state.

The size of the buffer is computed from the element size vertex buffer layout, times the number of elements given by the elements parameter.

Parameters
nameThe name of the buffer.
layoutThe layout of the vertex buffer.
heapThe heap to allocate the buffer on.
elementsThe number of elements within the vertex buffer (i.e. the number of vertices).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
The instance of the vertex buffer.

◆ detailedMemoryStatistics()

virtual DetailedMemoryStatistics LiteFX::Rendering::IGraphicsFactory::detailedMemoryStatistics ( ) const
pure virtual

Returns detailed memory statistics.

Only call this method for debugging purposes, as it is significantly slower compared to memoryStatistics, which can be called multiple times every frame without any significant performance impact.

Returns
The detailed memory statistics of the application.

Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.

◆ endDefragmentationPass()

virtual bool LiteFX::Rendering::IGraphicsFactory::endDefragmentationPass ( ) const
pure virtual

Ends a defragmentation pass.

Before calling this method, make sure you have started a defragmentation process by calling beginDefragmentation. If no defragmentation process is currently started, calling this method raises an exception.

This method waits for the fence issued by the last call to beginDefragmentation before first invoking the IDeviceMemory::moved event on all affected resources and finally destroying the moved-from resources.

See also
beginDefragmentation, beginDefragmentationPass
Exceptions
RuntimeExceptionThrown, if no defragmentation process is currently active.

Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.

◆ memoryStatistics()

virtual Array< MemoryHeapStatistics > LiteFX::Rendering::IGraphicsFactory::memoryStatistics ( ) const
pure virtual

Returns an array of objects, that contain information about the current memory usage and available memory for a memory heap.

Returns
An array of objects, containing memory statistics for a memory heap.

Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.

◆ operator=() [1/2]

IGraphicsFactory & LiteFX::Rendering::IGraphicsFactory::operator= ( const IGraphicsFactory & )
protecteddefault

◆ operator=() [2/2]

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

◆ supportsResizableBaseAddressRegister()

virtual bool LiteFX::Rendering::IGraphicsFactory::supportsResizableBaseAddressRegister ( ) const
pure virtualnoexcept

Returns true, if the GPU supports resizable base address register (ReBAR) and false otherwise.

If the GPU supports resizable base address register (ReBAR), you can use ResourceHeap::GPUUpload for buffers to directly write map into GPU memory. If it is not supported, you may want to fall back to a ResourceHeap::Dynamic resource instead.

Returns
true, if the GPU supports resizable base address register (ReBAR) and false otherwise.

Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.

◆ tryCreateBuffer() [1/10]

bool LiteFX::Rendering::IGraphicsFactory::tryCreateBuffer ( SharedPtr< IBuffer > & buffer,
BufferType type,
ResourceHeap heap,
size_t elementSize,
UInt32 elements = 1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Tries to create a buffer of type type .

Parameters
bufferThe instance of the buffer, or nullptr, if the buffer could not be allocated.
typeThe type of the buffer.
heapThe heap to allocate the buffer on.
elementSizeThe size of an element in the buffer (in bytes).
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
true, if the buffer was created successfully and false otherwise.

◆ tryCreateBuffer() [2/10]

bool LiteFX::Rendering::IGraphicsFactory::tryCreateBuffer ( SharedPtr< IBuffer > & buffer,
const IDescriptorSetLayout & descriptorSet,
UInt32 binding,
ResourceHeap heap,
UInt32 elements = 1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Tries to create a buffer that can be bound to a specific descriptor.

Parameters
bufferThe instance of the buffer, or nullptr, if the buffer could not be allocated.
descriptorSetThe layout of the descriptors parent descriptor set.
bindingThe binding point of the descriptor within the parent descriptor set.
heapThe heap to allocate the buffer on.
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
true, if the buffer was created successfully and false otherwise.

◆ tryCreateBuffer() [3/10]

bool LiteFX::Rendering::IGraphicsFactory::tryCreateBuffer ( SharedPtr< IBuffer > & buffer,
const IDescriptorSetLayout & descriptorSet,
UInt32 binding,
ResourceHeap heap,
UInt32 elementSize,
UInt32 elements,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Tries to create a buffer that can be bound to a specific descriptor.

Parameters
bufferThe instance of the buffer, or nullptr, if the buffer could not be allocated.
descriptorSetThe layout of the descriptors parent descriptor set.
bindingThe binding point of the descriptor within the parent descriptor set.
heapThe heap to allocate the buffer on.
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
true, if the buffer was created successfully and false otherwise.

◆ tryCreateBuffer() [4/10]

bool LiteFX::Rendering::IGraphicsFactory::tryCreateBuffer ( SharedPtr< IBuffer > & buffer,
const IPipeline & pipeline,
UInt32 space,
UInt32 binding,
ResourceHeap heap,
UInt32 elements = 1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Tries to create a buffer that can be bound to a descriptor of a specific descriptor set.

Parameters
bufferThe instance of the buffer, or nullptr, if the buffer could not be allocated.
pipelineThe pipeline that provides the descriptor set.
spaceThe space, the descriptor set is bound to.
bindingThe binding point of the descriptor within the parent descriptor set.
heapThe heap to allocate the buffer on.
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
true, if the buffer was created successfully and false otherwise.

◆ tryCreateBuffer() [5/10]

bool LiteFX::Rendering::IGraphicsFactory::tryCreateBuffer ( SharedPtr< IBuffer > & buffer,
const IPipeline & pipeline,
UInt32 space,
UInt32 binding,
ResourceHeap heap,
UInt32 elementSize,
UInt32 elements,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Tries to create a buffer that can be bound to a descriptor of a specific descriptor set.

Parameters
bufferThe instance of the buffer, or nullptr, if the buffer could not be allocated.
pipelineThe pipeline that provides the descriptor set.
spaceThe space, the descriptor set is bound to.
bindingThe binding point of the descriptor within the parent descriptor set.
heapThe heap to allocate the buffer on.
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
true, if the buffer was created successfully and false otherwise.

◆ tryCreateBuffer() [6/10]

bool LiteFX::Rendering::IGraphicsFactory::tryCreateBuffer ( SharedPtr< IBuffer > & buffer,
const String & name,
BufferType type,
ResourceHeap heap,
size_t elementSize,
UInt32 elements,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Tries to create a buffer of type type .

Parameters
bufferThe instance of the buffer, or nullptr, if the buffer could not be allocated.
nameThe name of the buffer.
typeThe type of the buffer.
heapThe heap to allocate the buffer on.
elementSizeThe size of an element in the buffer (in bytes).
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
true, if the buffer was created successfully and false otherwise.

◆ tryCreateBuffer() [7/10]

bool LiteFX::Rendering::IGraphicsFactory::tryCreateBuffer ( SharedPtr< IBuffer > & buffer,
const String & name,
const IDescriptorSetLayout & descriptorSet,
UInt32 binding,
ResourceHeap heap,
size_t elementSize,
UInt32 elements,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Tries to create a buffer that can be bound to a specific descriptor.

Parameters
bufferThe instance of the buffer, or nullptr, if the buffer could not be allocated.
nameThe name of the buffer.
descriptorSetThe layout of the descriptors parent descriptor set.
bindingThe binding point of the descriptor within the parent descriptor set.
heapThe heap to allocate the buffer on.
elementSizeThe size of an element in the buffer (in bytes).
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
true, if the buffer was created successfully and false otherwise.

◆ tryCreateBuffer() [8/10]

bool LiteFX::Rendering::IGraphicsFactory::tryCreateBuffer ( SharedPtr< IBuffer > & buffer,
const String & name,
const IDescriptorSetLayout & descriptorSet,
UInt32 binding,
ResourceHeap heap,
UInt32 elements = 1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Tries to create a buffer that can be bound to a specific descriptor.

Parameters
bufferThe instance of the buffer, or nullptr, if the buffer could not be allocated.
nameThe name of the buffer.
descriptorSetThe layout of the descriptors parent descriptor set.
bindingThe binding point of the descriptor within the parent descriptor set.
heapThe heap to allocate the buffer on.
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
true, if the buffer was created successfully and false otherwise.

◆ tryCreateBuffer() [9/10]

bool LiteFX::Rendering::IGraphicsFactory::tryCreateBuffer ( SharedPtr< IBuffer > & buffer,
const String & name,
const IPipeline & pipeline,
UInt32 space,
UInt32 binding,
ResourceHeap heap,
size_t elementSize,
UInt32 elements = 1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Tries to create a buffer that can be bound to a descriptor of a specific descriptor set.

Parameters
bufferThe instance of the buffer, or nullptr, if the buffer could not be allocated.
nameThe name of the buffer.
pipelineThe pipeline that provides the descriptor set.
spaceThe space, the descriptor set is bound to.
bindingThe binding point of the descriptor within the parent descriptor set.
heapThe heap to allocate the buffer on.
elementSizeThe size of an element in the buffer (in bytes).
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
true, if the buffer was created successfully and false otherwise.

◆ tryCreateBuffer() [10/10]

bool LiteFX::Rendering::IGraphicsFactory::tryCreateBuffer ( SharedPtr< IBuffer > & buffer,
const String & name,
const IPipeline & pipeline,
UInt32 space,
UInt32 binding,
ResourceHeap heap,
UInt32 elements = 1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Tries to create a buffer that can be bound to a descriptor of a specific descriptor set.

Parameters
bufferThe instance of the buffer, or nullptr, if the buffer could not be allocated.
nameThe name of the buffer.
pipelineThe pipeline that provides the descriptor set.
spaceThe space, the descriptor set is bound to.
bindingThe binding point of the descriptor within the parent descriptor set.
heapThe heap to allocate the buffer on.
elementsThe number of elements in the buffer (in case the buffer is an array).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
true, if the buffer was created successfully and false otherwise.

◆ tryCreateIndexBuffer() [1/2]

bool LiteFX::Rendering::IGraphicsFactory::tryCreateIndexBuffer ( SharedPtr< IIndexBuffer > & buffer,
const IIndexBufferLayout & layout,
ResourceHeap heap,
UInt32 elements,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Tries to create an index buffer, based on the layout .

Parameters
bufferThe instance of the buffer, or nullptr, if the buffer could not be allocated.
layoutThe layout of the index buffer.
heapThe heap to allocate the buffer on.
elementsThe number of elements within the vertex buffer (i.e. the number of indices).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
true, if the buffer was created successfully and false otherwise.

◆ tryCreateIndexBuffer() [2/2]

bool LiteFX::Rendering::IGraphicsFactory::tryCreateIndexBuffer ( SharedPtr< IIndexBuffer > & buffer,
const String & name,
const IIndexBufferLayout & layout,
ResourceHeap heap,
UInt32 elements,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Tries to create an index buffer, based on the layout .

Parameters
bufferThe instance of the buffer, or nullptr, if the buffer could not be allocated.
nameThe name of the buffer.
layoutThe layout of the index buffer.
heapThe heap to allocate the buffer on.
usageThe intended usage for the buffer.
elementsThe number of elements within the vertex buffer (i.e. the number of indices).
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
true, if the buffer was created successfully and false otherwise.

◆ tryCreateTexture() [1/2]

bool LiteFX::Rendering::IGraphicsFactory::tryCreateTexture ( SharedPtr< IImage > & image,
const String & name,
Format format,
const Size3d & size,
ImageDimensions dimension = ImageDimensions::DIM_2,
UInt32 levels = 1,
UInt32 layers = 1,
MultiSamplingLevel samples = MultiSamplingLevel::x1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Tries to create a texture.

Parameters
imageThe instance of the buffer, or nullptr, if the texture could not be allocated.
nameThe name of the texture image.
formatThe format of the texture image.
sizeThe dimensions of the texture.
dimensionThe dimensionality of the texture.
layersThe number of layers (slices) in this texture.
levelsThe number of mip map levels of the texture.
samplesThe number of samples, the texture should be sampled with.
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
true, if the texture was created successfully and false otherwise.

◆ tryCreateTexture() [2/2]

bool LiteFX::Rendering::IGraphicsFactory::tryCreateTexture ( SharedPtr< IImage > & image,
Format format,
const Size3d & size,
ImageDimensions dimension = ImageDimensions::DIM_2,
UInt32 levels = 1,
UInt32 layers = 1,
MultiSamplingLevel samples = MultiSamplingLevel::x1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Tries to create a texture.

Parameters
imageThe instance of the buffer, or nullptr, if the texture could not be allocated.
formatThe format of the texture image.
sizeThe dimensions of the texture.
dimensionThe dimensionality of the texture.
layersThe number of layers (slices) in this texture.
levelsThe number of mip map levels of the texture.
samplesThe number of samples, the texture should be sampled with.
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
true, if the texture was created successfully and false otherwise.

◆ tryCreateVertexBuffer() [1/2]

bool LiteFX::Rendering::IGraphicsFactory::tryCreateVertexBuffer ( SharedPtr< IVertexBuffer > & buffer,
const IVertexBufferLayout & layout,
ResourceHeap heap,
UInt32 elements = 1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Tries to create a vertex buffer, based on the layout .

Parameters
bufferThe instance of the buffer, or nullptr, if the buffer could not be allocated.
layoutThe layout of the vertex buffer.
heapThe heap to allocate the buffer on.
elementsThe number of elements within the vertex buffer (i.e. the number of vertices).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
true, if the buffer was created successfully and false otherwise.

◆ tryCreateVertexBuffer() [2/2]

bool LiteFX::Rendering::IGraphicsFactory::tryCreateVertexBuffer ( SharedPtr< IVertexBuffer > & buffer,
const String & name,
const IVertexBufferLayout & layout,
ResourceHeap heap,
UInt32 elements = 1,
ResourceUsage usage = ResourceUsage::Default,
AllocationBehavior allocationBehavior = AllocationBehavior::Default ) const
inline

Tries to create a vertex buffer, based on the layout .

Parameters
bufferThe instance of the buffer, or nullptr, if the buffer could not be allocated.
nameThe name of the buffer.
layoutThe layout of the vertex buffer.
heapThe heap to allocate the buffer on.
elementsThe number of elements within the vertex buffer (i.e. the number of vertices).
usageThe intended usage for the buffer.
allocationBehaviorThe behavior controlling what happens if currently there is not enough memory available for the resource.
Returns
true, if the buffer was created successfully and false otherwise.