Plasma Engine  2.0
Loading...
Searching...
No Matches
plGALDeviceVulkan Class Reference

The Vulkan device implementation of the graphics abstraction layer. More...

#include <DeviceVulkan.h>

Inheritance diagram for plGALDeviceVulkan:

Classes

struct  Extensions
 
struct  OnBeforeImageDestroyedData
 
struct  PendingDeletion
 
struct  PendingDeletionFlags
 
struct  Queue
 
struct  ReclaimResource
 
struct  SemaphoreInfo
 

Public Member Functions

vk::Instance GetVulkanInstance () const
 
vk::Device GetVulkanDevice () const
 
const Queue & GetGraphicsQueue () const
 
const Queue & GetTransferQueue () const
 
vk::PhysicalDevice GetVulkanPhysicalDevice () const
 
const vk::PhysicalDeviceProperties & GetPhysicalDeviceProperties () const
 
const Extensions & GetExtensions () const
 
const plVulkanDispatchContext & GetDispatchContext () const
 
vk::PipelineStageFlags GetSupportedStages () const
 
vk::CommandBuffer & GetCurrentCommandBuffer ()
 
plPipelineBarrierVulkan & GetCurrentPipelineBarrier ()
 
plQueryPoolVulkan & GetQueryPool () const
 
plFenceQueueVulkan & GetFenceQueue () const
 
plStagingBufferPoolVulkan & GetStagingBufferPool () const
 
plInitContextVulkan & GetInitContext () const
 
plGALTextureHandle CreateTextureInternal (const plGALTextureCreationDescription &Description, plArrayPtr< plGALSystemMemoryDescription > pInitialData, bool bLinearCPU=false, bool bStaging=false)
 
plGALBufferHandle CreateBufferInternal (const plGALBufferCreationDescription &Description, plArrayPtr< const plUInt8 > pInitialData, bool bCPU=false)
 
const plGALFormatLookupTableVulkan & GetFormatLookupTable () const
 
plInt32 GetMemoryIndex (vk::MemoryPropertyFlags properties, const vk::MemoryRequirements &requirements) const
 
vk::Fence Submit (bool bAddSignalSemaphore=true)
 
void DeleteLaterImpl (const PendingDeletion &deletion)
 
void DeleteLater (vk::Image &image, vk::DeviceMemory &externalMemory)
 
template<typename T >
void DeleteLater (T &object, plVulkanAllocation &allocation)
 
template<typename T >
void DeleteLater (T &object, void *pContext)
 
template<typename T >
void DeleteLater (T &object)
 
void ReclaimLater (const ReclaimResource &reclaim)
 
template<typename T >
void ReclaimLater (T &object, void *pContext=nullptr)
 
void SetDebugName (const vk::DebugUtilsObjectNameInfoEXT &info, plVulkanAllocation allocation=nullptr)
 
template<typename T >
void SetDebugName (const char *szName, T &object, plVulkanAllocation allocation=nullptr)
 
void ReportLiveGpuObjects ()
 
virtual const plGALSharedTexture * GetSharedTexture (plGALTextureHandle hTexture) const override
 
void AddWaitSemaphore (const SemaphoreInfo &waitSemaphore)
 
void AddSignalSemaphore (const SemaphoreInfo &signalSemaphore)
 
- Public Member Functions inherited from plGALDevice
plResult Init ()
 
plResult Shutdown ()
 
plStringView GetRenderer ()
 
plGALCommandEncoder * BeginCommands (const char *szName)
 Begin recording GPU commands on the returned command encoder.
 
void EndCommands (plGALCommandEncoder *pCommandEncoder)
 Stop recording commands on the command encoder.
 
plGALBlendStateHandle CreateBlendState (const plGALBlendStateCreationDescription &description)
 
void DestroyBlendState (plGALBlendStateHandle hBlendState)
 
plGALDepthStencilStateHandle CreateDepthStencilState (const plGALDepthStencilStateCreationDescription &description)
 
void DestroyDepthStencilState (plGALDepthStencilStateHandle hDepthStencilState)
 
plGALRasterizerStateHandle CreateRasterizerState (const plGALRasterizerStateCreationDescription &description)
 
void DestroyRasterizerState (plGALRasterizerStateHandle hRasterizerState)
 
plGALSamplerStateHandle CreateSamplerState (const plGALSamplerStateCreationDescription &description)
 
void DestroySamplerState (plGALSamplerStateHandle hSamplerState)
 
plGALShaderHandle CreateShader (const plGALShaderCreationDescription &description)
 
void DestroyShader (plGALShaderHandle hShader)
 
plGALBufferHandle CreateBuffer (const plGALBufferCreationDescription &description, plArrayPtr< const plUInt8 > initialData=plArrayPtr< const plUInt8 >())
 
void DestroyBuffer (plGALBufferHandle hBuffer)
 
plGALBufferHandle CreateVertexBuffer (plUInt32 uiVertexSize, plUInt32 uiVertexCount, plArrayPtr< const plUInt8 > initialData=plArrayPtr< const plUInt8 >(), bool bDataIsMutable=false)
 
plGALBufferHandle CreateIndexBuffer (plGALIndexType::Enum indexType, plUInt32 uiIndexCount, plArrayPtr< const plUInt8 > initialData=plArrayPtr< const plUInt8 >(), bool bDataIsMutable=false)
 
plGALBufferHandle CreateConstantBuffer (plUInt32 uiBufferSize)
 
plGALTextureHandle CreateTexture (const plGALTextureCreationDescription &description, plArrayPtr< plGALSystemMemoryDescription > initialData=plArrayPtr< plGALSystemMemoryDescription >())
 
void DestroyTexture (plGALTextureHandle hTexture)
 
plGALTextureHandle CreateProxyTexture (plGALTextureHandle hParentTexture, plUInt32 uiSlice)
 
void DestroyProxyTexture (plGALTextureHandle hProxyTexture)
 
plGALTextureHandle CreateSharedTexture (const plGALTextureCreationDescription &description, plArrayPtr< plGALSystemMemoryDescription > initialData={})
 
plGALTextureHandle OpenSharedTexture (const plGALTextureCreationDescription &description, plGALPlatformSharedHandle hSharedHandle)
 
void DestroySharedTexture (plGALTextureHandle hTexture)
 
plGALTextureResourceViewHandle GetDefaultResourceView (plGALTextureHandle hTexture)
 
plGALBufferResourceViewHandle GetDefaultResourceView (plGALBufferHandle hBuffer)
 
plGALTextureResourceViewHandle CreateResourceView (const plGALTextureResourceViewCreationDescription &description)
 
void DestroyResourceView (plGALTextureResourceViewHandle hResourceView)
 
plGALBufferResourceViewHandle CreateResourceView (const plGALBufferResourceViewCreationDescription &description)
 
void DestroyResourceView (plGALBufferResourceViewHandle hResourceView)
 
plGALRenderTargetViewHandle GetDefaultRenderTargetView (plGALTextureHandle hTexture)
 
plGALRenderTargetViewHandle CreateRenderTargetView (const plGALRenderTargetViewCreationDescription &description)
 
void DestroyRenderTargetView (plGALRenderTargetViewHandle hRenderTargetView)
 
plGALTextureUnorderedAccessViewHandle CreateUnorderedAccessView (const plGALTextureUnorderedAccessViewCreationDescription &description)
 
void DestroyUnorderedAccessView (plGALTextureUnorderedAccessViewHandle hUnorderedAccessView)
 
plGALBufferUnorderedAccessViewHandle CreateUnorderedAccessView (const plGALBufferUnorderedAccessViewCreationDescription &description)
 
void DestroyUnorderedAccessView (plGALBufferUnorderedAccessViewHandle hUnorderedAccessView)
 
plGALSwapChainHandle CreateSwapChain (const SwapChainFactoryFunction &func)
 
plResult UpdateSwapChain (plGALSwapChainHandle hSwapChain, plEnum< plGALPresentMode > newPresentMode)
 
void DestroySwapChain (plGALSwapChainHandle hSwapChain)
 
plGALVertexDeclarationHandle CreateVertexDeclaration (const plGALVertexDeclarationCreationDescription &description)
 
void DestroyVertexDeclaration (plGALVertexDeclarationHandle hVertexDeclaration)
 
plEnum< plGALAsyncResult > GetTimestampResult (plGALTimestampHandle hTimestamp, plTime &out_result)
 Queries the result of a timestamp. Should be called every frame until plGALAsyncResult::Ready is returned.
 
plEnum< plGALAsyncResult > GetOcclusionQueryResult (plGALOcclusionHandle hOcclusion, plUInt64 &out_uiResult)
 
plEnum< plGALAsyncResult > GetFenceResult (plGALFenceHandle hFence, plTime timeout=plTime::MakeZero())
 
plGALTextureHandle GetBackBufferTextureFromSwapChain (plGALSwapChainHandle hSwapChain)
 
void EnqueueFrameSwapChain (plGALSwapChainHandle hSwapChain)
 Adds a swap-chain to be used for the next frame. Must be called before or during the plGALDeviceEvent::BeforeBeginFrame event (BeginFrame function) and repeated for every frame the swap-chain is to be used. This approach guarantees that all swap-chains of a frame acquire and present at the same time, which improves frame pacing.
 
void BeginFrame (const plUInt64 uiAppFrame=0)
 Begins rendering of a frame. This needs to be called first before any rendering function can be called.
 
void EndFrame ()
 Ends rendering of a frame and submits all data to the GPU. No further rendering calls are allowed until BeginFrame is called again.
 
plUInt64 GetCurrentFrame () const
 The current rendering frame. This is a monotonically increasing number which changes +1 every time EndFrame is called. You can use this to synchronize read/writes between CPU and GPU, see GetSafeFrame.
 
plUInt64 GetSafeFrame () const
 The latest frame that has been fully executed on the GPU. Whenever you execute any work that requires synchronization between CPU and GPU, remember the GetCurrentFrame result in which the operation was done. When GetSafeFrame reaches this number, you know for sure that the GPU has completed all operations of that frame.
 
const plGALDeviceCreationDescription * GetDescription () const
 
const plGALSwapChain * GetSwapChain (plGALSwapChainHandle hSwapChain) const
 
template<typename T >
const T * GetSwapChain (plGALSwapChainHandle hSwapChain) const
 
const plGALShader * GetShader (plGALShaderHandle hShader) const
 
const plGALTexture * GetTexture (plGALTextureHandle hTexture) const
 
const plGALBuffer * GetBuffer (plGALBufferHandle hBuffer) const
 
const plGALDepthStencilState * GetDepthStencilState (plGALDepthStencilStateHandle hDepthStencilState) const
 
const plGALBlendState * GetBlendState (plGALBlendStateHandle hBlendState) const
 
const plGALRasterizerState * GetRasterizerState (plGALRasterizerStateHandle hRasterizerState) const
 
const plGALVertexDeclaration * GetVertexDeclaration (plGALVertexDeclarationHandle hVertexDeclaration) const
 
const plGALSamplerState * GetSamplerState (plGALSamplerStateHandle hSamplerState) const
 
const plGALTextureResourceView * GetResourceView (plGALTextureResourceViewHandle hResourceView) const
 
const plGALBufferResourceView * GetResourceView (plGALBufferResourceViewHandle hResourceView) const
 
const plGALRenderTargetView * GetRenderTargetView (plGALRenderTargetViewHandle hRenderTargetView) const
 
const plGALTextureUnorderedAccessView * GetUnorderedAccessView (plGALTextureUnorderedAccessViewHandle hUnorderedAccessView) const
 
const plGALBufferUnorderedAccessView * GetUnorderedAccessView (plGALBufferUnorderedAccessViewHandle hUnorderedAccessView) const
 
const plGALDeviceCapabilities & GetCapabilities () const
 
virtual plUInt64 GetMemoryConsumptionForTexture (const plGALTextureCreationDescription &description) const
 
virtual plUInt64 GetMemoryConsumptionForBuffer (const plGALBufferCreationDescription &description) const
 
void Flush ()
 
void WaitIdle ()
 Waits for the GPU to be idle and destroys any pending resources and GPU objects.
 
plAllocator * GetAllocator ()
 Internal: Returns the allocator used by the device.
 
template<typename IdTableType , typename ReturnType >
PL_ALWAYS_INLINE ReturnType * Get (typename IdTableType::TypeOfId hHandle, const IdTableType &IdTable) const
 
template<typename HandleType >
PL_FORCE_INLINE void AddDeadObject (plUInt32 uiType, HandleType handle)
 

Static Public Member Functions

static void UploadBufferStaging (plStagingBufferPoolVulkan *pStagingBufferPool, plPipelineBarrierVulkan *pPipelineBarrier, vk::CommandBuffer commandBuffer, const plGALBufferVulkan *pBuffer, plArrayPtr< const plUInt8 > pInitialData, vk::DeviceSize dstOffset=0)
 
static void UploadTextureStaging (plStagingBufferPoolVulkan *pStagingBufferPool, plPipelineBarrierVulkan *pPipelineBarrier, vk::CommandBuffer commandBuffer, const plGALTextureVulkan *pTexture, const vk::ImageSubresourceLayers &subResource, const plGALSystemMemoryDescription &data)
 
- Static Public Member Functions inherited from plGALDevice
static void SetDefaultDevice (plGALDevice *pDefaultDevice)
 
static plGALDevice * GetDefaultDevice ()
 
static bool HasDefaultDevice ()
 

Public Attributes

plEvent< OnBeforeImageDestroyedData > OnBeforeImageDestroyed
 
- Public Attributes inherited from plGALDevice
plMutex m_Mutex
 

Protected Member Functions

vk::Result SelectInstanceExtensions (plHybridArray< const char *, 6 > &extensions)
 
vk::Result SelectDeviceExtensions (vk::DeviceCreateInfo &deviceCreateInfo, plHybridArray< const char *, 6 > &extensions)
 
virtual plStringView GetRendererPlatform () override
 
virtual plResult InitPlatform () override
 
virtual plResult ShutdownPlatform () override
 
virtual plGALCommandEncoder * BeginCommandsPlatform (const char *szName) override
 
virtual void EndCommandsPlatform (plGALCommandEncoder *pPass) override
 
virtual void FlushPlatform () override
 
virtual plGALBlendState * CreateBlendStatePlatform (const plGALBlendStateCreationDescription &Description) override
 
virtual void DestroyBlendStatePlatform (plGALBlendState *pBlendState) override
 
virtual plGALDepthStencilState * CreateDepthStencilStatePlatform (const plGALDepthStencilStateCreationDescription &Description) override
 
virtual void DestroyDepthStencilStatePlatform (plGALDepthStencilState *pDepthStencilState) override
 
virtual plGALRasterizerState * CreateRasterizerStatePlatform (const plGALRasterizerStateCreationDescription &Description) override
 
virtual void DestroyRasterizerStatePlatform (plGALRasterizerState *pRasterizerState) override
 
virtual plGALSamplerState * CreateSamplerStatePlatform (const plGALSamplerStateCreationDescription &Description) override
 
virtual void DestroySamplerStatePlatform (plGALSamplerState *pSamplerState) override
 
virtual plGALShader * CreateShaderPlatform (const plGALShaderCreationDescription &Description) override
 
virtual void DestroyShaderPlatform (plGALShader *pShader) override
 
virtual plGALBuffer * CreateBufferPlatform (const plGALBufferCreationDescription &Description, plArrayPtr< const plUInt8 > pInitialData) override
 
virtual void DestroyBufferPlatform (plGALBuffer *pBuffer) override
 
virtual plGALTexture * CreateTexturePlatform (const plGALTextureCreationDescription &Description, plArrayPtr< plGALSystemMemoryDescription > pInitialData) override
 
virtual void DestroyTexturePlatform (plGALTexture *pTexture) override
 
virtual plGALTexture * CreateSharedTexturePlatform (const plGALTextureCreationDescription &Description, plArrayPtr< plGALSystemMemoryDescription > pInitialData, plEnum< plGALSharedTextureType > sharedType, plGALPlatformSharedHandle handle) override
 
virtual void DestroySharedTexturePlatform (plGALTexture *pTexture) override
 
virtual plGALTextureResourceView * CreateResourceViewPlatform (plGALTexture *pResource, const plGALTextureResourceViewCreationDescription &Description) override
 
virtual void DestroyResourceViewPlatform (plGALTextureResourceView *pResourceView) override
 
virtual plGALBufferResourceView * CreateResourceViewPlatform (plGALBuffer *pResource, const plGALBufferResourceViewCreationDescription &Description) override
 
virtual void DestroyResourceViewPlatform (plGALBufferResourceView *pResourceView) override
 
virtual plGALRenderTargetView * CreateRenderTargetViewPlatform (plGALTexture *pTexture, const plGALRenderTargetViewCreationDescription &Description) override
 
virtual void DestroyRenderTargetViewPlatform (plGALRenderTargetView *pRenderTargetView) override
 
plGALTextureUnorderedAccessView * CreateUnorderedAccessViewPlatform (plGALTexture *pResource, const plGALTextureUnorderedAccessViewCreationDescription &Description) override
 
virtual void DestroyUnorderedAccessViewPlatform (plGALTextureUnorderedAccessView *pUnorderedAccessView) override
 
plGALBufferUnorderedAccessView * CreateUnorderedAccessViewPlatform (plGALBuffer *pResource, const plGALBufferUnorderedAccessViewCreationDescription &Description) override
 
virtual void DestroyUnorderedAccessViewPlatform (plGALBufferUnorderedAccessView *pUnorderedAccessView) override
 
virtual plGALVertexDeclaration * CreateVertexDeclarationPlatform (const plGALVertexDeclarationCreationDescription &Description) override
 
virtual void DestroyVertexDeclarationPlatform (plGALVertexDeclaration *pVertexDeclaration) override
 
virtual plEnum< plGALAsyncResult > GetTimestampResultPlatform (plGALTimestampHandle hTimestamp, plTime &out_result) override
 
virtual plEnum< plGALAsyncResult > GetOcclusionResultPlatform (plGALOcclusionHandle hOcclusion, plUInt64 &out_uiResult) override
 
virtual plEnum< plGALAsyncResult > GetFenceResultPlatform (plGALFenceHandle hFence, plTime timeout) override
 
virtual void BeginFramePlatform (plArrayPtr< plGALSwapChain * > swapchains, const plUInt64 uiAppFrame) override
 
virtual void EndFramePlatform (plArrayPtr< plGALSwapChain * > swapchains) override
 
virtual plUInt64 GetCurrentFramePlatform () const override
 
virtual plUInt64 GetSafeFramePlatform () const override
 
virtual void FillCapabilitiesPlatform () override
 
virtual void WaitIdlePlatform () override
 
- Protected Member Functions inherited from plGALDevice
 plGALDevice (const plGALDeviceCreationDescription &Description)
 
template<typename IdTableType , typename ReturnType >
ReturnType * Get (typename IdTableType::TypeOfId hHandle, const IdTableType &IdTable) const
 
void DestroyViews (plGALTexture *pResource)
 
void DestroyViews (plGALBuffer *pResource)
 
template<typename HandleType >
void AddDeadObject (plUInt32 uiType, HandleType handle)
 
template<typename HandleType >
void ReviveDeadObject (plUInt32 uiType, HandleType handle)
 
void DestroyDeadObjects ()
 
void VerifyMultithreadedAccess () const
 Asserts that either this device supports multi-threaded resource creation, or that this function is executed on the main thread.
 
const plGALSwapChain * GetSwapChainInternal (plGALSwapChainHandle hSwapChain, const plRTTI *pRequestedType) const
 
plGALTextureHandle FinalizeTextureInternal (const plGALTextureCreationDescription &desc, plGALTexture *pTexture)
 
plGALBufferHandle FinalizeBufferInternal (const plGALBufferCreationDescription &desc, plGALBuffer *pBuffer)
 

Friends

plInternal::NewInstance< plGALDevice > CreateVulkanDevice (plAllocator *pAllocator, const plGALDeviceCreationDescription &Description)
 

Additional Inherited Members

- Public Types inherited from plGALDevice
using SwapChainFactoryFunction = plDelegate<plGALSwapChain*(plAllocator*)>
 
- Static Public Attributes inherited from plGALDevice
static plEvent< const plGALDeviceEvent & > s_Events
 
- Protected Types inherited from plGALDevice
using ShaderTable = plIdTable<plGALShaderHandle::IdType, plGALShader*, plLocalAllocatorWrapper>
 
using BlendStateTable = plIdTable<plGALBlendStateHandle::IdType, plGALBlendState*, plLocalAllocatorWrapper>
 
using DepthStencilStateTable = plIdTable<plGALDepthStencilStateHandle::IdType, plGALDepthStencilState*, plLocalAllocatorWrapper>
 
using RasterizerStateTable = plIdTable<plGALRasterizerStateHandle::IdType, plGALRasterizerState*, plLocalAllocatorWrapper>
 
using BufferTable = plIdTable<plGALBufferHandle::IdType, plGALBuffer*, plLocalAllocatorWrapper>
 
using TextureTable = plIdTable<plGALTextureHandle::IdType, plGALTexture*, plLocalAllocatorWrapper>
 
using TextureResourceViewTable = plIdTable<plGALTextureResourceViewHandle::IdType, plGALTextureResourceView*, plLocalAllocatorWrapper>
 
using BufferResourceViewTable = plIdTable<plGALBufferResourceViewHandle::IdType, plGALBufferResourceView*, plLocalAllocatorWrapper>
 
using SamplerStateTable = plIdTable<plGALSamplerStateHandle::IdType, plGALSamplerState*, plLocalAllocatorWrapper>
 
using RenderTargetViewTable = plIdTable<plGALRenderTargetViewHandle::IdType, plGALRenderTargetView*, plLocalAllocatorWrapper>
 
using TextureUnorderedAccessViewTable = plIdTable<plGALTextureUnorderedAccessViewHandle::IdType, plGALTextureUnorderedAccessView*, plLocalAllocatorWrapper>
 
using BufferUnorderedAccessViewTable = plIdTable<plGALBufferUnorderedAccessViewHandle::IdType, plGALBufferUnorderedAccessView*, plLocalAllocatorWrapper>
 
using SwapChainTable = plIdTable<plGALSwapChainHandle::IdType, plGALSwapChain*, plLocalAllocatorWrapper>
 
using VertexDeclarationTable = plIdTable<plGALVertexDeclarationHandle::IdType, plGALVertexDeclaration*, plLocalAllocatorWrapper>
 
- Protected Attributes inherited from plGALDevice
plProxyAllocator m_Allocator
 
plLocalAllocatorWrapper m_AllocatorWrapper
 
ShaderTable m_Shaders
 
BlendStateTable m_BlendStates
 
DepthStencilStateTable m_DepthStencilStates
 
RasterizerStateTable m_RasterizerStates
 
BufferTable m_Buffers
 
TextureTable m_Textures
 
TextureResourceViewTable m_TextureResourceViews
 
BufferResourceViewTable m_BufferResourceViews
 
SamplerStateTable m_SamplerStates
 
RenderTargetViewTable m_RenderTargetViews
 
TextureUnorderedAccessViewTable m_TextureUnorderedAccessViews
 
BufferUnorderedAccessViewTable m_BufferUnorderedAccessViews
 
SwapChainTable m_SwapChains
 
VertexDeclarationTable m_VertexDeclarations
 
plHashTable< plUInt32, plGALBlendStateHandle, plHashHelper< plUInt32 >, plLocalAllocatorWrapper > m_BlendStateTable
 
plHashTable< plUInt32, plGALDepthStencilStateHandle, plHashHelper< plUInt32 >, plLocalAllocatorWrapper > m_DepthStencilStateTable
 
plHashTable< plUInt32, plGALRasterizerStateHandle, plHashHelper< plUInt32 >, plLocalAllocatorWrapper > m_RasterizerStateTable
 
plHashTable< plUInt32, plGALSamplerStateHandle, plHashHelper< plUInt32 >, plLocalAllocatorWrapper > m_SamplerStateTable
 
plHashTable< plUInt32, plGALVertexDeclarationHandle, plHashHelper< plUInt32 >, plLocalAllocatorWrapper > m_VertexDeclarationTable
 
plDynamicArray< DeadObject, plLocalAllocatorWrapper > m_DeadObjects
 
plGALDeviceCreationDescription m_Description
 
plGALDeviceCapabilities m_Capabilities
 

Detailed Description

The Vulkan device implementation of the graphics abstraction layer.

Member Function Documentation

◆ GetSharedTexture()

const plGALSharedTexture * plGALDeviceVulkan::GetSharedTexture ( plGALTextureHandle hTexture) const
overridevirtual

Implements plGALDevice.


The documentation for this class was generated from the following files: