From c746f802d7b23d9c5ee0f52a7e5428a32bf3f316 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Tue, 24 Jul 2018 21:31:09 -0700 Subject: Updated DeviceContextBase to use final types for pipeline state, buffers and texture views --- Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h | 2 +- Graphics/GraphicsEngineVulkan/include/BufferVkImpl.h | 3 ++- Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h | 3 ++- Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h | 2 +- .../GraphicsEngineVulkan/include/DeviceContextVkImpl.h | 7 +++++-- .../GraphicsEngineVulkan/include/PipelineStateVkImpl.h | 2 +- Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h | 2 +- Graphics/GraphicsEngineVulkan/include/SamplerVkImpl.h | 2 +- .../include/ShaderResourceBindingVkImpl.h | 3 ++- Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h | 2 +- Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h | 3 ++- Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h | 2 +- Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h | 2 +- Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp | 14 ++++++-------- 14 files changed, 27 insertions(+), 22 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h b/Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h index 6c88c16e..5d6671ce 100644 --- a/Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/BufferViewVkImpl.h @@ -41,7 +41,7 @@ class BufferVkImpl; class BufferViewVkImpl : public BufferViewBase { public: - typedef BufferViewBase TBufferViewBase; + using TBufferViewBase = BufferViewBase; BufferViewVkImpl( IReferenceCounters* pRefCounters, IRenderDevice* pDevice, diff --git a/Graphics/GraphicsEngineVulkan/include/BufferVkImpl.h b/Graphics/GraphicsEngineVulkan/include/BufferVkImpl.h index e4a0edf4..6b448e1b 100644 --- a/Graphics/GraphicsEngineVulkan/include/BufferVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/BufferVkImpl.h @@ -45,7 +45,8 @@ class FixedBlockMemoryAllocator; class BufferVkImpl : public BufferBase { public: - typedef BufferBase TBufferBase; + using TBufferBase = BufferBase; + BufferVkImpl(IReferenceCounters* pRefCounters, FixedBlockMemoryAllocator& BuffViewObjMemAllocator, class RenderDeviceVkImpl* pDeviceVk, diff --git a/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h b/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h index d309b49e..d4507a28 100644 --- a/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h @@ -36,7 +36,8 @@ namespace Diligent class CommandListVkImpl : public CommandListBase { public: - typedef CommandListBase TCommandListBase; + using TCommandListBase = CommandListBase; + CommandListVkImpl(IReferenceCounters* pRefCounters, IRenderDevice* pDevice, IDeviceContext* pDeferredCtx, diff --git a/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h b/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h index b1ec606f..5a3de325 100644 --- a/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.h @@ -41,7 +41,7 @@ namespace Diligent class CommandQueueVkImpl : public ObjectBase { public: - typedef ObjectBase TBase; + using TBase = ObjectBase; CommandQueueVkImpl(IReferenceCounters* pRefCounters, std::shared_ptr LogicalDevice, diff --git a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h index 26e74a25..4470c028 100644 --- a/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.h @@ -37,15 +37,18 @@ #include "DescriptorPoolManager.h" #include "PipelineLayout.h" #include "GenerateMipsVkHelper.h" +#include "BufferVKImpl.h" +#include "TextureViewVKImpl.h" +#include "PipelineStateVKImpl.h" namespace Diligent { /// Implementation of the Diligent::IDeviceContext interface -class DeviceContextVkImpl : public DeviceContextBase +class DeviceContextVkImpl : public DeviceContextBase { public: - typedef DeviceContextBase TDeviceContextBase; + using TDeviceContextBase = DeviceContextBase; DeviceContextVkImpl(IReferenceCounters* pRefCounters, class RenderDeviceVkImpl* pDevice, diff --git a/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h b/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h index e06d853d..b98dedf5 100644 --- a/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/PipelineStateVkImpl.h @@ -48,7 +48,7 @@ class FixedBlockMemoryAllocator; class PipelineStateVkImpl : public PipelineStateBase { public: - typedef PipelineStateBase TPipelineStateBase; + using TPipelineStateBase = PipelineStateBase; PipelineStateVkImpl( IReferenceCounters* pRefCounters, class RenderDeviceVkImpl* pDeviceVk, const PipelineStateDesc &PipelineDesc ); ~PipelineStateVkImpl(); diff --git a/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h b/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h index 612854f7..11257bf0 100644 --- a/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.h @@ -54,7 +54,7 @@ namespace Diligent class RenderDeviceVkImpl : public RenderDeviceBase { public: - typedef RenderDeviceBase TRenderDeviceBase; + using TRenderDeviceBase = RenderDeviceBase; RenderDeviceVkImpl( IReferenceCounters* pRefCounters, IMemoryAllocator& RawMemAllocator, diff --git a/Graphics/GraphicsEngineVulkan/include/SamplerVkImpl.h b/Graphics/GraphicsEngineVulkan/include/SamplerVkImpl.h index 23d4c713..c3595b0e 100644 --- a/Graphics/GraphicsEngineVulkan/include/SamplerVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/SamplerVkImpl.h @@ -38,7 +38,7 @@ class FixedBlockMemoryAllocator; class SamplerVkImpl : public SamplerBase { public: - typedef SamplerBase TSamplerBase; + using TSamplerBase = SamplerBase; SamplerVkImpl(IReferenceCounters* pRefCounters, class RenderDeviceVkImpl* pRenderDeviceVk, const SamplerDesc& SamplerDesc); ~SamplerVkImpl(); diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.h b/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.h index 978a967d..34186c61 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceBindingVkImpl.h @@ -43,7 +43,8 @@ class FixedBlockMemoryAllocator; class ShaderResourceBindingVkImpl : public ShaderResourceBindingBase { public: - typedef ShaderResourceBindingBase TBase; + using TBase = ShaderResourceBindingBase; + ShaderResourceBindingVkImpl(IReferenceCounters* pRefCounters, class PipelineStateVkImpl* pPSO, bool IsPSOInternal); ~ShaderResourceBindingVkImpl(); diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h b/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h index 2c6d7272..09d14a9b 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/ShaderVkImpl.h @@ -43,7 +43,7 @@ class FixedBlockMemoryAllocator; class ShaderVkImpl : public ShaderBase { public: - typedef ShaderBase TShaderBase; + using TShaderBase = ShaderBase; ShaderVkImpl(IReferenceCounters* pRefCounters, class RenderDeviceVkImpl* pRenderDeviceVk, const ShaderCreationAttribs &CreationAttribs); ~ShaderVkImpl(); diff --git a/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h b/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h index 018e1eb8..dcb62ab5 100644 --- a/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/SwapChainVkImpl.h @@ -40,7 +40,8 @@ class IMemoryAllocator; class SwapChainVkImpl : public SwapChainBase { public: - typedef SwapChainBase TSwapChainBase; + using TSwapChainBase = SwapChainBase; + SwapChainVkImpl(IReferenceCounters* pRefCounters, const SwapChainDesc& SwapChainDesc, class RenderDeviceVkImpl* pRenderDeviceVk, diff --git a/Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h b/Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h index 63d66ac0..9863d6aa 100644 --- a/Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/TextureViewVkImpl.h @@ -39,7 +39,7 @@ class FixedBlockMemoryAllocator; class TextureViewVkImpl : public TextureViewBase { public: - typedef TextureViewBase TTextureViewBase; + using TTextureViewBase = TextureViewBase; TextureViewVkImpl( IReferenceCounters* pRefCounters, IRenderDevice* pDevice, diff --git a/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h b/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h index 660dd151..825a5f44 100644 --- a/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/TextureVkImpl.h @@ -41,7 +41,7 @@ class FixedBlockMemoryAllocator; class TextureVkImpl : public TextureBase { public: - typedef TextureBase TTextureBase; + using TTextureBase = TextureBase; // Creates a new Vk resource TextureVkImpl(IReferenceCounters* pRefCounters, diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index 1c8352d6..b4cd4dc9 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -264,11 +264,10 @@ namespace Diligent void DeviceContextVkImpl::CommitShaderResources(IShaderResourceBinding *pShaderResourceBinding, Uint32 Flags) { - if (!DeviceContextBase::CommitShaderResources(pShaderResourceBinding, Flags, 0 /*Dummy*/)) + if (!DeviceContextBase::CommitShaderResources(pShaderResourceBinding, Flags, 0 /*Dummy*/)) return; - auto *pPipelineStateVk = m_pPipelineState.RawPtr(); - pPipelineStateVk->CommitAndTransitionShaderResources(pShaderResourceBinding, this, true, Flags, &m_DesrSetBindInfo); + m_pPipelineState->CommitAndTransitionShaderResources(pShaderResourceBinding, this, true, Flags, &m_DesrSetBindInfo); } void DeviceContextVkImpl::SetStencilRef(Uint32 StencilRef) @@ -304,9 +303,8 @@ namespace Diligent void DeviceContextVkImpl::CommitVkVertexBuffers() { #ifdef DEVELOPMENT - auto *pPipelineStateVk = m_pPipelineState.RawPtr(); - if (m_NumVertexStreams < pPipelineStateVk->GetNumBufferSlotsUsed()) - LOG_ERROR("Currently bound pipeline state \"", pPipelineStateVk->GetDesc().Name, "\" expects ", pPipelineStateVk->GetNumBufferSlotsUsed(), " input buffer slots, but only ", m_NumVertexStreams, " is bound"); + if (m_NumVertexStreams < m_pPipelineState->GetNumBufferSlotsUsed()) + LOG_ERROR("Currently bound pipeline state \"", m_pPipelineState->GetDesc().Name, "\" expects ", m_pPipelineState->GetNumBufferSlotsUsed(), " input buffer slots, but only ", m_NumVertexStreams, " is bound"); #endif // Do not initialize array with zeroes for performance reasons VkBuffer vkVertexBuffers[MaxBufferSlots];// = {} @@ -399,7 +397,7 @@ namespace Diligent } #endif - auto *pPipelineStateVk = m_pPipelineState.RawPtr(); + auto *pPipelineStateVk = m_pPipelineState.RawPtr(); EnsureVkCmdBuffer(); @@ -507,7 +505,7 @@ namespace Diligent } #endif - auto *pPipelineStateVk = m_pPipelineState.RawPtr(); + auto *pPipelineStateVk = m_pPipelineState.RawPtr(); EnsureVkCmdBuffer(); -- cgit v1.2.3