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 QueueGetGraphicsQueue () const
 
const QueueGetTransferQueue () const
 
vk::PhysicalDevice GetVulkanPhysicalDevice () const
 
const vk::PhysicalDeviceProperties & GetPhysicalDeviceProperties () const
 
const ExtensionsGetExtensions () const
 
const plVulkanDispatchContextGetDispatchContext () const
 
vk::PipelineStageFlags GetSupportedStages () const
 
vk::CommandBuffer & GetCurrentCommandBuffer ()
 
plPipelineBarrierVulkanGetCurrentPipelineBarrier ()
 
plQueryPoolVulkanGetQueryPool () const
 
plFenceQueueVulkanGetFenceQueue () const
 
plStagingBufferPoolVulkanGetStagingBufferPool () const
 
plInitContextVulkanGetInitContext () 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 plGALFormatLookupTableVulkanGetFormatLookupTable () 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 plGALSharedTextureGetSharedTexture (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 ()
 
plGALCommandEncoderBeginCommands (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< plGALAsyncResultGetTimestampResult (plGALTimestampHandle hTimestamp, plTime &out_result)
 Queries the result of a timestamp. Should be called every frame until plGALAsyncResult::Ready is returned.
 
plEnum< plGALAsyncResultGetOcclusionQueryResult (plGALOcclusionHandle hOcclusion, plUInt64 &out_uiResult)
 
plEnum< plGALAsyncResultGetFenceResult (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 plGALDeviceCreationDescriptionGetDescription () const
 
const plGALSwapChainGetSwapChain (plGALSwapChainHandle hSwapChain) const
 
template<typename T >
const T * GetSwapChain (plGALSwapChainHandle hSwapChain) const
 
const plGALShaderGetShader (plGALShaderHandle hShader) const
 
const plGALTextureGetTexture (plGALTextureHandle hTexture) const
 
const plGALBufferGetBuffer (plGALBufferHandle hBuffer) const
 
const plGALDepthStencilStateGetDepthStencilState (plGALDepthStencilStateHandle hDepthStencilState) const
 
const plGALBlendStateGetBlendState (plGALBlendStateHandle hBlendState) const
 
const plGALRasterizerStateGetRasterizerState (plGALRasterizerStateHandle hRasterizerState) const
 
const plGALVertexDeclarationGetVertexDeclaration (plGALVertexDeclarationHandle hVertexDeclaration) const
 
const plGALSamplerStateGetSamplerState (plGALSamplerStateHandle hSamplerState) const
 
const plGALTextureResourceViewGetResourceView (plGALTextureResourceViewHandle hResourceView) const
 
const plGALBufferResourceViewGetResourceView (plGALBufferResourceViewHandle hResourceView) const
 
const plGALRenderTargetViewGetRenderTargetView (plGALRenderTargetViewHandle hRenderTargetView) const
 
const plGALTextureUnorderedAccessViewGetUnorderedAccessView (plGALTextureUnorderedAccessViewHandle hUnorderedAccessView) const
 
const plGALBufferUnorderedAccessViewGetUnorderedAccessView (plGALBufferUnorderedAccessViewHandle hUnorderedAccessView) const
 
const plGALDeviceCapabilitiesGetCapabilities () 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.
 
plAllocatorGetAllocator ()
 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 plGALDeviceGetDefaultDevice ()
 
static bool HasDefaultDevice ()
 

Public Attributes

plEvent< OnBeforeImageDestroyedDataOnBeforeImageDestroyed
 
- 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 plGALCommandEncoderBeginCommandsPlatform (const char *szName) override
 
virtual void EndCommandsPlatform (plGALCommandEncoder *pPass) override
 
virtual void FlushPlatform () override
 
virtual plGALBlendStateCreateBlendStatePlatform (const plGALBlendStateCreationDescription &Description) override
 
virtual void DestroyBlendStatePlatform (plGALBlendState *pBlendState) override
 
virtual plGALDepthStencilStateCreateDepthStencilStatePlatform (const plGALDepthStencilStateCreationDescription &Description) override
 
virtual void DestroyDepthStencilStatePlatform (plGALDepthStencilState *pDepthStencilState) override
 
virtual plGALRasterizerStateCreateRasterizerStatePlatform (const plGALRasterizerStateCreationDescription &Description) override
 
virtual void DestroyRasterizerStatePlatform (plGALRasterizerState *pRasterizerState) override
 
virtual plGALSamplerStateCreateSamplerStatePlatform (const plGALSamplerStateCreationDescription &Description) override
 
virtual void DestroySamplerStatePlatform (plGALSamplerState *pSamplerState) override
 
virtual plGALShaderCreateShaderPlatform (const plGALShaderCreationDescription &Description) override
 
virtual void DestroyShaderPlatform (plGALShader *pShader) override
 
virtual plGALBufferCreateBufferPlatform (const plGALBufferCreationDescription &Description, plArrayPtr< const plUInt8 > pInitialData) override
 
virtual void DestroyBufferPlatform (plGALBuffer *pBuffer) override
 
virtual plGALTextureCreateTexturePlatform (const plGALTextureCreationDescription &Description, plArrayPtr< plGALSystemMemoryDescription > pInitialData) override
 
virtual void DestroyTexturePlatform (plGALTexture *pTexture) override
 
virtual plGALTextureCreateSharedTexturePlatform (const plGALTextureCreationDescription &Description, plArrayPtr< plGALSystemMemoryDescription > pInitialData, plEnum< plGALSharedTextureType > sharedType, plGALPlatformSharedHandle handle) override
 
virtual void DestroySharedTexturePlatform (plGALTexture *pTexture) override
 
virtual plGALTextureResourceViewCreateResourceViewPlatform (plGALTexture *pResource, const plGALTextureResourceViewCreationDescription &Description) override
 
virtual void DestroyResourceViewPlatform (plGALTextureResourceView *pResourceView) override
 
virtual plGALBufferResourceViewCreateResourceViewPlatform (plGALBuffer *pResource, const plGALBufferResourceViewCreationDescription &Description) override
 
virtual void DestroyResourceViewPlatform (plGALBufferResourceView *pResourceView) override
 
virtual plGALRenderTargetViewCreateRenderTargetViewPlatform (plGALTexture *pTexture, const plGALRenderTargetViewCreationDescription &Description) override
 
virtual void DestroyRenderTargetViewPlatform (plGALRenderTargetView *pRenderTargetView) override
 
plGALTextureUnorderedAccessViewCreateUnorderedAccessViewPlatform (plGALTexture *pResource, const plGALTextureUnorderedAccessViewCreationDescription &Description) override
 
virtual void DestroyUnorderedAccessViewPlatform (plGALTextureUnorderedAccessView *pUnorderedAccessView) override
 
plGALBufferUnorderedAccessViewCreateUnorderedAccessViewPlatform (plGALBuffer *pResource, const plGALBufferUnorderedAccessViewCreationDescription &Description) override
 
virtual void DestroyUnorderedAccessViewPlatform (plGALBufferUnorderedAccessView *pUnorderedAccessView) override
 
virtual plGALVertexDeclarationCreateVertexDeclarationPlatform (const plGALVertexDeclarationCreationDescription &Description) override
 
virtual void DestroyVertexDeclarationPlatform (plGALVertexDeclaration *pVertexDeclaration) override
 
virtual plEnum< plGALAsyncResultGetTimestampResultPlatform (plGALTimestampHandle hTimestamp, plTime &out_result) override
 
virtual plEnum< plGALAsyncResultGetOcclusionResultPlatform (plGALOcclusionHandle hOcclusion, plUInt64 &out_uiResult) override
 
virtual plEnum< plGALAsyncResultGetFenceResultPlatform (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 plGALSwapChainGetSwapChainInternal (plGALSwapChainHandle hSwapChain, const plRTTI *pRequestedType) const
 
plGALTextureHandle FinalizeTextureInternal (const plGALTextureCreationDescription &desc, plGALTexture *pTexture)
 
plGALBufferHandle FinalizeBufferInternal (const plGALBufferCreationDescription &desc, plGALBuffer *pBuffer)
 

Friends

plInternal::NewInstance< plGALDeviceCreateVulkanDevice (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 >, plLocalAllocatorWrapperm_BlendStateTable
 
plHashTable< plUInt32, plGALDepthStencilStateHandle, plHashHelper< plUInt32 >, plLocalAllocatorWrapperm_DepthStencilStateTable
 
plHashTable< plUInt32, plGALRasterizerStateHandle, plHashHelper< plUInt32 >, plLocalAllocatorWrapperm_RasterizerStateTable
 
plHashTable< plUInt32, plGALSamplerStateHandle, plHashHelper< plUInt32 >, plLocalAllocatorWrapperm_SamplerStateTable
 
plHashTable< plUInt32, plGALVertexDeclarationHandle, plHashHelper< plUInt32 >, plLocalAllocatorWrapperm_VertexDeclarationTable
 
plDynamicArray< DeadObject, plLocalAllocatorWrapperm_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: