|
LiteFX 0.5.1.2025
Computer Graphics Engine
|
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< ResourceAllocationResult > | allocate (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< IBuffer > | createBuffer (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< IBuffer > | createBuffer (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< IBuffer > | createBuffer (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< IBuffer > | createBuffer (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< IBuffer > | createBuffer (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< IBuffer > | createBuffer (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< IBuffer > | createBuffer (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< IBuffer > | 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 |
| 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< IBuffer > | 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 |
| 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< IBuffer > | 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 |
| 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< IVertexBuffer > | createVertexBuffer (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< IVertexBuffer > | createVertexBuffer (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< IIndexBuffer > | createIndexBuffer (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< IIndexBuffer > | createIndexBuffer (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< IImage > | 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 |
| 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< IImage > | 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 |
| 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< ISampler > | 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 |
| Creates a texture sampler. | |
| SharedPtr< ISampler > | 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 |
| 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< IBottomLevelAccelerationStructure > | createBottomLevelAccelerationStructure (AccelerationStructureFlags flags=AccelerationStructureFlags::None) const |
| Creates a bottom-level acceleration structure. | |
| UniquePtr< IBottomLevelAccelerationStructure > | createBottomLevelAccelerationStructure (StringView name, AccelerationStructureFlags flags=AccelerationStructureFlags::None) const |
| Creates a bottom-level acceleration structure. | |
| UniquePtr< ITopLevelAccelerationStructure > | createTopLevelAccelerationStructure (AccelerationStructureFlags flags=AccelerationStructureFlags::None) const |
| Creates a top-level acceleration structure. | |
| UniquePtr< ITopLevelAccelerationStructure > | createTopLevelAccelerationStructure (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< MemoryHeapStatistics > | memoryStatistics () 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 | |
| IGraphicsFactory & | operator= (const IGraphicsFactory &)=default |
| IGraphicsFactory & | operator= (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 | |
| SharedObject & | operator= (SharedObject &&) noexcept=default |
| SharedObject & | operator= (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. | |
The interface for a graphics factory.
|
protecteddefaultnoexcept |
|
protecteddefaultnoexcept |
|
protecteddefault |
|
overridedefaultnoexcept |
|
inlinevirtual |
Allocates a single resource as described by allocationInfo .
| allocationInfo | The description of the resource to allocate. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
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.
| allocationInfos | The description of the resources to allocate. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
| alias | true if the allocator should attempt to overlap the allocations and false otherwise. |
| InvalidArgumentException | Thrown, 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.
|
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.
| queue | The queue to execute the move commands on. |
| strategy | The strategy to pack the fragmented memory. |
| maxBytesToMove | The maximum number of bytes to move during this pass or 0, if no limitation should be imposed. |
| maxAllocationsToMove | The maximum number of allocations to move during this pass or 0, if no limitation should be imposed. |
| RuntimeException | Thrown, if another defragmentation process is currently running and has not yet finished. |
Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.
|
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.
| RuntimeException | Thrown, if no defragmentation process is currently active. |
Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.
|
pure virtual |
Checks if the resources described by allocationInfos can be overlapped.
| allocationInfos | The resource descriptions to check. |
true, if the resources described by allocationInfos can be overlapped and false otherwise.Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.
|
nodiscardpure virtual |
Creates a virtual allocator that can be used to manage allocation from a custom block of memory.
| overallMemory | The overall size (in bytes) of memory available to the allocator. |
| algorithm | The algorithm used to find a suitable block in the allocator memory. |
Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.
|
inline |
Creates a bottom-level acceleration structure.
This method is only supported if the GraphicsDeviceFeature::RayTracing feature is enabled.
| flags | The flags that define how the acceleration structure is built. |
|
inline |
Creates a bottom-level acceleration structure.
This method is only supported if the GraphicsDeviceFeature::RayTracing feature is enabled.
| name | The name of the acceleration structure resource. |
| flags | The flags that define how the acceleration structure is built. |
|
inline |
Creates a buffer of type type .
| type | The type of the buffer. |
| heap | The heap to allocate the buffer on. |
| elementSize | The size of an element in the buffer (in bytes). |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
inline |
Creates a buffer that can be bound to a specific descriptor.
| descriptorSet | The layout of the descriptors parent descriptor set. |
| binding | The binding point of the descriptor within the parent descriptor set. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
inline |
Creates a buffer that can be bound to a specific descriptor.
| descriptorSet | The layout of the descriptors parent descriptor set. |
| binding | The binding point of the descriptor within the parent descriptor set. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
inline |
Creates a buffer that can be bound to a descriptor of a specific descriptor set.
| pipeline | The pipeline that provides the descriptor set. |
| space | The space, the descriptor set is bound to. |
| binding | The binding point of the descriptor within the parent descriptor set. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
inline |
Creates a buffer that can be bound to a descriptor of a specific descriptor set.
| pipeline | The pipeline that provides the descriptor set. |
| space | The space, the descriptor set is bound to. |
| binding | The binding point of the descriptor within the parent descriptor set. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
inline |
Creates a buffer of type type .
| name | The name of the buffer. |
| type | The type of the buffer. |
| heap | The heap to allocate the buffer on. |
| elementSize | The size of an element in the buffer (in bytes). |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
inline |
Creates a buffer that can be bound to a specific descriptor.
| name | The name of the buffer. |
| descriptorSet | The layout of the descriptors parent descriptor set. |
| binding | The binding point of the descriptor within the parent descriptor set. |
| heap | The heap to allocate the buffer on. |
| elementSize | The size of an element in the buffer (in bytes). |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
inline |
Creates a buffer that can be bound to a specific descriptor.
| name | The name of the buffer. |
| descriptorSet | The layout of the descriptors parent descriptor set. |
| binding | The binding point of the descriptor within the parent descriptor set. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
inline |
Creates a buffer that can be bound to a descriptor of a specific descriptor set.
| name | The name of the buffer. |
| pipeline | The pipeline that provides the descriptor set. |
| space | The space, the descriptor set is bound to. |
| binding | The binding point of the descriptor within the parent descriptor set. |
| heap | The heap to allocate the buffer on. |
| elementSize | The size of an element in the buffer (in bytes). |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
inline |
Creates a buffer that can be bound to a descriptor of a specific descriptor set.
| name | The name of the buffer. |
| pipeline | The pipeline that provides the descriptor set. |
| space | The space, the descriptor set is bound to. |
| binding | The binding point of the descriptor within the parent descriptor set. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
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.
| layout | The layout of the index buffer. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements within the vertex buffer (i.e. the number of indices). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
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.
| name | The name of the buffer. |
| layout | The layout of the index buffer. |
| heap | The heap to allocate the buffer on. |
| usage | The intended usage for the buffer. |
| elements | The number of elements within the vertex buffer (i.e. the number of indices). |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
inline |
Creates a texture sampler.
| name | The name of the sampler. |
| magFilter | The filter operation used for magnifying. |
| minFilter | The filter operation used for minifying. |
| borderU | The border mode along the U-axis. |
| borderV | The border mode along the V-axis. |
| borderW | The border mode along the W-axis. |
| mipMapMode | The mip map mode. |
| mipMapBias | The mip map bias. |
| maxLod | The maximum level of detail value. |
| minLod | The minimum level of detail value. |
| anisotropy | The level of anisotropic filtering. |
|
inline |
Creates a texture sampler.
| magFilter | The filter operation used for magnifying. |
| minFilter | The filter operation used for minifying. |
| borderU | The border mode along the U-axis. |
| borderV | The border mode along the V-axis. |
| borderW | The border mode along the W-axis. |
| mipMapMode | The mip map mode. |
| mipMapBias | The mip map bias. |
| maxLod | The maximum level of detail value. |
| minLod | The minimum level of detail value. |
| anisotropy | The level of anisotropic filtering. |
|
inline |
Creates a series of texture samplers.
| magFilter | The filter operation used for magnifying. |
| minFilter | The filter operation used for minifying. |
| borderU | The border mode along the U-axis. |
| borderV | The border mode along the V-axis. |
| borderW | The border mode along the W-axis. |
| mipMapMode | The mip map mode. |
| mipMapBias | The mip map bias. |
| maxLod | The maximum level of detail value. |
| minLod | The minimum level of detail value. |
| anisotropy | The level of anisotropic filtering. |
|
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.
| name | The name of the texture image. |
| format | The format of the texture image. |
| size | The dimensions of the texture. |
| dimension | The dimensionality of the texture. |
| layers | The number of layers (slices) in this texture. |
| levels | The number of mip map levels of the texture. |
| samples | The number of samples, the texture should be sampled with. |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
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.
| format | The format of the texture image. |
| size | The dimensions of the texture. |
| dimension | The dimensionality of the texture. |
| layers | The number of layers (slices) in this texture. |
| levels | The number of mip map levels of the texture. |
| samples | The number of samples, the texture should be sampled with. |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
inline |
Creates a series of textures.
| format | The format of the texture images. |
| size | The dimensions of the textures. |
| layers | The number of layers (slices) in this texture. |
| levels | The number of mip map levels of the textures. |
| samples | The number of samples, the textures should be sampled with. |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
inline |
Creates a top-level acceleration structure.
This method is only supported if the GraphicsDeviceFeature::RayTracing feature is enabled.
| flags | The flags that define how the acceleration structure is built. |
|
inline |
Creates a top-level acceleration structure.
This method is only supported if the GraphicsDeviceFeature::RayTracing feature is enabled.
| name | The name of the acceleration structure resource. |
| flags | The flags that define how the acceleration structure is built. |
|
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.
| layout | The layout of the vertex buffer. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements within the vertex buffer (i.e. the number of vertices). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
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.
| name | The name of the buffer. |
| layout | The layout of the vertex buffer. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements within the vertex buffer (i.e. the number of vertices). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
|
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.
Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.
|
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.
| RuntimeException | Thrown, if no defragmentation process is currently active. |
Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.
|
pure virtual |
Returns an array of objects, that contain information about the current memory usage and available memory for a memory heap.
Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.
|
protecteddefault |
|
protecteddefaultnoexcept |
|
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.
true, if the GPU supports resizable base address register (ReBAR) and false otherwise.Implemented in LiteFX::Rendering::Backends::DirectX12GraphicsFactory, and LiteFX::Rendering::Backends::VulkanGraphicsFactory.
|
inline |
Tries to create a buffer of type type .
| buffer | The instance of the buffer, or nullptr, if the buffer could not be allocated. |
| type | The type of the buffer. |
| heap | The heap to allocate the buffer on. |
| elementSize | The size of an element in the buffer (in bytes). |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
true, if the buffer was created successfully and false otherwise.
|
inline |
Tries to create a buffer that can be bound to a specific descriptor.
| buffer | The instance of the buffer, or nullptr, if the buffer could not be allocated. |
| descriptorSet | The layout of the descriptors parent descriptor set. |
| binding | The binding point of the descriptor within the parent descriptor set. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
true, if the buffer was created successfully and false otherwise.
|
inline |
Tries to create a buffer that can be bound to a specific descriptor.
| buffer | The instance of the buffer, or nullptr, if the buffer could not be allocated. |
| descriptorSet | The layout of the descriptors parent descriptor set. |
| binding | The binding point of the descriptor within the parent descriptor set. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
true, if the buffer was created successfully and false otherwise.
|
inline |
Tries to create a buffer that can be bound to a descriptor of a specific descriptor set.
| buffer | The instance of the buffer, or nullptr, if the buffer could not be allocated. |
| pipeline | The pipeline that provides the descriptor set. |
| space | The space, the descriptor set is bound to. |
| binding | The binding point of the descriptor within the parent descriptor set. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
true, if the buffer was created successfully and false otherwise.
|
inline |
Tries to create a buffer that can be bound to a descriptor of a specific descriptor set.
| buffer | The instance of the buffer, or nullptr, if the buffer could not be allocated. |
| pipeline | The pipeline that provides the descriptor set. |
| space | The space, the descriptor set is bound to. |
| binding | The binding point of the descriptor within the parent descriptor set. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
true, if the buffer was created successfully and false otherwise.
|
inline |
Tries to create a buffer of type type .
| buffer | The instance of the buffer, or nullptr, if the buffer could not be allocated. |
| name | The name of the buffer. |
| type | The type of the buffer. |
| heap | The heap to allocate the buffer on. |
| elementSize | The size of an element in the buffer (in bytes). |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
true, if the buffer was created successfully and false otherwise.
|
inline |
Tries to create a buffer that can be bound to a specific descriptor.
| buffer | The instance of the buffer, or nullptr, if the buffer could not be allocated. |
| name | The name of the buffer. |
| descriptorSet | The layout of the descriptors parent descriptor set. |
| binding | The binding point of the descriptor within the parent descriptor set. |
| heap | The heap to allocate the buffer on. |
| elementSize | The size of an element in the buffer (in bytes). |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
true, if the buffer was created successfully and false otherwise.
|
inline |
Tries to create a buffer that can be bound to a specific descriptor.
| buffer | The instance of the buffer, or nullptr, if the buffer could not be allocated. |
| name | The name of the buffer. |
| descriptorSet | The layout of the descriptors parent descriptor set. |
| binding | The binding point of the descriptor within the parent descriptor set. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
true, if the buffer was created successfully and false otherwise.
|
inline |
Tries to create a buffer that can be bound to a descriptor of a specific descriptor set.
| buffer | The instance of the buffer, or nullptr, if the buffer could not be allocated. |
| name | The name of the buffer. |
| pipeline | The pipeline that provides the descriptor set. |
| space | The space, the descriptor set is bound to. |
| binding | The binding point of the descriptor within the parent descriptor set. |
| heap | The heap to allocate the buffer on. |
| elementSize | The size of an element in the buffer (in bytes). |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
true, if the buffer was created successfully and false otherwise.
|
inline |
Tries to create a buffer that can be bound to a descriptor of a specific descriptor set.
| buffer | The instance of the buffer, or nullptr, if the buffer could not be allocated. |
| name | The name of the buffer. |
| pipeline | The pipeline that provides the descriptor set. |
| space | The space, the descriptor set is bound to. |
| binding | The binding point of the descriptor within the parent descriptor set. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements in the buffer (in case the buffer is an array). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
true, if the buffer was created successfully and false otherwise.
|
inline |
Tries to create an index buffer, based on the layout .
| buffer | The instance of the buffer, or nullptr, if the buffer could not be allocated. |
| layout | The layout of the index buffer. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements within the vertex buffer (i.e. the number of indices). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
true, if the buffer was created successfully and false otherwise.
|
inline |
Tries to create an index buffer, based on the layout .
| buffer | The instance of the buffer, or nullptr, if the buffer could not be allocated. |
| name | The name of the buffer. |
| layout | The layout of the index buffer. |
| heap | The heap to allocate the buffer on. |
| usage | The intended usage for the buffer. |
| elements | The number of elements within the vertex buffer (i.e. the number of indices). |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
true, if the buffer was created successfully and false otherwise.
|
inline |
Tries to create a texture.
| image | The instance of the buffer, or nullptr, if the texture could not be allocated. |
| name | The name of the texture image. |
| format | The format of the texture image. |
| size | The dimensions of the texture. |
| dimension | The dimensionality of the texture. |
| layers | The number of layers (slices) in this texture. |
| levels | The number of mip map levels of the texture. |
| samples | The number of samples, the texture should be sampled with. |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
true, if the texture was created successfully and false otherwise.
|
inline |
Tries to create a texture.
| image | The instance of the buffer, or nullptr, if the texture could not be allocated. |
| format | The format of the texture image. |
| size | The dimensions of the texture. |
| dimension | The dimensionality of the texture. |
| layers | The number of layers (slices) in this texture. |
| levels | The number of mip map levels of the texture. |
| samples | The number of samples, the texture should be sampled with. |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
true, if the texture was created successfully and false otherwise.
|
inline |
Tries to create a vertex buffer, based on the layout .
| buffer | The instance of the buffer, or nullptr, if the buffer could not be allocated. |
| layout | The layout of the vertex buffer. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements within the vertex buffer (i.e. the number of vertices). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
true, if the buffer was created successfully and false otherwise.
|
inline |
Tries to create a vertex buffer, based on the layout .
| buffer | The instance of the buffer, or nullptr, if the buffer could not be allocated. |
| name | The name of the buffer. |
| layout | The layout of the vertex buffer. |
| heap | The heap to allocate the buffer on. |
| elements | The number of elements within the vertex buffer (i.e. the number of vertices). |
| usage | The intended usage for the buffer. |
| allocationBehavior | The behavior controlling what happens if currently there is not enough memory available for the resource. |
true, if the buffer was created successfully and false otherwise.