diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-11-11 02:06:24 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-11-11 02:06:24 +0000 |
| commit | 81618891065f897e238039b4ed2312eaf3e49102 (patch) | |
| tree | 5ae4a970a82cba1ed7581317c8c0009528defe01 /Graphics/GraphicsEngineVulkan | |
| parent | OpenGL backend: fixed setting RTV and DSV from the swap chain (diff) | |
| download | DiligentCore-81618891065f897e238039b4ed2312eaf3e49102.tar.gz DiligentCore-81618891065f897e238039b4ed2312eaf3e49102.zip | |
Added comments to Vulkan backend implementation
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
14 files changed, 117 insertions, 22 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h b/Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h index d71c04eb..1d031bde 100644 --- a/Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h @@ -38,7 +38,7 @@ namespace Diligent class FixedBlockMemoryAllocator; class BufferVkImpl; -/// Implementation of the Diligent::IBufferViewVk interface +/// Buffer view implementation in Vulkan backend. class BufferViewVkImpl final : public BufferViewBase<IBufferViewVk, RenderDeviceVkImpl> { public: @@ -54,6 +54,7 @@ public: virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; + /// Implementation of IBufferViewVk::GetVkBufferView(). virtual VkBufferView GetVkBufferView()const override final{return m_BuffView;} const BufferVkImpl* GetBufferVk()const; diff --git a/Graphics/GraphicsEngineVulkan/include/BufferVkImpl.h b/Graphics/GraphicsEngineVulkan/include/BufferVkImpl.h index df3369f1..0f785181 100644 --- a/Graphics/GraphicsEngineVulkan/include/BufferVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/BufferVkImpl.h @@ -43,7 +43,7 @@ namespace Diligent class FixedBlockMemoryAllocator; class DeviceContextVkImpl; -/// Implementation of the Diligent::IBufferVk interface +/// Buffer object implementation in Vulkan backend. class BufferVkImpl final : public BufferBase<IBufferVk, RenderDeviceVkImpl, BufferViewVkImpl, FixedBlockMemoryAllocator> { public: @@ -86,16 +86,23 @@ public: return static_cast<Uint32>(DynAlloc.AlignedOffset); } } + + /// Implementation of IBufferVk::GetVkBuffer(). VkBuffer GetVkBuffer()const override final; + /// Implementation of IBuffer::GetNativeHandle() in Vulkan backend. virtual void* GetNativeHandle()override final { auto vkBuffer = GetVkBuffer(); return vkBuffer; } + /// Implementation of IBufferVk::SetAccessFlags(). virtual void SetAccessFlags(VkAccessFlags AccessFlags)override final; + + /// Implementation of IBufferVk::GetAccessFlags(). virtual VkAccessFlags GetAccessFlags()const override final; + bool CheckAccessFlags(VkAccessFlags AccessFlags)const { return (GetAccessFlags() & AccessFlags) == AccessFlags; diff --git a/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h b/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h index 3732a797..e0aaa628 100644 --- a/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h @@ -33,7 +33,7 @@ namespace Diligent { -/// Implementation of the Diligent::ICommandList interface +/// Command list implementation in Vulkan backend. class CommandListVkImpl final : public CommandListBase<ICommandList, RenderDeviceVkImpl> { public: diff --git a/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h b/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h index bb36c417..2744a013 100644 --- a/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h @@ -50,24 +50,31 @@ public: virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; - // Returns the fence value that will be signaled next time + /// Implementation of ICommandQueueVk::GetNextFenceValue(). virtual Uint64 GetNextFenceValue()override final { return m_NextFenceValue; } - // Submits a given command buffer to the queue + /// Implementation of ICommandQueueVk::Submit(). virtual Uint64 Submit(VkCommandBuffer cmdBuffer)override final; + /// Implementation of ICommandQueueVk::Submit(). virtual Uint64 Submit(const VkSubmitInfo& SubmitInfo)override final; + /// Implementation of ICommandQueueVk::Present(). virtual VkResult Present(const VkPresentInfoKHR& PresentInfo)override final; + /// Implementation of ICommandQueueVk::GetVkQueue(). virtual VkQueue GetVkQueue()override final{return m_VkQueue;} + /// Implementation of ICommandQueueVk::GetQueueFamilyIndex(). virtual uint32_t GetQueueFamilyIndex()const override final { return m_QueueFamilyIndex; } + /// Implementation of ICommandQueueVk::GetQueueFamilyIndex(). virtual Uint64 WaitForIdle()override final; + /// Implementation of ICommandQueueVk::GetCompletedFenceValue(). virtual Uint64 GetCompletedFenceValue()override final; + /// Implementation of ICommandQueueVk::SignalFence(). virtual void SignalFence(VkFence vkFence)override final; void SetFence(RefCntAutoPtr<FenceVkImpl> pFence){m_pFence = std::move(pFence);} diff --git a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h index d8b89810..3dbe25f2 100644 --- a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h @@ -56,7 +56,7 @@ struct DeviceContextVkImplTraits using ICommandQueueType = ICommandQueueVk; }; -/// Implementation of the Diligent::IDeviceContext interface +/// Device context implementation in Vulkan backend. class DeviceContextVkImpl final : public DeviceContextNextGenBase<IDeviceContextVk, DeviceContextVkImplTraits> { public: @@ -73,16 +73,22 @@ public: virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; + /// Implementation of IDeviceContext::SetPipelineState() in Vulkan backend. virtual void SetPipelineState(IPipelineState* pPipelineState)override final; + /// Implementation of IDeviceContext::TransitionShaderResources() in Vulkan backend. virtual void TransitionShaderResources(IPipelineState* pPipelineState, IShaderResourceBinding* pShaderResourceBinding)override final; + /// Implementation of IDeviceContext::CommitShaderResources() in Vulkan backend. virtual void CommitShaderResources(IShaderResourceBinding* pShaderResourceBinding, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode)override final; + /// Implementation of IDeviceContext::SetStencilRef() in Vulkan backend. virtual void SetStencilRef(Uint32 StencilRef)override final; + /// Implementation of IDeviceContext::SetBlendFactors() in Vulkan backend. virtual void SetBlendFactors(const float* pBlendFactors = nullptr)override final; + /// Implementation of IDeviceContext::SetVertexBuffers() in Vulkan backend. virtual void SetVertexBuffers( Uint32 StartSlot, Uint32 NumBuffersSet, IBuffer** ppBuffers, @@ -90,41 +96,56 @@ public: RESOURCE_STATE_TRANSITION_MODE StateTransitionMode, SET_VERTEX_BUFFERS_FLAGS Flags )override final; + /// Implementation of IDeviceContext::InvalidateState() in Vulkan backend. virtual void InvalidateState()override final; + /// Implementation of IDeviceContext::SetIndexBuffer() in Vulkan backend. virtual void SetIndexBuffer( IBuffer* pIndexBuffer, Uint32 ByteOffset, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode )override final; + /// Implementation of IDeviceContext::SetViewports() in Vulkan backend. virtual void SetViewports( Uint32 NumViewports, const Viewport* pViewports, Uint32 RTWidth, Uint32 RTHeight )override final; + /// Implementation of IDeviceContext::SetScissorRects() in Vulkan backend. virtual void SetScissorRects( Uint32 NumRects, const Rect* pRects, Uint32 RTWidth, Uint32 RTHeight )override final; + /// Implementation of IDeviceContext::SetRenderTargets() in Vulkan backend. virtual void SetRenderTargets( Uint32 NumRenderTargets, ITextureView* ppRenderTargets[], ITextureView* pDepthStencil, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode )override final; + /// Implementation of IDeviceContext::Draw() in Vulkan backend. virtual void Draw (const DrawAttribs& Attribs)override final; + /// Implementation of IDeviceContext::DrawIndexed() in Vulkan backend. virtual void DrawIndexed (const DrawIndexedAttribs& Attribs)override final; + /// Implementation of IDeviceContext::DrawIndirect() in Vulkan backend. virtual void DrawIndirect (const DrawIndirectAttribs& Attribs, IBuffer* pAttribsBuffer)override final; + /// Implementation of IDeviceContext::DrawIndexedIndirect() in Vulkan backend. virtual void DrawIndexedIndirect(const DrawIndexedIndirectAttribs& Attribs, IBuffer* pAttribsBuffer)override final; + /// Implementation of IDeviceContext::DispatchCompute() in Vulkan backend. virtual void DispatchCompute(const DispatchComputeAttribs& Attribs)override final; + /// Implementation of IDeviceContext::DispatchComputeIndirect() in Vulkan backend. virtual void DispatchComputeIndirect(const DispatchComputeIndirectAttribs& Attribs, IBuffer* pAttribsBuffer)override final; + /// Implementation of IDeviceContext::ClearDepthStencil() in Vulkan backend. virtual void ClearDepthStencil(ITextureView* pView, CLEAR_DEPTH_STENCIL_FLAGS ClearFlags, float fDepth, Uint8 Stencil, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode)override final; + /// Implementation of IDeviceContext::ClearRenderTarget() in Vulkan backend. virtual void ClearRenderTarget( ITextureView* pView, const float* RGBA, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode )override final; + /// Implementation of IDeviceContext::UpdateBuffer() in Vulkan backend. virtual void UpdateBuffer(IBuffer* pBuffer, Uint32 Offset, Uint32 Size, const PVoid pData, RESOURCE_STATE_TRANSITION_MODE StateTransitionMode)override final; + /// Implementation of IDeviceContext::CopyBuffer() in Vulkan backend. virtual void CopyBuffer(IBuffer* pSrcBuffer, Uint32 SrcOffset, RESOURCE_STATE_TRANSITION_MODE SrcBufferTransitionMode, @@ -133,10 +154,13 @@ public: Uint32 Size, RESOURCE_STATE_TRANSITION_MODE DstBufferTransitionMode)override final; + /// Implementation of IDeviceContext::MapBuffer() in Vulkan backend. virtual void MapBuffer(IBuffer* pBuffer, MAP_TYPE MapType, MAP_FLAGS MapFlags, PVoid& pMappedData)override final; + /// Implementation of IDeviceContext::UnmapBuffer() in Vulkan backend. virtual void UnmapBuffer(IBuffer* pBuffer, MAP_TYPE MapType)override final; + /// Implementation of IDeviceContext::UpdateTexture() in Vulkan backend. virtual void UpdateTexture(ITexture* pTexture, Uint32 MipLevel, Uint32 Slice, @@ -145,8 +169,10 @@ public: RESOURCE_STATE_TRANSITION_MODE SrcBufferStateTransitionMode, RESOURCE_STATE_TRANSITION_MODE TextureStateTransitionModee)override final; + /// Implementation of IDeviceContext::CopyTexture() in Vulkan backend. virtual void CopyTexture(const CopyTextureAttribs& CopyAttribs)override final; + /// Implementation of IDeviceContext::MapTextureSubresource() in Vulkan backend. virtual void MapTextureSubresource( ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice, @@ -155,19 +181,25 @@ public: const Box* pMapRegion, MappedTextureSubresource& MappedData )override final; - + /// Implementation of IDeviceContext::UnmapTextureSubresource() in Vulkan backend. virtual void UnmapTextureSubresource(ITexture* pTexture, Uint32 MipLevel, Uint32 ArraySlice)override final; + /// Implementation of IDeviceContext::FinishCommandList() in Vulkan backend. virtual void FinishCommandList(class ICommandList** ppCommandList)override final; + /// Implementation of IDeviceContext::ExecuteCommandList() in Vulkan backend. virtual void ExecuteCommandList(class ICommandList* pCommandList)override final; + /// Implementation of IDeviceContext::SignalFence() in Vulkan backend. virtual void SignalFence(IFence* pFence, Uint64 Value)override final; + /// Implementation of IDeviceContext::WaitForFence() in Vulkan backend. virtual void WaitForFence(IFence* pFence, Uint64 Value, bool FlushContext)override final; + /// Implementation of IDeviceContext::WaitForIdle() in Vulkan backend. virtual void WaitForIdle()override final; + /// Implementation of IDeviceContext::Flush() in Vulkan backend. virtual void Flush()override final; // Transitions texture subresources from OldState to NewState, and optionally updates @@ -184,6 +216,7 @@ public: VkImageLayout NewLayout, const VkImageSubresourceRange& SubresRange); + /// Implementation of IDeviceContextVk::TransitionImageLayout(). virtual void TransitionImageLayout(ITexture* pTexture, VkImageLayout NewLayout)override final; @@ -195,6 +228,7 @@ public: RESOURCE_STATE NewState, bool UpdateBufferState); + /// Implementation of IDeviceContextVk::BufferMemoryBarrier(). virtual void BufferMemoryBarrier(IBuffer* pBuffer, VkAccessFlags NewAccessFlags)override final; diff --git a/Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h b/Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h index aecadf39..db6748f3 100644 --- a/Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/FenceVkImpl.h @@ -37,7 +37,7 @@ namespace Diligent class FixedBlockMemoryAllocator; -/// Implementation of the Diligent::IFenceVk interface +/// Fence implementation in Vulkan backend. class FenceVkImpl final : public FenceBase<IFenceVk, RenderDeviceVkImpl> { public: @@ -49,14 +49,15 @@ public: bool IsDeviceInternal = false); ~FenceVkImpl(); - // Note that this method is not thread-safe. The reason is that VulkanFencePool is not thread - // safe, and DeviceContextVkImpl::SignalFence() adds the fence to the pending fences list that - // are signaled later by the command context when it submits the command list. So there is no - // guarantee that the fence pool is not accessed simultaneously by multiple threads even if the - // fence object itself is protected by mutex. + /// Implementation of IFence::GetCompletedValue() in Vulkan backend. + /// Note that this method is not thread-safe. The reason is that VulkanFencePool is not thread + /// safe, and DeviceContextVkImpl::SignalFence() adds the fence to the pending fences list that + /// are signaled later by the command context when it submits the command list. So there is no + /// guarantee that the fence pool is not accessed simultaneously by multiple threads even if the + /// fence object itself is protected by mutex. virtual Uint64 GetCompletedValue()override final; - /// Resets the fence to the specified value. + /// Implementation of IFence::Reset() in Vulkan backend. virtual void Reset(Uint64 Value)override final; VulkanUtilities::FenceWrapper GetVkFence() { return m_FencePool.GetFence(); } diff --git a/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h b/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h index ec11ee0d..c1c2116b 100644 --- a/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h @@ -47,7 +47,7 @@ namespace Diligent class FixedBlockMemoryAllocator; class ShaderVariableManagerVk; -/// Implementation of the Diligent::IRenderDeviceVk interface +/// Pipeline state object implementation in Vulkan backend. class PipelineStateVkImpl final : public PipelineStateBase<IPipelineStateVk, RenderDeviceVkImpl> { public: @@ -58,20 +58,28 @@ public: virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; + /// Implementation of IPipelineState::CreateShaderResourceBinding() in Vulkan backend. virtual void CreateShaderResourceBinding(IShaderResourceBinding** ppShaderResourceBinding, bool InitStaticResources)override final; + /// Implementation of IPipelineState::IsCompatibleWith() in Vulkan backend. virtual bool IsCompatibleWith(const IPipelineState* pPSO)const override final; + /// Implementation of IPipelineStateVk::GetVkRenderPass(). virtual VkRenderPass GetVkRenderPass()const override final { return m_RenderPass; } + /// Implementation of IPipelineStateVk::GetVkPipeline(). virtual VkPipeline GetVkPipeline() const override final { return m_Pipeline; } + /// Implementation of IPipelineState::BindStaticResources() in Vulkan backend. virtual void BindStaticResources(Uint32 ShaderFlags, IResourceMapping* pResourceMapping, Uint32 Flags)override final; + /// Implementation of IPipelineState::GetStaticVariableCount() in Vulkan backend. virtual Uint32 GetStaticVariableCount(SHADER_TYPE ShaderType) const override final; + /// Implementation of IPipelineState::GetStaticVariableByName() in Vulkan backend. virtual IShaderResourceVariable* GetStaticVariableByName(SHADER_TYPE ShaderType, const Char* Name) override final; + /// Implementation of IPipelineState::GetStaticVariableByIndex() in Vulkan backend. virtual IShaderResourceVariable* GetStaticVariableByIndex(SHADER_TYPE ShaderType, Uint32 Index) override final; void CommitAndTransitionShaderResources(IShaderResourceBinding* pShaderResourceBinding, diff --git a/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h b/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h index 00905a12..858d3180 100644 --- a/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h @@ -49,7 +49,7 @@ namespace Diligent { -/// Implementation of the Diligent::IRenderDeviceVk interface +/// Render device implementation in Vulkan backend. class RenderDeviceVkImpl final : public RenderDeviceNextGenBase<RenderDeviceBase<IRenderDeviceVk>, ICommandQueueVk> { public: @@ -68,27 +68,36 @@ public: virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface )override final; + /// Implementation of IRenderDevice::CreatePipelineState() in Vulkan backend. virtual void CreatePipelineState(const PipelineStateDesc& PipelineDesc, IPipelineState** ppPipelineState)override final; + /// Implementation of IRenderDevice::CreateBuffer() in Vulkan backend. virtual void CreateBuffer(const BufferDesc& BuffDesc, const BufferData* pBuffData, IBuffer** ppBuffer)override final; + /// Implementation of IRenderDevice::CreateShader() in Vulkan backend. virtual void CreateShader(const ShaderCreateInfo& ShaderCreateInfo, IShader** ppShader)override final; + /// Implementation of IRenderDevice::CreateTexture() in Vulkan backend. virtual void CreateTexture(const TextureDesc& TexDesc, const TextureData* pData, ITexture** ppTexture)override final; void CreateTexture(const TextureDesc& TexDesc, VkImage vkImgHandle, RESOURCE_STATE InitialState, class TextureVkImpl** ppTexture); + /// Implementation of IRenderDevice::CreateSampler() in Vulkan backend. virtual void CreateSampler(const SamplerDesc& SamplerDesc, ISampler** ppSampler)override final; + /// Implementation of IRenderDevice::CreateFence() in Vulkan backend. virtual void CreateFence(const FenceDesc& Desc, IFence** ppFence)override final; + /// Implementation of IRenderDeviceVk::GetVkDevice(). virtual VkDevice GetVkDevice()override final{ return m_LogicalVkDevice->GetVkDevice();} + /// Implementation of IRenderDeviceVk::CreateTextureFromVulkanImage(). virtual void CreateTextureFromVulkanImage(VkImage vkImage, const TextureDesc& TexDesc, RESOURCE_STATE InitialState, ITexture** ppTexture)override final; + /// Implementation of IRenderDeviceVk::CreateBufferFromVulkanResource(). virtual void CreateBufferFromVulkanResource(VkBuffer vkBuffer, const BufferDesc& BuffDesc, RESOURCE_STATE InitialState, IBuffer** ppBuffer)override final; - // Idles the GPU + /// Implementation of IRenderDevice::IdleGPU() in Vulkan backend. virtual void IdleGPU()override final; // pImmediateCtx parameter is only used to make sure the command buffer is submitted from the immediate context @@ -98,6 +107,7 @@ public: void AllocateTransientCmdPool(VulkanUtilities::CommandPoolWrapper& CmdPool, VkCommandBuffer& vkCmdBuff, const Char* DebugPoolName = nullptr); void ExecuteAndDisposeTransientCmdBuff(Uint32 QueueIndex, VkCommandBuffer vkCmdBuff, VulkanUtilities::CommandPoolWrapper&& CmdPool); + /// Implementation of IRenderDevice::ReleaseStaleResources() in Vulkan backend. virtual void ReleaseStaleResources(bool ForceRelease = false)override final; DescriptorSetAllocation AllocateDescriptorSet(Uint64 CommandQueueMask, VkDescriptorSetLayout SetLayout, const char* DebugName = "") diff --git a/Graphics/GraphicsEngineVulkan/include/SamplerVkImpl.h b/Graphics/GraphicsEngineVulkan/include/SamplerVkImpl.h index 953b4803..d59a9491 100644 --- a/Graphics/GraphicsEngineVulkan/include/SamplerVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/SamplerVkImpl.h @@ -36,7 +36,8 @@ namespace Diligent { class FixedBlockMemoryAllocator; -/// Implementation of the Diligent::ISamplerVk interface + +/// Sampler object object implementation in Vulkan backend. class SamplerVkImpl final : public SamplerBase<ISamplerVk, RenderDeviceVkImpl> { public: @@ -47,6 +48,7 @@ public: virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override; + /// Implementation of ISamplerVk::GetVkSampler(). virtual VkSampler GetVkSampler()const override final{return m_VkSampler;} private: diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.h b/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.h index bc59889f..94ee2ba4 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.h @@ -50,14 +50,19 @@ public: virtual void QueryInterface( const INTERFACE_ID& IID, IObject** ppInterface )override final; + /// Implementation of IShaderResourceBinding::BindResources() in Vulkan backend. virtual void BindResources(Uint32 ShaderFlags, IResourceMapping* pResMapping, Uint32 Flags)override final; + /// Implementation of IShaderResourceBinding::GetVariableByName() in Vulkan backend. virtual IShaderResourceVariable* GetVariableByName(SHADER_TYPE ShaderType, const char* Name)override final; + /// Implementation of IShaderResourceBinding::GetVariableCount() in Vulkan backend. virtual Uint32 GetVariableCount(SHADER_TYPE ShaderType) const override final; + /// Implementation of IShaderResourceBinding::GetVariableByIndex() in Vulkan backend. virtual IShaderResourceVariable* GetVariableByIndex(SHADER_TYPE ShaderType, Uint32 Index)override final; + /// Implementation of IShaderResourceBinding::InitializeStaticResources() in Vulkan backend. virtual void InitializeStaticResources(const IPipelineState* pPipelineState)override final; ShaderResourceCacheVk& GetResourceCache() { return m_ShaderResourceCache; } diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h b/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h index 9273c6b1..9dd0dcac 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h @@ -38,7 +38,7 @@ namespace Diligent class ResourceMapping; class FixedBlockMemoryAllocator; -/// Implementation of the Diligent::IShaderVk interface +/// Shader object object implementation in Vulkan backend. class ShaderVkImpl final : public ShaderBase<IShaderVk, RenderDeviceVkImpl> { public: @@ -49,13 +49,16 @@ public: IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_ShaderVk, TShaderBase); + /// Implementation of IShader::GetResourceCount() in Vulkan backend. virtual Uint32 GetResourceCount()const override final { return m_pShaderResources->GetTotalResources(); } + /// Implementation of IShader::GetResource() in Vulkan backend. virtual ShaderResourceDesc GetResource(Uint32 Index)const override final; + /// Implementation of IShaderVk::GetSPIRV(). virtual const std::vector<uint32_t>& GetSPIRV()const override final { return m_SPIRV; diff --git a/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h b/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h index cdc29510..72475a31 100644 --- a/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h @@ -36,7 +36,8 @@ namespace Diligent class ITextureViewVk; class IMemoryAllocator; -/// Implementation of the Diligent::ISwapChainVk interface + +/// Swap chain implementation in Vulkan backend. class SwapChainVkImpl final : public SwapChainBase<ISwapChainVk> { public: @@ -51,21 +52,29 @@ public: virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; + /// Implementation of ISwapChain::Present() in Vulkan backend. virtual void Present(Uint32 SyncInterval)override final; + + /// Implementation of ISwapChain::Resize() in Vulkan backend. virtual void Resize( Uint32 NewWidth, Uint32 NewHeight )override final; + /// Implementation of ISwapChain::SetFullscreenMode() in Vulkan backend. virtual void SetFullscreenMode(const DisplayModeAttribs &DisplayMode)override final; + /// Implementation of ISwapChain::SetWindowedMode() in Vulkan backend. virtual void SetWindowedMode()override final; + /// Implementation of ISwapChainVk::GetVkSwapChain(). virtual VkSwapchainKHR GetVkSwapChain()override final{ return m_VkSwapChain; } + /// Implementation of ISwapChain::GetCurrentBackBufferRTV() in Vulkan backend. virtual ITextureViewVk* GetCurrentBackBufferRTV()override final { VERIFY_EXPR(m_BackBufferIndex >= 0 && m_BackBufferIndex < m_SwapChainDesc.BufferCount); return m_pBackBufferRTV[m_BackBufferIndex]; } + /// Implementation of ISwapChain::GetDepthBufferDSV() in Vulkan backend. virtual ITextureViewVk* GetDepthBufferDSV()override final{return m_pDepthBufferDSV;} private: diff --git a/Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h b/Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h index 89b57ba7..e6482d5c 100644 --- a/Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h @@ -36,7 +36,8 @@ namespace Diligent { class FixedBlockMemoryAllocator; -/// Implementation of the Diligent::ITextureViewVk interface + +/// Texture view implementation in Vulkan backend. class TextureViewVkImpl final : public TextureViewBase<ITextureViewVk, RenderDeviceVkImpl> { public: @@ -52,6 +53,7 @@ public: virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; + /// Implementation of ITextureViewVk::GetVulkanImageView(). VkImageView GetVulkanImageView()const override final{return m_ImageView;} bool HasMipLevelViews() const diff --git a/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h b/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h index 6ee1fc0b..e6515204 100644 --- a/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h @@ -40,7 +40,7 @@ class FixedBlockMemoryAllocator; Uint32 GetStagingDataOffset(const TextureDesc& TexDesc, Uint32 ArraySlice, Uint32 MipLevel); -/// Base implementation of the Diligent::ITextureVk interface +/// Texture object implementation in Vulkan backend. class TextureVkImpl final : public TextureBase<ITextureVk, RenderDeviceVkImpl, TextureViewVkImpl, FixedBlockMemoryAllocator> { public: @@ -66,14 +66,20 @@ public: virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface)override final; + /// Implementation of ITextureVk::GetVkImage(). virtual VkImage GetVkImage()const override final{ return m_VulkanImage; } + + /// Implementation of ITexture::GetNativeHandle() in Vulkan backend. virtual void* GetNativeHandle()override final { auto vkImage = GetVkImage(); return vkImage; } + /// Implementation of ITextureVk::SetLayout(). void SetLayout(VkImageLayout Layout)override final; + + /// Implementation of ITextureVk::GetLayout(). VkImageLayout GetLayout()const override final; VkBuffer GetVkStagingBuffer()const |
