LiteFX 0.4.1.2025
Computer Graphics Engine
|
The interface for a graphics device that. More...
#include <rendering_api.hpp>
Inherits LiteFX::SharedObject.
Inherited by LiteFX::Rendering::GraphicsDevice< DirectX12GraphicsFactory, DirectX12Surface, DirectX12GraphicsAdapter, DirectX12SwapChain, DirectX12Queue, DirectX12RenderPass, DirectX12RenderPipeline, DirectX12ComputePipeline, DirectX12RayTracingPipeline, DirectX12Barrier >, LiteFX::Rendering::GraphicsDevice< VulkanGraphicsFactory, VulkanSurface, VulkanGraphicsAdapter, VulkanSwapChain, VulkanQueue, VulkanRenderPass, VulkanRenderPipeline, VulkanComputePipeline, VulkanRayTracingPipeline, VulkanBarrier >, and LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TRenderPipeline, TComputePipeline, TRayTracingPipeline, TBarrier >.
Public Member Functions | |
~IGraphicsDevice () noexcept override=default | |
virtual DeviceState & | state () const noexcept=0 |
Returns the device state that can be used to manage resources. | |
virtual const ISurface & | surface () const noexcept=0 |
Returns the surface, the device draws to. | |
virtual const IGraphicsAdapter & | adapter () const noexcept=0 |
Returns the graphics adapter, the device uses for drawing. | |
virtual const ISwapChain & | swapChain () const noexcept=0 |
Returns the swap chain, that contains the back and front buffers used for presentation. | |
virtual ISwapChain & | swapChain () noexcept=0 |
Returns the swap chain, that contains the back and front buffers used for presentation. | |
virtual const IGraphicsFactory & | factory () const noexcept=0 |
Returns the factory instance, used to create instances from the device. | |
const ICommandQueue & | defaultQueue (QueueType type) const |
Returns the instance of the default ICommandQueue that supports the combination of queue types specified by the type parameter. | |
SharedPtr< const ICommandQueue > | createQueue (QueueType type, QueuePriority priority=QueuePriority::Normal) |
Attempts to create a new queue that supports the combination of queue types specified by the type parameter. | |
UniquePtr< IBarrier > | makeBarrier (PipelineStage syncBefore, PipelineStage syncAfter) const |
Creates a memory barrier instance. | |
SharedPtr< IFrameBuffer > | makeFrameBuffer (const Size2d &renderArea) const |
Creates a new frame buffer instance. | |
SharedPtr< IFrameBuffer > | makeFrameBuffer (StringView name, const Size2d &renderArea) const |
Creates a new frame buffer instance. | |
virtual MultiSamplingLevel | maximumMultiSamplingLevel (Format format) const noexcept=0 |
Queries the device for the maximum supported number of multi-sampling levels. | |
virtual double | ticksPerMillisecond () const noexcept=0 |
Returns the number of GPU ticks per milliseconds. | |
void | computeAccelerationStructureSizes (const IBottomLevelAccelerationStructure &blas, UInt64 &bufferSize, UInt64 &scratchSize, bool forUpdate=false) const |
Computes the required amount of device memory for an IBottomLevelAccelerationStructure. | |
void | computeAccelerationStructureSizes (const ITopLevelAccelerationStructure &tlas, UInt64 &bufferSize, UInt64 &scratchSize, bool forUpdate=false) const |
Computes the required amount of device memory for an ITopLevelAccelerationStructure. | |
virtual void | wait () const =0 |
Waits until all queues allocated from the device have finished the work issued prior to this point. | |
![]() | |
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 | |
IGraphicsDevice () noexcept=default | |
IGraphicsDevice (IGraphicsDevice &&) noexcept=default | |
IGraphicsDevice (const IGraphicsDevice &)=default | |
IGraphicsDevice & | operator= (const IGraphicsDevice &)=default |
IGraphicsDevice & | operator= (IGraphicsDevice &&) noexcept=default |
![]() | |
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 | |
![]() | |
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 device that.
|
protecteddefaultnoexcept |
|
protecteddefaultnoexcept |
|
protecteddefault |
|
overridedefaultnoexcept |
|
pure virtualnoexcept |
Returns the graphics adapter, the device uses for drawing.
Implemented in LiteFX::Rendering::Backends::DirectX12Device, LiteFX::Rendering::Backends::VulkanDevice, LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TRenderPipeline, TComputePipeline, TRayTracingPipeline, TBarrier >, LiteFX::Rendering::GraphicsDevice< DirectX12GraphicsFactory, DirectX12Surface, DirectX12GraphicsAdapter, DirectX12SwapChain, DirectX12Queue, DirectX12RenderPass, DirectX12RenderPipeline, DirectX12ComputePipeline, DirectX12RayTracingPipeline, DirectX12Barrier >, and LiteFX::Rendering::GraphicsDevice< VulkanGraphicsFactory, VulkanSurface, VulkanGraphicsAdapter, VulkanSwapChain, VulkanQueue, VulkanRenderPass, VulkanRenderPipeline, VulkanComputePipeline, VulkanRayTracingPipeline, VulkanBarrier >.
|
inline |
Computes the required amount of device memory for an IBottomLevelAccelerationStructure.
Acceleration structures are built on the GPU, which requires additional memory called scratch memory. When creating an acceleration structure (AS), you have to provide a temporary buffer containing the scratch memory, alongside the actual buffer that stores the AS itself. This method can be used to pre-compute the buffer sizes for both buffers.
This method is only supported, if the GraphicsDeviceFeatures::RayTracing feature is enabled.
blas | The bottom-level acceleration structure to compute the memory requirements for. |
bufferSize | The size of the acceleration structure buffer. |
scratchSize | The size of the scratch memory buffer. |
forUpdate | If set to true , scratchSize will contain the amount of scratch memory required for an update. |
|
inline |
Computes the required amount of device memory for an ITopLevelAccelerationStructure.
Acceleration structures are built on the GPU, which requires additional memory called scratch memory. When creating an acceleration structure (AS), you have to provide a temporary buffer containing the scratch memory, alongside the actual buffer that stores the AS itself. This method can be used to pre-compute the buffer sizes for both buffers.
This method is only supported, if the GraphicsDeviceFeatures::RayTracing feature is enabled.
tlas | The top-level acceleration structure to compute the memory requirements for. |
bufferSize | The size of the acceleration structure buffer. |
scratchSize | The size of the scratch memory buffer. |
forUpdate | If set to true , scratchSize will contain the amount of scratch memory required for an update. |
|
inline |
Attempts to create a new queue that supports the combination of queue types specified by the type parameter.
Note that a queue is not guaranteed to represent an actual hardware queue that runs in parallel to other hardware queues. Backends might create virtual queues, that map the same hardware queue. In this case, creating a new queue is always possible but might not yield performance benefits. As a good practice, it is advised to create only as few queues as required.
If this method is not able to create a new queue (i.e., it returns nullptr
), you can either fall back to the default queue (defaultQueue) or use any queue that you created earlier instead.
The priority parameter can be specified to request a queue with a certain priority. However, the backend is not required to return a queue with that actual priority. The default queues are always prioritized highest.
type | The type of the queue or a combination of capabilities the queue is required to support. |
priority | The preferred priority of the queue. |
nullptr
, if no queue could be created.
|
inline |
Returns the instance of the default ICommandQueue that supports the combination of queue types specified by the type parameter.
When the device is created, it attempts to create a queue for each singular queue type. Each GPU is expected to provide at least one queue that is capable of supporting all queue types. This queue is used as a fallback queue, if no dedicated queue for a certain type is supported. For example, if no dedicated QueueType::Transfer queue can be created, calling this method for the default transfer queue will return the same queue instance as the default graphics queue, which implicitly always supports transfer operations. The same is true for compute queues. This default graphics queue is ensured to support presentation and is also created with the highest queue priority.
type | The type or a combination of types that specifies the operation the queue should support. |
InvalidArgumentException | Thrown, if no default queue for the combination of queue types specified with the type parameter has been created. |
|
pure virtualnoexcept |
Returns the factory instance, used to create instances from the device.
Implemented in LiteFX::Rendering::Backends::DirectX12Device, LiteFX::Rendering::Backends::VulkanDevice, LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TRenderPipeline, TComputePipeline, TRayTracingPipeline, TBarrier >, LiteFX::Rendering::GraphicsDevice< DirectX12GraphicsFactory, DirectX12Surface, DirectX12GraphicsAdapter, DirectX12SwapChain, DirectX12Queue, DirectX12RenderPass, DirectX12RenderPipeline, DirectX12ComputePipeline, DirectX12RayTracingPipeline, DirectX12Barrier >, and LiteFX::Rendering::GraphicsDevice< VulkanGraphicsFactory, VulkanSurface, VulkanGraphicsAdapter, VulkanSwapChain, VulkanQueue, VulkanRenderPass, VulkanRenderPipeline, VulkanComputePipeline, VulkanRayTracingPipeline, VulkanBarrier >.
|
inlinenodiscard |
Creates a memory barrier instance.
syncBefore | The pipeline stage(s) all previous commands have to finish before the barrier is executed. |
syncAfter | The pipeline stage(s) all subsequent commands are blocked at until the barrier is executed. |
|
inlinenodiscard |
Creates a new frame buffer instance.
renderArea | The initial render area of the frame buffer. |
|
inlinenodiscard |
Creates a new frame buffer instance.
name | The name of the frame buffer. |
renderArea | The initial render area of the frame buffer. |
|
pure virtualnoexcept |
Queries the device for the maximum supported number of multi-sampling levels.
This method returns the maximum supported multi-sampling level for a certain format. Typically you want to pass a back-buffer format for your swap-chain here. All lower multi-sampling levels are implicitly supported for this format.
format | The target (i.e. back-buffer) format. |
Implemented in LiteFX::Rendering::Backends::DirectX12Device, and LiteFX::Rendering::Backends::VulkanDevice.
|
protecteddefault |
|
protecteddefaultnoexcept |
|
pure virtualnoexcept |
Returns the device state that can be used to manage resources.
Implemented in LiteFX::Rendering::Backends::DirectX12Device, and LiteFX::Rendering::Backends::VulkanDevice.
|
pure virtualnoexcept |
Returns the surface, the device draws to.
Implemented in LiteFX::Rendering::Backends::DirectX12Device, LiteFX::Rendering::Backends::VulkanDevice, LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TRenderPipeline, TComputePipeline, TRayTracingPipeline, TBarrier >, LiteFX::Rendering::GraphicsDevice< DirectX12GraphicsFactory, DirectX12Surface, DirectX12GraphicsAdapter, DirectX12SwapChain, DirectX12Queue, DirectX12RenderPass, DirectX12RenderPipeline, DirectX12ComputePipeline, DirectX12RayTracingPipeline, DirectX12Barrier >, and LiteFX::Rendering::GraphicsDevice< VulkanGraphicsFactory, VulkanSurface, VulkanGraphicsAdapter, VulkanSwapChain, VulkanQueue, VulkanRenderPass, VulkanRenderPipeline, VulkanComputePipeline, VulkanRayTracingPipeline, VulkanBarrier >.
|
pure virtualnoexcept |
Returns the swap chain, that contains the back and front buffers used for presentation.
Implemented in LiteFX::Rendering::Backends::DirectX12Device, LiteFX::Rendering::Backends::VulkanDevice, LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TRenderPipeline, TComputePipeline, TRayTracingPipeline, TBarrier >, LiteFX::Rendering::GraphicsDevice< DirectX12GraphicsFactory, DirectX12Surface, DirectX12GraphicsAdapter, DirectX12SwapChain, DirectX12Queue, DirectX12RenderPass, DirectX12RenderPipeline, DirectX12ComputePipeline, DirectX12RayTracingPipeline, DirectX12Barrier >, and LiteFX::Rendering::GraphicsDevice< VulkanGraphicsFactory, VulkanSurface, VulkanGraphicsAdapter, VulkanSwapChain, VulkanQueue, VulkanRenderPass, VulkanRenderPipeline, VulkanComputePipeline, VulkanRayTracingPipeline, VulkanBarrier >.
|
pure virtualnoexcept |
Returns the swap chain, that contains the back and front buffers used for presentation.
Implemented in LiteFX::Rendering::Backends::DirectX12Device, LiteFX::Rendering::Backends::VulkanDevice, LiteFX::Rendering::GraphicsDevice< TFactory, TSurface, TGraphicsAdapter, TSwapChain, TCommandQueue, TRenderPass, TRenderPipeline, TComputePipeline, TRayTracingPipeline, TBarrier >, LiteFX::Rendering::GraphicsDevice< DirectX12GraphicsFactory, DirectX12Surface, DirectX12GraphicsAdapter, DirectX12SwapChain, DirectX12Queue, DirectX12RenderPass, DirectX12RenderPipeline, DirectX12ComputePipeline, DirectX12RayTracingPipeline, DirectX12Barrier >, and LiteFX::Rendering::GraphicsDevice< VulkanGraphicsFactory, VulkanSurface, VulkanGraphicsAdapter, VulkanSwapChain, VulkanQueue, VulkanRenderPass, VulkanRenderPipeline, VulkanComputePipeline, VulkanRayTracingPipeline, VulkanBarrier >.
|
pure virtualnoexcept |
Returns the number of GPU ticks per milliseconds.
Implemented in LiteFX::Rendering::Backends::DirectX12Device, and LiteFX::Rendering::Backends::VulkanDevice.
|
pure virtual |
Waits until all queues allocated from the device have finished the work issued prior to this point.
Note that you must synchronize calls to this method, i.e., you have to ensure no other thread is submitting work on any queue while waiting. Calling this method only guarantees that all prior work is finished after returning. If any other thread submits work to any queue after calling this method, this workload is not waited on.
Implemented in LiteFX::Rendering::Backends::DirectX12Device, and LiteFX::Rendering::Backends::VulkanDevice.