![]() |
XII Release 0.1.0
|
The xiiGALDevice class is the primary interface for interactions with rendering APIs. It contains a set of (non-virtual) functions to set state, create resources etc. which rely on API specific implementations provided by protected virtual functions. Redundant state changes are prevented at the platform independent level in the non-virtual functions. More...
#include <Device.h>
Public Member Functions | |
xiiResult | Initialize () |
Initialize device. | |
void | BeginFrame () |
Begins a render frame. | |
void | EndFrame () |
Ends a render frame. | |
void | WaitIdle () |
Waits until all outstanding operations on the GPU are complete and destroys any pending resources and GPU objects. | |
const xiiGALDeviceCreationDescription & | GetDescription () const |
Returns the creation description for this device. | |
virtual xiiGALCommandQueue * | GetDefaultCommandQueue (xiiBitflags< xiiGALCommandQueueType > queueType=xiiGALCommandQueueType::Graphics) const =0 |
Retrieves a pointer to the compute queue if available, null otherwise. | |
const xiiGALGraphicsDeviceAdapterDescription & | GetGraphicsDeviceAdapterProperties () const |
This retrieves the device properties. See xiiGraphicsDeviceAdapterDescription. | |
const xiiGALDeviceFeatures & | GetFeatures () const |
This retrieves the device feature states. See xiiGALDeviceFeatures. | |
xiiEnum< xiiGALGraphicsDeviceType > | GetGraphicsDeviceType () const |
This retrieves the device graphics API type. See xiiGALGraphicsDeviceType. | |
xiiMutex & | GetMutex () const |
This returns critical section lock. | |
Factory Methods. | |
xiiSharedPtr< xiiGALSwapChain > | CreateSwapChain (const xiiGALSwapChainCreationDescription &description) |
This creates a swap chain object. | |
xiiSharedPtr< xiiGALBlendState > | CreateBlendState (const xiiGALBlendStateCreationDescription &description) |
This creates a new blend state object. | |
xiiSharedPtr< xiiGALDepthStencilState > | CreateDepthStencilState (const xiiGALDepthStencilStateCreationDescription &description) |
This creates a new depth stencil state object. | |
xiiSharedPtr< xiiGALRasterizerState > | CreateRasterizerState (const xiiGALRasterizerStateCreationDescription &description) |
This creates a new rasterizer state object. | |
xiiSharedPtr< xiiGALShader > | CreateShader (const xiiGALShaderCreationDescription &description) |
This creates a new shader object. | |
xiiSharedPtr< xiiGALBuffer > | CreateBuffer (const xiiGALBufferCreationDescription &description, const xiiGALBufferData *pInitialData=nullptr) |
This creates a new buffer object. | |
xiiSharedPtr< xiiGALTexture > | CreateTexture (const xiiGALTextureCreationDescription &description, const xiiGALTextureData *pInitialData=nullptr) |
This creates a new texture object. | |
xiiSharedPtr< xiiGALSampler > | CreateSampler (const xiiGALSamplerCreationDescription &description) |
This creates a new sampler object. | |
xiiSharedPtr< xiiGALQuery > | CreateQuery (const xiiGALQueryCreationDescription &description) |
This creates a new query object. | |
xiiSharedPtr< xiiGALFence > | CreateFence (const xiiGALFenceCreationDescription &description) |
This creates a new fence object. | |
xiiSharedPtr< xiiGALRenderPass > | CreateRenderPass (const xiiGALRenderPassCreationDescription &description) |
This creates a new render pass object. | |
xiiSharedPtr< xiiGALFramebuffer > | CreateFramebuffer (const xiiGALFramebufferCreationDescription &description) |
This creates a new frame buffer object. | |
xiiSharedPtr< xiiGALBottomLevelAS > | CreateBottomLevelAS (const xiiGALBottomLevelASCreationDescription &description) |
This creates a new bottom-level acceleration structure object. | |
xiiSharedPtr< xiiGALTopLevelAS > | CreateTopLevelAS (const xiiGALTopLevelASCreationDescription &description) |
This creates a new top-level acceleration structure object. | |
xiiSharedPtr< xiiGALPipelineResourceSignature > | CreatePipelineResourceSignature (xiiGALPipelineResourceSignatureCreationDescription &description) |
This creates a new pipeline resource signature object. | |
xiiSharedPtr< xiiGALGraphicsPipelineState > | CreateGraphicsPipelineState (const xiiGALGraphicsPipelineStateCreationDescription &description) |
This creates a new graphics pipeline state object. | |
xiiSharedPtr< xiiGALComputePipelineState > | CreateComputePipelineState (const xiiGALComputePipelineStateCreationDescription &description) |
This creates a new compute pipeline state object. | |
xiiSharedPtr< xiiGALRayTracingPipelineState > | CreateRayTracingPipelineState (const xiiGALRayTracingPipelineStateCreationDescription &description) |
This creates a new ray tracing pipeline state object. | |
xiiSharedPtr< xiiGALTilePipelineState > | CreateTilePipelineState (const xiiGALTilePipelineStateCreationDescription &description) |
This creates a new tile pipeline state object. | |
![]() | |
XII_ALWAYS_INLINE xiiStringView | GetDebugName () const |
Returns the debug name of this resource. | |
void | SetDebugName (xiiStringView sDebugName) const |
Sets the debug name for this resource. | |
![]() | |
virtual const xiiRTTI * | GetDynamicRTTI () const |
bool | IsInstanceOf (const xiiRTTI *pType) const |
Returns whether the type of this instance is of the given type or derived from it. | |
template<typename T> | |
XII_ALWAYS_INLINE bool | IsInstanceOf () const |
Returns whether the type of this instance is of the given type or derived from it. | |
![]() | |
virtual | ~xiiRefCounted ()=default |
Adds a virtual destructor. | |
![]() | |
xiiRefCountingImpl ()=default | |
Constructor. | |
xiiRefCountingImpl (const xiiRefCountingImpl &rhs) | |
void | operator= (const xiiRefCountingImpl &rhs) |
xiiUInt32 | AddRef () const |
Increments the reference counter. Returns the new reference count. | |
xiiUInt32 | ReleaseRef () const |
Decrements the reference counter. Returns the new reference count. | |
bool | IsReferenced () const |
Returns true if the reference count is greater than 0, false otherwise. | |
xiiUInt32 | GetRefCount () const |
Returns the current reference count. | |
Static Public Member Functions | |
static void | SetDefaultDevice (xiiSharedPtr< xiiGALDevice > pDefaultDevice) |
Sets a default graphics device. | |
static xiiSharedPtr< xiiGALDevice > | GetDefaultDevice () |
Retrieves the default device. This will be nullptr if none is set. | |
static bool | HasDefaultDevice () |
This returns true if there is a set default device. | |
![]() | |
static const xiiRTTI * | GetStaticRTTI () |
Static Public Attributes | |
static xiiEvent< const xiiGALDeviceEvent &, xiiMutex > | s_Events |
Registers event handlers. | |
Protected Member Functions | |
xiiGALDevice (xiiAllocatorBase *pAllocator, const xiiGALDeviceCreationDescription &creationDescription) | |
xiiResult | PostInitialize () |
Initialization after device capabilities are known. | |
void | VerifyMultithreadedAccess () const |
Asserts that either this device supports multi-threaded resource creation, or that this function is executed on the main thread. | |
void | FinalizeTextureInternal (const xiiGALTextureCreationDescription &description, xiiSharedPtr< xiiGALTexture > &pTexture) |
void | FinalizeBufferInternal (const xiiGALBufferCreationDescription &description, xiiSharedPtr< xiiGALBuffer > &pBuffer) |
![]() | |
virtual XII_ALWAYS_INLINE void | SetDebugNamePlatform (xiiStringView sName) const |
Protected Attributes | |
xiiGALDeviceCreationDescription | m_Description |
xiiProxyAllocator | m_Allocator |
xiiLocalAllocatorWrapper | m_AllocatorWrapper |
xiiMutex | m_Mutex |
xiiGALGraphicsDeviceAdapterDescription | m_AdapterDescription |
The xiiGALDevice class is the primary interface for interactions with rendering APIs. It contains a set of (non-virtual) functions to set state, create resources etc. which rely on API specific implementations provided by protected virtual functions. Redundant state changes are prevented at the platform independent level in the non-virtual functions.
|
nodiscard |
This creates a new blend state object.
description | - The blend state description. See xiiGALBlendStateCreationDescription. |
|
nodiscard |
This creates a new bottom-level acceleration structure object.
description | - The bottom-level acceleration structure description. See xiiGALBottomLevelASCreationDescription. |
|
nodiscard |
This creates a new buffer object.
description | - The buffer description. See xiiGALBufferCreationDescription. |
pInitialData | - The pointer to the xiiGALBufferData structure that describes the initial buffer data or nullptr if no data is provided. Immutable buffers (xiiGALResourceUsage::Immutable) must be initialized during creation. |
|
nodiscard |
This creates a new compute pipeline state object.
description | - The compute pipeline state description. See xiiGALComputePipelineStateCreationDescription. |
|
nodiscard |
This creates a new depth stencil state object.
description | - The depth stencil state description. See xiiGALDepthStencilStateCreationDescription. |
|
nodiscard |
This creates a new fence object.
description | - The fence description. See xiiGALFenceCreationDescription. |
|
nodiscard |
This creates a new frame buffer object.
description | - The frame buffer description. See xiiGALFramebufferCreationDescription. |
|
nodiscard |
This creates a new graphics pipeline state object.
description | - The graphics pipeline state description. See xiiGALGraphicsPipelineStateCreationDescription. |
|
nodiscard |
This creates a new pipeline resource signature object.
description | - The pipeline resource signature description. See xiiGALPipelineResourceSignatureCreationDescription. |
|
nodiscard |
This creates a new query object.
description | - The query description. See xiiGALQueryCreationDescription. |
|
nodiscard |
This creates a new rasterizer state object.
description | - The rasterizer state description. See xiiGALRasterizerStateCreationDescription. |
|
nodiscard |
This creates a new ray tracing pipeline state object.
description | - The ray tracing pipeline state description. See xiiGALRayTracingPipelineStateCreationDescription. |
|
nodiscard |
This creates a new render pass object.
description | - The render pass description. See xiiGALRenderPassCreationDescription. |
|
nodiscard |
This creates a new sampler object.
description | - The sampler description. See xiiGALSamplerCreationDescription. |
|
nodiscard |
This creates a new shader object.
description | - The shader description. See xiiGALShaderCreationDescription. |
|
nodiscard |
This creates a swap chain object.
description | - The swap chain description. See xiiGALSwapChainCreationDescription. |
|
nodiscard |
This creates a new texture object.
description | - The texture description. See xiiGALTextureCreationDescription. |
pInitialData | - The pointer to the xiiGALTextureData structure that describes the initial texture data or nullptr if no data is provided. Immutable textures (xiiGALResourceUsage::Immutable) must be initialized during creation. |
For example, for a 15 x 6 x 2 2D texture array, the following array of sub-resources should be provided:
15x6, 7x3, 3x1, 1x1, 15x6, 7x3, 3x1, 1x1.
For a 15 x 6 x 4 3D texture, the following array of sub-resources should be provided:
15x6x4, 7x3x2, 3x1x1, 1x1x1
|
nodiscard |
This creates a new tile pipeline state object.
description | - The tile pipeline state description. See xiiGALTilePipelineStateCreationDescription. |
|
nodiscard |
This creates a new top-level acceleration structure object.
description | - The top-level acceleration structure description. See xiiGALTopLevelASCreationDescription. |
|
nodiscardpure virtual |
Retrieves a pointer to the compute queue if available, null otherwise.
queueType | - The queue type that has the required feature. |
Implemented in xiiGALDeviceVulkan.
|
static |
Sets a default graphics device.
void xiiGALDevice::WaitIdle | ( | ) |
Waits until all outstanding operations on the GPU are complete and destroys any pending resources and GPU objects.