diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-10-08 03:53:26 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-10-08 03:53:26 +0000 |
| commit | 20fbea68913e09adad6bb0a4357e995ceb782871 (patch) | |
| tree | 5da2b6e8a452f5f37a519349fa51a3a5a922c818 /Graphics/GraphicsEngineVulkan | |
| parent | D3D11 backend: cosmetic code changes (diff) | |
| download | DiligentCore-20fbea68913e09adad6bb0a4357e995ceb782871.tar.gz DiligentCore-20fbea68913e09adad6bb0a4357e995ceb782871.zip | |
More cosmetic code changes
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
40 files changed, 251 insertions, 180 deletions
diff --git a/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h b/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h index e18cc5ce..3732a797 100644 --- a/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h +++ b/Graphics/GraphicsEngineVulkan/include/CommandListVkImpl.h @@ -43,9 +43,9 @@ public: RenderDeviceVkImpl* pDevice, IDeviceContext* pDeferredCtx, VkCommandBuffer vkCmdBuff) : - TCommandListBase (pRefCounters, pDevice), - m_pDeferredCtx (pDeferredCtx), - m_vkCmdBuff (vkCmdBuff) + TCommandListBase {pRefCounters, pDevice}, + m_pDeferredCtx {pDeferredCtx}, + m_vkCmdBuff {vkCmdBuff } { } @@ -57,9 +57,9 @@ public: void Close(VkCommandBuffer& CmdBuff, RefCntAutoPtr<IDeviceContext>& pDeferredCtx) { - CmdBuff = m_vkCmdBuff; - m_vkCmdBuff = VK_NULL_HANDLE; - pDeferredCtx = std::move(m_pDeferredCtx); + CmdBuff = m_vkCmdBuff; + m_vkCmdBuff = VK_NULL_HANDLE; + pDeferredCtx = std::move(m_pDeferredCtx); } private: diff --git a/Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.h b/Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.h index 38d907b2..d80f30b9 100644 --- a/Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.h +++ b/Graphics/GraphicsEngineVulkan/include/DescriptorPoolManager.h @@ -49,10 +49,10 @@ public: VkDescriptorPool _Pool, Uint64 _CmdQueueMask, DescriptorSetAllocator& _DescrSetAllocator)noexcept : - Set (_Set), - Pool (_Pool), - CmdQueueMask (_CmdQueueMask), - DescrSetAllocator(&_DescrSetAllocator) + Set {_Set }, + Pool {_Pool }, + CmdQueueMask {_CmdQueueMask }, + DescrSetAllocator{&_DescrSetAllocator} {} DescriptorSetAllocation()noexcept{} @@ -60,10 +60,10 @@ public: DescriptorSetAllocation& operator = (const DescriptorSetAllocation&) = delete; DescriptorSetAllocation(DescriptorSetAllocation&& rhs)noexcept : - Set (rhs.Set), - Pool (rhs.Pool), - CmdQueueMask (rhs.CmdQueueMask), - DescrSetAllocator(rhs.DescrSetAllocator) + Set {rhs.Set }, + Pool {rhs.Pool }, + CmdQueueMask {rhs.CmdQueueMask }, + DescrSetAllocator{rhs.DescrSetAllocator} { rhs.Reset(); } @@ -131,11 +131,11 @@ public: std::vector<VkDescriptorPoolSize> PoolSizes, uint32_t MaxSets, bool AllowFreeing) noexcept: - m_DeviceVkImpl(DeviceVkImpl), - m_PoolName (std::move(PoolName)), - m_PoolSizes (std::move(PoolSizes)), - m_MaxSets (MaxSets), - m_AllowFreeing(AllowFreeing) + m_DeviceVkImpl{DeviceVkImpl }, + m_PoolName {std::move(PoolName) }, + m_PoolSizes {std::move(PoolSizes)}, + m_MaxSets {MaxSets }, + m_AllowFreeing{AllowFreeing } { #ifdef DEVELOPMENT m_AllocatedPoolCounter = 0; @@ -190,7 +190,14 @@ public: std::vector<VkDescriptorPoolSize> PoolSizes, uint32_t MaxSets, bool AllowFreeing) noexcept: - DescriptorPoolManager(DeviceVkImpl, std::move(PoolName), std::move(PoolSizes), MaxSets, AllowFreeing) + DescriptorPoolManager + { + DeviceVkImpl, + std::move(PoolName), + std::move(PoolSizes), + MaxSets, + AllowFreeing + } { #ifdef DEVELOPMENT m_AllocatedSetCounter = 0; @@ -239,8 +246,8 @@ class DynamicDescriptorSetAllocator { public: DynamicDescriptorSetAllocator(DescriptorPoolManager& PoolMgr, std::string Name) : - m_GlobalPoolMgr(PoolMgr), - m_Name (std::move(Name)) + m_GlobalPoolMgr{PoolMgr }, + m_Name {std::move(Name)} {} ~DynamicDescriptorSetAllocator(); diff --git a/Graphics/GraphicsEngineVulkan/include/PipelineLayout.h b/Graphics/GraphicsEngineVulkan/include/PipelineLayout.h index 237288ed..cf7c4533 100644 --- a/Graphics/GraphicsEngineVulkan/include/PipelineLayout.h +++ b/Graphics/GraphicsEngineVulkan/include/PipelineLayout.h @@ -98,8 +98,8 @@ public: const PipelineLayout* pDbgPipelineLayout = nullptr; #endif DescriptorSetBindInfo() : - vkSets(2), - DynamicOffsets(64) + vkSets {2}, + DynamicOffsets{64} { } diff --git a/Graphics/GraphicsEngineVulkan/include/RenderPassCache.h b/Graphics/GraphicsEngineVulkan/include/RenderPassCache.h index 0fee6bff..1d94e538 100644 --- a/Graphics/GraphicsEngineVulkan/include/RenderPassCache.h +++ b/Graphics/GraphicsEngineVulkan/include/RenderPassCache.h @@ -55,18 +55,18 @@ public: struct RenderPassCacheKey { RenderPassCacheKey() : - NumRenderTargets(0), - SampleCount (0), - DSVFormat (TEX_FORMAT_UNKNOWN) + NumRenderTargets{0}, + SampleCount {0}, + DSVFormat {TEX_FORMAT_UNKNOWN} {} RenderPassCacheKey(Uint32 _NumRenderTargets, Uint32 _SampleCount, const TEXTURE_FORMAT _RTVFormats[], TEXTURE_FORMAT _DSVFormat) : - NumRenderTargets( static_cast<decltype(NumRenderTargets)>(_NumRenderTargets) ), - SampleCount ( static_cast<decltype(SampleCount)> (_SampleCount) ), - DSVFormat ( _DSVFormat ) + NumRenderTargets{static_cast<decltype(NumRenderTargets)>(_NumRenderTargets)}, + SampleCount {static_cast<decltype(SampleCount)> (_SampleCount) }, + DSVFormat {_DSVFormat } { VERIFY_EXPR(_NumRenderTargets <= std::numeric_limits<decltype(NumRenderTargets)>::max()); VERIFY_EXPR(_SampleCount <= std::numeric_limits<decltype(SampleCount)>::max()); diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.h b/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.h index d76c7cc1..c9b97d57 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.h +++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceCacheVk.h @@ -71,7 +71,7 @@ public: ShaderResourceCacheVk(DbgCacheContentType dbgContentType) #ifdef _DEBUG - : m_DbgContentType(dbgContentType) + : m_DbgContentType{dbgContentType} #endif { } @@ -115,8 +115,8 @@ public: { public: DescriptorSet(Uint32 NumResources, Resource *pResources) : - m_NumResources (NumResources), - m_pResources (pResources) + m_NumResources {NumResources}, + m_pResources {pResources } {} DescriptorSet (const DescriptorSet&) = delete; diff --git a/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h b/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h index 4b904170..ff4376a1 100644 --- a/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h +++ b/Graphics/GraphicsEngineVulkan/include/ShaderResourceLayoutVk.h @@ -112,7 +112,7 @@ class ShaderResourceLayoutVk { public: ShaderResourceLayoutVk(const VulkanUtilities::VulkanLogicalDevice& LogicalDevice) : - m_LogicalDevice(LogicalDevice) + m_LogicalDevice{LogicalDevice} { } @@ -178,14 +178,14 @@ public: Uint32 _CacheOffset, Uint32 _SamplerInd, bool _ImmutableSamplerAssigned = false)noexcept : - Binding (static_cast<decltype(Binding)>(_Binding)), - DescriptorSet (static_cast<decltype(DescriptorSet)>(_DescriptorSet)), - CacheOffset (_CacheOffset), - SamplerInd (_SamplerInd), - VariableType (_VariableType), - ImmutableSamplerAssigned (_ImmutableSamplerAssigned ? 1 : 0), - SpirvAttribs (_SpirvAttribs), - ParentResLayout (_ParentLayout) + Binding {static_cast<decltype(Binding)>(_Binding) }, + DescriptorSet {static_cast<decltype(DescriptorSet)>(_DescriptorSet)}, + CacheOffset {_CacheOffset }, + SamplerInd {_SamplerInd }, + VariableType {_VariableType }, + ImmutableSamplerAssigned {_ImmutableSamplerAssigned ? 1 : 0}, + SpirvAttribs {_SpirvAttribs }, + ParentResLayout {_ParentLayout } { VERIFY(_CacheOffset < (1 << CacheOffsetBits), "Cache offset (", _CacheOffset, ") exceeds max representable value ", (1 << CacheOffsetBits) ); VERIFY(_SamplerInd < (1 << SamplerIndBits), "Sampler index (", _SamplerInd, ") exceeds max representable value ", (1 << SamplerIndBits) ); diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanDynamicHeap.h b/Graphics/GraphicsEngineVulkan/include/VulkanDynamicHeap.h index 67ed309f..d7140786 100644 --- a/Graphics/GraphicsEngineVulkan/include/VulkanDynamicHeap.h +++ b/Graphics/GraphicsEngineVulkan/include/VulkanDynamicHeap.h @@ -48,20 +48,20 @@ struct VulkanDynamicAllocation VulkanDynamicAllocation()noexcept{} VulkanDynamicAllocation(VulkanDynamicMemoryManager& _DynamicMemMgr, size_t _AlignedOffset, size_t _Size)noexcept : - pDynamicMemMgr(&_DynamicMemMgr), - AlignedOffset (_AlignedOffset), - Size (_Size) + pDynamicMemMgr{&_DynamicMemMgr}, + AlignedOffset {_AlignedOffset }, + Size {_Size } {} VulkanDynamicAllocation (const VulkanDynamicAllocation&) = delete; VulkanDynamicAllocation& operator = (const VulkanDynamicAllocation&) = delete; VulkanDynamicAllocation (VulkanDynamicAllocation&& rhs)noexcept : - pDynamicMemMgr(rhs.pDynamicMemMgr), - AlignedOffset (rhs.AlignedOffset), - Size (rhs.Size) + pDynamicMemMgr{rhs.pDynamicMemMgr}, + AlignedOffset {rhs.AlignedOffset }, + Size {rhs.Size } #ifdef DEVELOPMENT - , dvpFrameNumber(rhs.dvpFrameNumber) + , dvpFrameNumber{rhs.dvpFrameNumber} #endif { rhs.pDynamicMemMgr = nullptr; diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanUploadHeap.h b/Graphics/GraphicsEngineVulkan/include/VulkanUploadHeap.h index 3d2ead6a..303ec70d 100644 --- a/Graphics/GraphicsEngineVulkan/include/VulkanUploadHeap.h +++ b/Graphics/GraphicsEngineVulkan/include/VulkanUploadHeap.h @@ -62,10 +62,10 @@ struct VulkanUploadAllocation VkDeviceSize _Size, VkDeviceSize _AlignedOffset, VkBuffer _vkBuffer) noexcept : - vkBuffer (_vkBuffer), - CPUAddress (_CPUAddress), - Size (_Size), - AlignedOffset(_AlignedOffset) + vkBuffer {_vkBuffer }, + CPUAddress {_CPUAddress }, + Size {_Size }, + AlignedOffset{_AlignedOffset} {} VulkanUploadAllocation (const VulkanUploadAllocation&) = delete; VulkanUploadAllocation& operator = (const VulkanUploadAllocation&) = delete; @@ -114,9 +114,9 @@ private: UploadPageInfo(VulkanUtilities::VulkanMemoryAllocation&& _MemAllocation, VulkanUtilities::BufferWrapper&& _Buffer, Uint8* _CPUAddress) : - MemAllocation(std::move(_MemAllocation)), - Buffer (std::move(_Buffer)), - CPUAddress (_CPUAddress) + MemAllocation{std::move(_MemAllocation)}, + Buffer {std::move(_Buffer) }, + CPUAddress {_CPUAddress } { } VulkanUtilities::VulkanMemoryAllocation MemAllocation; diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanCommandBuffer.h b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanCommandBuffer.h index 16b4ea3b..c038bbf5 100644 --- a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanCommandBuffer.h +++ b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanCommandBuffer.h @@ -32,7 +32,7 @@ namespace VulkanUtilities { public: VulkanCommandBuffer(VkPipelineStageFlags EnabledGraphicsShaderStages)noexcept : - m_EnabledGraphicsShaderStages(EnabledGraphicsShaderStages) + m_EnabledGraphicsShaderStages{EnabledGraphicsShaderStages} {} VulkanCommandBuffer (const VulkanCommandBuffer&) = delete; diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanMemoryManager.h b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanMemoryManager.h index e28d9534..10fbffb7 100644 --- a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanMemoryManager.h +++ b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanMemoryManager.h @@ -49,15 +49,15 @@ struct VulkanMemoryAllocation VulkanMemoryAllocation& operator= (const VulkanMemoryAllocation&) = delete; VulkanMemoryAllocation(VulkanMemoryPage* _Page, VkDeviceSize _UnalignedOffset, VkDeviceSize _Size)noexcept : - Page (_Page), - UnalignedOffset(_UnalignedOffset), - Size (_Size) + Page {_Page }, + UnalignedOffset{_UnalignedOffset}, + Size {_Size } {} VulkanMemoryAllocation(VulkanMemoryAllocation&& rhs)noexcept : - Page (rhs.Page), - UnalignedOffset(rhs.UnalignedOffset), - Size (rhs.Size) + Page {rhs.Page }, + UnalignedOffset{rhs.UnalignedOffset}, + Size {rhs.Size } { rhs.Page = nullptr; rhs.UnalignedOffset = 0; @@ -96,10 +96,10 @@ public: ~VulkanMemoryPage(); VulkanMemoryPage(VulkanMemoryPage&& rhs)noexcept : - m_ParentMemoryMgr (rhs.m_ParentMemoryMgr), - m_AllocationMgr (std::move(rhs.m_AllocationMgr)), - m_VkMemory (std::move(rhs.m_VkMemory)), - m_CPUMemory (rhs.m_CPUMemory) + m_ParentMemoryMgr {rhs.m_ParentMemoryMgr }, + m_AllocationMgr {std::move(rhs.m_AllocationMgr)}, + m_VkMemory {std::move(rhs.m_VkMemory) }, + m_CPUMemory {rhs.m_CPUMemory } { rhs.m_CPUMemory = nullptr; } @@ -142,35 +142,35 @@ public: VkDeviceSize HostVisiblePageSize, VkDeviceSize DeviceLocalReserveSize, VkDeviceSize HostVisibleReserveSize) : - m_MgrName (std::move(MgrName)), - m_LogicalDevice (LogicalDevice), - m_PhysicalDevice (PhysicalDevice), - m_Allocator (Allocator), - m_DeviceLocalPageSize(DeviceLocalPageSize), - m_HostVisiblePageSize(HostVisiblePageSize), - m_DeviceLocalReserveSize(DeviceLocalReserveSize), - m_HostVisibleReserveSize(HostVisibleReserveSize) + m_MgrName {std::move(MgrName) }, + m_LogicalDevice {LogicalDevice }, + m_PhysicalDevice {PhysicalDevice }, + m_Allocator {Allocator }, + m_DeviceLocalPageSize {DeviceLocalPageSize }, + m_HostVisiblePageSize {HostVisiblePageSize }, + m_DeviceLocalReserveSize{DeviceLocalReserveSize}, + m_HostVisibleReserveSize{HostVisibleReserveSize} {} // We have to write this constructor because on msvc default // constructor is not labeled with noexcept, which makes all // std containers use copy instead of move VulkanMemoryManager(VulkanMemoryManager&& rhs)noexcept : - m_MgrName (std::move(rhs.m_MgrName)), - m_LogicalDevice (rhs.m_LogicalDevice), - m_PhysicalDevice (rhs.m_PhysicalDevice), - m_Allocator (rhs.m_Allocator), - m_Pages (std::move(rhs.m_Pages)), + m_MgrName {std::move(rhs.m_MgrName)}, + m_LogicalDevice {rhs.m_LogicalDevice }, + m_PhysicalDevice {rhs.m_PhysicalDevice }, + m_Allocator {rhs.m_Allocator }, + m_Pages {std::move(rhs.m_Pages) }, - m_DeviceLocalPageSize (rhs.m_DeviceLocalPageSize), - m_HostVisiblePageSize (rhs.m_HostVisiblePageSize), - m_DeviceLocalReserveSize (rhs.m_DeviceLocalReserveSize), - m_HostVisibleReserveSize (rhs.m_HostVisibleReserveSize), + m_DeviceLocalPageSize {rhs.m_DeviceLocalPageSize }, + m_HostVisiblePageSize {rhs.m_HostVisiblePageSize }, + m_DeviceLocalReserveSize {rhs.m_DeviceLocalReserveSize}, + m_HostVisibleReserveSize {rhs.m_HostVisibleReserveSize}, - //m_CurrUsedSize (rhs.m_CurrUsedSize), - m_PeakUsedSize (rhs.m_PeakUsedSize), - m_CurrAllocatedSize (rhs.m_CurrAllocatedSize), - m_PeakAllocatedSize (rhs.m_PeakAllocatedSize) + //m_CurrUsedSize {rhs.m_CurrUsedSize}, + m_PeakUsedSize {rhs.m_PeakUsedSize }, + m_CurrAllocatedSize {rhs.m_CurrAllocatedSize}, + m_PeakAllocatedSize {rhs.m_PeakAllocatedSize} { for(size_t i=0; i < m_CurrUsedSize.size(); ++i) m_CurrUsedSize[i].store(rhs.m_CurrUsedSize[i].load()); diff --git a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanObjectWrappers.h b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanObjectWrappers.h index a9e59fdf..b0442634 100644 --- a/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanObjectWrappers.h +++ b/Graphics/GraphicsEngineVulkan/include/VulkanUtilities/VulkanObjectWrappers.h @@ -35,18 +35,18 @@ namespace VulkanUtilities using VkObjectType = VulkanObjectType; VulkanObjectWrapper() : - m_pLogicalDevice(nullptr), - m_VkObject (VK_NULL_HANDLE) + m_pLogicalDevice{nullptr }, + m_VkObject {VK_NULL_HANDLE} {} VulkanObjectWrapper(std::shared_ptr<const VulkanLogicalDevice> pLogicalDevice, VulkanObjectType&& vkObject) : - m_pLogicalDevice(pLogicalDevice), - m_VkObject (vkObject) + m_pLogicalDevice{pLogicalDevice}, + m_VkObject {vkObject } { vkObject = VK_NULL_HANDLE; } // This constructor does not take ownership of the vulkan object explicit VulkanObjectWrapper(VulkanObjectType vkObject) : - m_VkObject (vkObject) + m_VkObject {vkObject} { } @@ -54,8 +54,8 @@ namespace VulkanUtilities VulkanObjectWrapper& operator = (const VulkanObjectWrapper&) = delete; VulkanObjectWrapper(VulkanObjectWrapper&& rhs)noexcept : - m_pLogicalDevice(std::move(rhs.m_pLogicalDevice)), - m_VkObject (rhs.m_VkObject) + m_pLogicalDevice{std::move(rhs.m_pLogicalDevice)}, + m_VkObject {rhs.m_VkObject } { rhs.m_VkObject = VK_NULL_HANDLE; } diff --git a/Graphics/GraphicsEngineVulkan/src/BufferViewVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/BufferViewVkImpl.cpp index f65329f0..eb9b4001 100644 --- a/Graphics/GraphicsEngineVulkan/src/BufferViewVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/BufferViewVkImpl.cpp @@ -35,8 +35,15 @@ BufferViewVkImpl::BufferViewVkImpl( IReferenceCounters* pRefCou IBuffer* pBuffer, VulkanUtilities::BufferViewWrapper&& BuffView, bool bIsDefaultView ) : - TBufferViewBase( pRefCounters, pDevice, ViewDesc, pBuffer, bIsDefaultView ), - m_BuffView(std::move(BuffView)) + TBufferViewBase + { + pRefCounters, + pDevice, + ViewDesc, + pBuffer, + bIsDefaultView + }, + m_BuffView{std::move(BuffView)} { } diff --git a/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp index 8e56fd81..8f96a003 100644 --- a/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/BufferVkImpl.cpp @@ -41,8 +41,15 @@ BufferVkImpl :: BufferVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImpl* pRenderDeviceVk, const BufferDesc& BuffDesc, const BufferData* pBuffData /*= nullptr*/) : - TBufferBase(pRefCounters, BuffViewObjMemAllocator, pRenderDeviceVk, BuffDesc, false), - m_DynamicAllocations(STD_ALLOCATOR_RAW_MEM(VulkanDynamicAllocation, GetRawAllocator(), "Allocator for vector<VulkanDynamicAllocation>")) + TBufferBase + { + pRefCounters, + BuffViewObjMemAllocator, + pRenderDeviceVk, + BuffDesc, + false + }, + m_DynamicAllocations{STD_ALLOCATOR_RAW_MEM(VulkanDynamicAllocation, GetRawAllocator(), "Allocator for vector<VulkanDynamicAllocation>")} { #define LOG_BUFFER_ERROR_AND_THROW(...) LOG_ERROR_AND_THROW("Buffer \"", BuffDesc.Name ? BuffDesc.Name : "", "\": ", ##__VA_ARGS__); diff --git a/Graphics/GraphicsEngineVulkan/src/CommandPoolManager.cpp b/Graphics/GraphicsEngineVulkan/src/CommandPoolManager.cpp index 9d9bc65e..30186949 100644 --- a/Graphics/GraphicsEngineVulkan/src/CommandPoolManager.cpp +++ b/Graphics/GraphicsEngineVulkan/src/CommandPoolManager.cpp @@ -32,11 +32,11 @@ CommandPoolManager::CommandPoolManager(RenderDeviceVkImpl& DeviceVkImpl, std::string Name, uint32_t queueFamilyIndex, VkCommandPoolCreateFlags flags)noexcept: - m_DeviceVkImpl (DeviceVkImpl), - m_Name (std::move(Name)), - m_QueueFamilyIndex(queueFamilyIndex), - m_CmdPoolFlags (flags), - m_CmdPools (STD_ALLOCATOR_RAW_MEM(VulkanUtilities::CommandPoolWrapper, GetRawAllocator(), "Allocator for deque<VulkanUtilities::CommandPoolWrapper>")) + m_DeviceVkImpl {DeviceVkImpl }, + m_Name {std::move(Name) }, + m_QueueFamilyIndex{queueFamilyIndex }, + m_CmdPoolFlags {flags }, + m_CmdPools {STD_ALLOCATOR_RAW_MEM(VulkanUtilities::CommandPoolWrapper, GetRawAllocator(), "Allocator for deque<VulkanUtilities::CommandPoolWrapper>")} { #ifdef DEVELOPMENT m_AllocatedPoolCounter = 0; diff --git a/Graphics/GraphicsEngineVulkan/src/CommandQueueVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/CommandQueueVkImpl.cpp index 8aa71855..79c03886 100644 --- a/Graphics/GraphicsEngineVulkan/src/CommandQueueVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/CommandQueueVkImpl.cpp @@ -31,11 +31,11 @@ namespace Diligent CommandQueueVkImpl::CommandQueueVkImpl(IReferenceCounters* pRefCounters, std::shared_ptr<VulkanUtilities::VulkanLogicalDevice> LogicalDevice, uint32_t QueueFamilyIndex) : - TBase(pRefCounters), - m_LogicalDevice (LogicalDevice), - m_VkQueue (LogicalDevice->GetQueue(QueueFamilyIndex, 0)), - m_QueueFamilyIndex (QueueFamilyIndex), - m_NextFenceValue (1) + TBase{pRefCounters}, + m_LogicalDevice {LogicalDevice}, + m_VkQueue {LogicalDevice->GetQueue(QueueFamilyIndex, 0)}, + m_QueueFamilyIndex {QueueFamilyIndex}, + m_NextFenceValue {1} { } @@ -51,7 +51,7 @@ IMPLEMENT_QUERY_INTERFACE( CommandQueueVkImpl, IID_CommandQueueVk, TBase ) Uint64 CommandQueueVkImpl::Submit(const VkSubmitInfo& SubmitInfo) { - std::lock_guard<std::mutex> Lock(m_QueueMutex); + std::lock_guard<std::mutex> Lock{m_QueueMutex}; Atomics::Int64 FenceValue = m_NextFenceValue; // Increment the value before submitting the buffer to be overly safe @@ -93,7 +93,7 @@ Uint64 CommandQueueVkImpl::Submit(VkCommandBuffer cmdBuffer) Uint64 CommandQueueVkImpl::WaitForIdle() { - std::lock_guard<std::mutex> Lock(m_QueueMutex); + std::lock_guard<std::mutex> Lock{m_QueueMutex}; // Update last completed fence value to unlock all waiting events Uint64 LastCompletedFenceValue = m_NextFenceValue; @@ -108,20 +108,20 @@ Uint64 CommandQueueVkImpl::WaitForIdle() Uint64 CommandQueueVkImpl::GetCompletedFenceValue() { - std::lock_guard<std::mutex> Lock(m_QueueMutex); + std::lock_guard<std::mutex> Lock{m_QueueMutex}; return m_pFence->GetCompletedValue(); } void CommandQueueVkImpl::SignalFence(VkFence vkFence) { - std::lock_guard<std::mutex> Lock(m_QueueMutex); + std::lock_guard<std::mutex> Lock{m_QueueMutex}; auto err = vkQueueSubmit(m_VkQueue, 0, nullptr, vkFence); DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to submit command buffer to the command queue"); (void)err; } VkResult CommandQueueVkImpl::Present(const VkPresentInfoKHR& PresentInfo) { - std::lock_guard<std::mutex> Lock(m_QueueMutex); + std::lock_guard<std::mutex> Lock{m_QueueMutex}; return vkQueuePresentKHR(m_VkQueue, &PresentInfo); } diff --git a/Graphics/GraphicsEngineVulkan/src/DescriptorPoolManager.cpp b/Graphics/GraphicsEngineVulkan/src/DescriptorPoolManager.cpp index e23854c1..c094e384 100644 --- a/Graphics/GraphicsEngineVulkan/src/DescriptorPoolManager.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DescriptorPoolManager.cpp @@ -62,7 +62,7 @@ DescriptorPoolManager::~DescriptorPoolManager() VulkanUtilities::DescriptorPoolWrapper DescriptorPoolManager::GetPool(const char* DebugName) { - std::lock_guard<std::mutex> Lock(m_Mutex); + std::lock_guard<std::mutex> Lock{m_Mutex}; #ifdef DEVELOPMENT ++m_AllocatedPoolCounter; #endif @@ -118,7 +118,7 @@ void DescriptorPoolManager::DisposePool(VulkanUtilities::DescriptorPoolWrapper&& void DescriptorPoolManager::FreePool(VulkanUtilities::DescriptorPoolWrapper&& Pool) { - std::lock_guard<std::mutex> Lock(m_Mutex); + std::lock_guard<std::mutex> Lock{m_Mutex}; m_DeviceVkImpl.GetLogicalDevice().ResetDescriptorPool(Pool); m_Pools.emplace_back(std::move(Pool)); #ifdef DEVELOPMENT @@ -153,7 +153,7 @@ DescriptorSetAllocation DescriptorSetAllocator::Allocate(Uint64 CommandQueueMask { // Descriptor pools are externally synchronized, meaning that the application must not allocate // and/or free descriptor sets from the same pool in multiple threads simultaneously (13.2.3) - std::lock_guard<std::mutex> Lock(m_Mutex); + std::lock_guard<std::mutex> Lock{m_Mutex}; const auto& LogicalDevice = m_DeviceVkImpl.GetLogicalDevice(); // Try all pools starting from the frontmost @@ -222,7 +222,7 @@ void DescriptorSetAllocator::FreeDescriptorSet(VkDescriptorSet Set, VkDescriptor { if (Allocator!=nullptr) { - std::lock_guard<std::mutex> Lock(Allocator->m_Mutex); + std::lock_guard<std::mutex> Lock{Allocator->m_Mutex}; Allocator->m_DeviceVkImpl.GetLogicalDevice().FreeDescriptorSet(Pool, Set); #ifdef DEVELOPMENT --Allocator->m_AllocatedSetCounter; diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index 7103818f..52ea7a5a 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -91,7 +91,7 @@ namespace Diligent pDeviceVkImpl->GetDynamicDescriptorPool(), GetContextObjectName("Dynamic descriptor set allocator", bIsDeferred, ContextId), }, - m_GenerateMipsHelper(std::move(GenerateMipsHelper)) + m_GenerateMipsHelper{std::move(GenerateMipsHelper)} { m_GenerateMipsHelper->CreateSRB(&m_GenerateMipsSRB); diff --git a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp index 8990fa55..d1219207 100644 --- a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp @@ -51,7 +51,7 @@ public: using TBase = EngineFactoryBase<IEngineFactoryVk>; EngineFactoryVkImpl() : - TBase(IID_EngineFactoryVk) + TBase{IID_EngineFactoryVk} {} void CreateDeviceAndContextsVk(const EngineVkCreateInfo& EngineCI, diff --git a/Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp index e0fb5d93..cb1be2b8 100644 --- a/Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp @@ -34,8 +34,14 @@ FenceVkImpl :: FenceVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImpl* pRendeDeviceVkImpl, const FenceDesc& Desc, bool IsDeviceInternal) : - TFenceBase(pRefCounters, pRendeDeviceVkImpl, Desc, IsDeviceInternal), - m_FencePool(pRendeDeviceVkImpl->GetLogicalDevice().GetSharedPtr()) + TFenceBase + { + pRefCounters, + pRendeDeviceVkImpl, + Desc, + IsDeviceInternal + }, + m_FencePool{pRendeDeviceVkImpl->GetLogicalDevice().GetSharedPtr()} { } diff --git a/Graphics/GraphicsEngineVulkan/src/FramebufferCache.cpp b/Graphics/GraphicsEngineVulkan/src/FramebufferCache.cpp index 3f7a5991..050fb1aa 100644 --- a/Graphics/GraphicsEngineVulkan/src/FramebufferCache.cpp +++ b/Graphics/GraphicsEngineVulkan/src/FramebufferCache.cpp @@ -61,7 +61,7 @@ size_t FramebufferCache::FramebufferCacheKey::GetHash()const VkFramebuffer FramebufferCache::GetFramebuffer(const FramebufferCacheKey& Key, uint32_t width, uint32_t height, uint32_t layers) { - std::lock_guard<std::mutex> Lock(m_Mutex); + std::lock_guard<std::mutex> Lock{m_Mutex}; auto it = m_Cache.find(Key); if (it != m_Cache.end()) { @@ -116,7 +116,7 @@ void FramebufferCache::OnDestroyImageView(VkImageView ImgView) // all entries in the m_ViewToKeyMap that refer to all keys with // that render pass - std::lock_guard<std::mutex> Lock(m_Mutex); + std::lock_guard<std::mutex> Lock{m_Mutex}; auto equal_range = m_ViewToKeyMap.equal_range(ImgView); for (auto it = equal_range.first; it != equal_range.second; ++it) { @@ -137,7 +137,7 @@ void FramebufferCache::OnDestroyRenderPass(VkRenderPass Pass) // TODO: when an image view is released, we need to also destroy // all entries in the m_RenderPassToKeyMap that refer to the keys // with the same image view - std::lock_guard<std::mutex> Lock(m_Mutex); + std::lock_guard<std::mutex> Lock{m_Mutex}; auto equal_range = m_RenderPassToKeyMap.equal_range(Pass); for (auto it = equal_range.first; it != equal_range.second; ++it) { diff --git a/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp b/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp index 7700b05c..cc9ae36f 100644 --- a/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp +++ b/Graphics/GraphicsEngineVulkan/src/GenerateMipsVkHelper.cpp @@ -187,7 +187,7 @@ namespace Diligent std::array<RefCntAutoPtr<IPipelineState>, 4>& GenerateMipsVkHelper::FindPSOs(TEXTURE_FORMAT Fmt) { - std::lock_guard<std::mutex> Lock(m_PSOMutex); + std::lock_guard<std::mutex> Lock{m_PSOMutex}; auto it = m_PSOHash.find(Fmt); if(it == m_PSOHash.end()) it = m_PSOHash.emplace(Fmt, CreatePSOs(Fmt)).first; diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp index 369b0a97..6f2bb597 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp @@ -88,8 +88,8 @@ VkDescriptorType PipelineLayout::GetVkDescriptorType(const SPIRVShaderResourceAt } PipelineLayout::DescriptorSetLayoutManager::DescriptorSetLayoutManager(IMemoryAllocator &MemAllocator): - m_MemAllocator(MemAllocator), - m_LayoutBindings(STD_ALLOCATOR_RAW_MEM(VkDescriptorSetLayoutBinding, MemAllocator, "Allocator for Layout Bindings")) + m_MemAllocator {MemAllocator}, + m_LayoutBindings{STD_ALLOCATOR_RAW_MEM(VkDescriptorSetLayoutBinding, MemAllocator, "Allocator for Layout Bindings")} {} diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp index 8ea380ee..3e9a64ee 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineStateVkImpl.cpp @@ -147,8 +147,8 @@ static std::vector<uint32_t> StripReflection(const std::vector<uint32_t>& Origin PipelineStateVkImpl :: PipelineStateVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImpl* pDeviceVk, const PipelineStateDesc& PipelineDesc) : - TPipelineStateBase(pRefCounters, pDeviceVk, PipelineDesc), - m_SRBMemAllocator (GetRawAllocator()) + TPipelineStateBase{pRefCounters, pDeviceVk, PipelineDesc}, + m_SRBMemAllocator {GetRawAllocator()} { const auto& LogicalDevice = pDeviceVk->GetLogicalDevice(); diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp index 278796bf..232a8167 100644 --- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp @@ -67,12 +67,12 @@ RenderDeviceVkImpl :: RenderDeviceVkImpl(IReferenceCounters* sizeof(FenceVkImpl) } }, - m_VulkanInstance(Instance), - m_PhysicalDevice(std::move(PhysicalDevice)), - m_LogicalVkDevice(std::move(LogicalDevice)), - m_EngineAttribs(EngineCI), - m_FramebufferCache(*this), - m_RenderPassCache(*this), + m_VulkanInstance {Instance }, + m_PhysicalDevice {std::move(PhysicalDevice)}, + m_LogicalVkDevice {std::move(LogicalDevice) }, + m_EngineAttribs {EngineCI }, + m_FramebufferCache {*this }, + m_RenderPassCache {*this }, m_DescriptorSetAllocator { *this, @@ -113,8 +113,24 @@ RenderDeviceVkImpl :: RenderDeviceVkImpl(IReferenceCounters* EngineCI.DynamicDescriptorPoolSize.MaxDescriptorSets, false // Pools can only be reset }, - m_TransientCmdPoolMgr(*this, "Transient command buffer pool manager", CmdQueues[0]->GetQueueFamilyIndex(), VK_COMMAND_POOL_CREATE_TRANSIENT_BIT), - m_MemoryMgr("Global resource memory manager", *m_LogicalVkDevice, *m_PhysicalDevice, GetRawAllocator(), EngineCI.DeviceLocalMemoryPageSize, EngineCI.HostVisibleMemoryPageSize, EngineCI.DeviceLocalMemoryReserveSize, EngineCI.HostVisibleMemoryReserveSize), + m_TransientCmdPoolMgr + { + *this, + "Transient command buffer pool manager", + CmdQueues[0]->GetQueueFamilyIndex(), + VK_COMMAND_POOL_CREATE_TRANSIENT_BIT + }, + m_MemoryMgr + { + "Global resource memory manager", + *m_LogicalVkDevice, + *m_PhysicalDevice, + GetRawAllocator(), + EngineCI.DeviceLocalMemoryPageSize, + EngineCI.HostVisibleMemoryPageSize, + EngineCI.DeviceLocalMemoryReserveSize, + EngineCI.HostVisibleMemoryReserveSize + }, m_DynamicMemoryManager { GetRawAllocator(), diff --git a/Graphics/GraphicsEngineVulkan/src/RenderPassCache.cpp b/Graphics/GraphicsEngineVulkan/src/RenderPassCache.cpp index c1b10f41..7bc212c0 100644 --- a/Graphics/GraphicsEngineVulkan/src/RenderPassCache.cpp +++ b/Graphics/GraphicsEngineVulkan/src/RenderPassCache.cpp @@ -41,7 +41,7 @@ RenderPassCache::~RenderPassCache() VkRenderPass RenderPassCache::GetRenderPass(const RenderPassCacheKey& Key) { - std::lock_guard<std::mutex> Lock(m_Mutex); + std::lock_guard<std::mutex> Lock{m_Mutex}; auto it = m_Cache.find(Key); if(it == m_Cache.end()) { diff --git a/Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp index ce1d73d1..534f01ba 100644 --- a/Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/SamplerVkImpl.cpp @@ -31,7 +31,12 @@ namespace Diligent { SamplerVkImpl::SamplerVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImpl* pRenderDeviceVk, const SamplerDesc& SamplerDesc) : - TSamplerBase(pRefCounters, pRenderDeviceVk, SamplerDesc) + TSamplerBase + { + pRefCounters, + pRenderDeviceVk, + SamplerDesc + } { const auto &LogicalDevice = pRenderDeviceVk->GetLogicalDevice(); VkSamplerCreateInfo SamplerCI = {}; diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp index ce3c559b..1d47c00b 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceBindingVkImpl.cpp @@ -31,8 +31,13 @@ namespace Diligent { ShaderResourceBindingVkImpl::ShaderResourceBindingVkImpl(IReferenceCounters* pRefCounters, PipelineStateVkImpl* pPSO, bool IsPSOInternal) : - TBase (pRefCounters, pPSO, IsPSOInternal), - m_ShaderResourceCache(ShaderResourceCacheVk::DbgCacheContentType::SRBResources) + TBase + { + pRefCounters, + pPSO, + IsPSOInternal + }, + m_ShaderResourceCache{ShaderResourceCacheVk::DbgCacheContentType::SRBResources} { auto* ppShaders = pPSO->GetShaders(); m_NumShaders = static_cast<decltype(m_NumShaders)>(pPSO->GetNumShaders()); diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVariableVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVariableVk.cpp index 22582a37..02bdfa93 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderVariableVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderVariableVk.cpp @@ -67,10 +67,10 @@ ShaderVariableManagerVk::ShaderVariableManagerVk(IObject& const SHADER_RESOURCE_VARIABLE_TYPE* AllowedVarTypes, Uint32 NumAllowedTypes, ShaderResourceCacheVk& ResourceCache) : - m_Owner(Owner), - m_ResourceCache(ResourceCache) + m_Owner {Owner }, + m_ResourceCache{ResourceCache} #ifdef _DEBUG - , m_DbgAllocator(Allocator) + , m_DbgAllocator {Allocator} #endif { const Uint32 AllowedTypeBits = GetAllowedTypeBits(AllowedVarTypes, NumAllowedTypes); diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp index a72263eb..75bd3001 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderVkImpl.cpp @@ -40,7 +40,12 @@ namespace Diligent ShaderVkImpl::ShaderVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImpl* pRenderDeviceVk, const ShaderCreateInfo& CreationAttribs) : - TShaderBase(pRefCounters, pRenderDeviceVk, CreationAttribs.Desc) + TShaderBase + { + pRefCounters, + pRenderDeviceVk, + CreationAttribs.Desc + } { if (CreationAttribs.Source != nullptr || CreationAttribs.FilePath != nullptr) { diff --git a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp index 9118cd8c..5f1d5895 100644 --- a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp @@ -37,11 +37,11 @@ SwapChainVkImpl::SwapChainVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImpl* pRenderDeviceVk, DeviceContextVkImpl* pDeviceContextVk, void* pNativeWndHandle) : - TSwapChainBase (pRefCounters, pRenderDeviceVk, pDeviceContextVk, SCDesc), - m_VulkanInstance (pRenderDeviceVk->GetVulkanInstance()), - m_pBackBufferRTV (STD_ALLOCATOR_RAW_MEM(RefCntAutoPtr<ITextureView>, GetRawAllocator(), "Allocator for vector<RefCntAutoPtr<ITextureView>>")), - m_SwapChainImagesInitialized (STD_ALLOCATOR_RAW_MEM(bool, GetRawAllocator(), "Allocator for vector<bool>")), - m_ImageAcquiredFenceSubmitted(STD_ALLOCATOR_RAW_MEM(bool, GetRawAllocator(), "Allocator for vector<bool>")) + TSwapChainBase {pRefCounters, pRenderDeviceVk, pDeviceContextVk, SCDesc}, + m_VulkanInstance {pRenderDeviceVk->GetVulkanInstance()}, + m_pBackBufferRTV {STD_ALLOCATOR_RAW_MEM(RefCntAutoPtr<ITextureView>, GetRawAllocator(), "Allocator for vector<RefCntAutoPtr<ITextureView>>")}, + m_SwapChainImagesInitialized {STD_ALLOCATOR_RAW_MEM(bool, GetRawAllocator(), "Allocator for vector<bool>")}, + m_ImageAcquiredFenceSubmitted{STD_ALLOCATOR_RAW_MEM(bool, GetRawAllocator(), "Allocator for vector<bool>")} { // Create OS-specific surface #if defined(VK_USE_PLATFORM_WIN32_KHR) diff --git a/Graphics/GraphicsEngineVulkan/src/TextureViewVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/TextureViewVkImpl.cpp index 44aa1f61..701c01c9 100644 --- a/Graphics/GraphicsEngineVulkan/src/TextureViewVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/TextureViewVkImpl.cpp @@ -35,8 +35,15 @@ TextureViewVkImpl::TextureViewVkImpl( IReferenceCounters* pRefCo ITexture* pTexture, VulkanUtilities::ImageViewWrapper&& ImgView, bool bIsDefaultView) : - TTextureViewBase( pRefCounters, pDevice, ViewDesc, pTexture, bIsDefaultView ), - m_ImageView (std::move(ImgView)) + TTextureViewBase + { + pRefCounters, + pDevice, + ViewDesc, + pTexture, + bIsDefaultView + }, + m_ImageView{std::move(ImgView)} { } diff --git a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp index 7b133b49..e5fa302d 100644 --- a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp @@ -40,7 +40,13 @@ TextureVkImpl :: TextureVkImpl(IReferenceCounters* pRefCounters, RenderDeviceVkImpl* pRenderDeviceVk, const TextureDesc& TexDesc, const TextureData* pInitData /*= nullptr*/) : - TTextureBase(pRefCounters, TexViewObjAllocator, pRenderDeviceVk, TexDesc) + TTextureBase + { + pRefCounters, + TexViewObjAllocator, + pRenderDeviceVk, + TexDesc + } { if (m_Desc.Usage == USAGE_STATIC && (pInitData == nullptr || pInitData->pSubResources == nullptr)) LOG_ERROR_AND_THROW("Static textures must be initialized with data at creation time: pInitData can't be null"); diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanDynamicHeap.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanDynamicHeap.cpp index 283e34b9..5475f128 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanDynamicHeap.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanDynamicHeap.cpp @@ -41,10 +41,10 @@ VulkanDynamicMemoryManager::VulkanDynamicMemoryManager(IMemoryAllocator& Alloc RenderDeviceVkImpl& DeviceVk, Uint32 Size, Uint64 CommandQueueMask) : - TBase(Allocator, Size), - m_DeviceVk(DeviceVk), - m_DefaultAlignment(GetDefaultAlignment(DeviceVk.GetPhysicalDevice())), - m_CommandQueueMask(CommandQueueMask) + TBase {Allocator, Size}, + m_DeviceVk {DeviceVk}, + m_DefaultAlignment{GetDefaultAlignment(DeviceVk.GetPhysicalDevice())}, + m_CommandQueueMask{CommandQueueMask} { VERIFY( (Size & (MasterBlockAlignment-1)) == 0, "Heap size (", Size, " is not aligned by the master block alignment (", Uint32{MasterBlockAlignment}, ")"); VkBufferCreateInfo VkBuffCI = {}; diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUploadHeap.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUploadHeap.cpp index 1fab8a94..b1858405 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUploadHeap.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUploadHeap.cpp @@ -31,9 +31,9 @@ namespace Diligent VulkanUploadHeap::VulkanUploadHeap(RenderDeviceVkImpl& RenderDevice, std::string HeapName, VkDeviceSize PageSize) : - m_RenderDevice (RenderDevice), - m_HeapName (std::move(HeapName)), - m_PageSize (PageSize) + m_RenderDevice {RenderDevice }, + m_HeapName {std::move(HeapName)}, + m_PageSize {PageSize } { } diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanCommandBufferPool.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanCommandBufferPool.cpp index 0c62268c..df90bd6e 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanCommandBufferPool.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanCommandBufferPool.cpp @@ -33,7 +33,7 @@ namespace VulkanUtilities VulkanCommandBufferPool::VulkanCommandBufferPool(std::shared_ptr<const VulkanLogicalDevice> LogicalDevice, uint32_t queueFamilyIndex, VkCommandPoolCreateFlags flags) : - m_LogicalDevice(std::move(LogicalDevice)) + m_LogicalDevice{std::move(LogicalDevice)} { VkCommandPoolCreateInfo CmdPoolCI = {}; CmdPoolCI.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; @@ -58,7 +58,7 @@ namespace VulkanUtilities VkCommandBuffer CmdBuffer = VK_NULL_HANDLE; { - std::lock_guard<std::mutex> Lock(m_Mutex); + std::lock_guard<std::mutex> Lock{m_Mutex}; if (!m_CmdBuffers.empty()) { @@ -103,7 +103,7 @@ namespace VulkanUtilities void VulkanCommandBufferPool::FreeCommandBuffer(VkCommandBuffer&& CmdBuffer) { - std::lock_guard<std::mutex> Lock(m_Mutex); + std::lock_guard<std::mutex> Lock{m_Mutex}; m_CmdBuffers.emplace_back(CmdBuffer); CmdBuffer = VK_NULL_HANDLE; #ifdef DEVELOPMENT diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanFencePool.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanFencePool.cpp index 5c59f6f1..6d153fd7 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanFencePool.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanFencePool.cpp @@ -29,7 +29,7 @@ namespace VulkanUtilities { VulkanFencePool::VulkanFencePool(std::shared_ptr<const VulkanLogicalDevice> LogicalDevice)noexcept : - m_LogicalDevice(std::move(LogicalDevice)) + m_LogicalDevice{std::move(LogicalDevice)} {} VulkanFencePool::~VulkanFencePool() diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanInstance.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanInstance.cpp index 5a63b5c7..03baf0fa 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanInstance.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanInstance.cpp @@ -58,15 +58,15 @@ namespace VulkanUtilities const char* const* ppGlobalExtensionNames, VkAllocationCallbacks* pVkAllocator) { - auto Instance = new VulkanInstance(EnableValidation, GlobalExtensionCount, ppGlobalExtensionNames, pVkAllocator); - return std::shared_ptr<VulkanInstance>(Instance); + auto Instance = new VulkanInstance{EnableValidation, GlobalExtensionCount, ppGlobalExtensionNames, pVkAllocator}; + return std::shared_ptr<VulkanInstance>{Instance}; } VulkanInstance::VulkanInstance(bool EnableValidation, uint32_t GlobalExtensionCount, const char* const* ppGlobalExtensionNames, VkAllocationCallbacks* pVkAllocator) : - m_pVkAllocator(pVkAllocator) + m_pVkAllocator{pVkAllocator} { { // Enumerate available layers diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanLogicalDevice.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanLogicalDevice.cpp index b585c79f..b2a8b0c9 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanLogicalDevice.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanLogicalDevice.cpp @@ -33,8 +33,8 @@ namespace VulkanUtilities const VkDeviceCreateInfo& DeviceCI, const VkAllocationCallbacks* vkAllocator) { - auto *LogicalDevice = new VulkanLogicalDevice(vkPhysicalDevice, DeviceCI, vkAllocator); - return std::shared_ptr<VulkanLogicalDevice>(LogicalDevice); + auto* LogicalDevice = new VulkanLogicalDevice{vkPhysicalDevice, DeviceCI, vkAllocator}; + return std::shared_ptr<VulkanLogicalDevice>{LogicalDevice}; } VulkanLogicalDevice::~VulkanLogicalDevice() @@ -45,7 +45,7 @@ namespace VulkanUtilities VulkanLogicalDevice::VulkanLogicalDevice(VkPhysicalDevice vkPhysicalDevice, const VkDeviceCreateInfo& DeviceCI, const VkAllocationCallbacks* vkAllocator) : - m_VkAllocator(vkAllocator) + m_VkAllocator{vkAllocator} { auto res = vkCreateDevice(vkPhysicalDevice, &DeviceCI, vkAllocator, &m_VkDevice); CHECK_VK_ERROR_AND_THROW(res, "Failed to create logical device"); diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanMemoryManager.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanMemoryManager.cpp index 72115e4f..ac79e6d0 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanMemoryManager.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanMemoryManager.cpp @@ -40,8 +40,8 @@ VulkanMemoryPage::VulkanMemoryPage(VulkanMemoryManager& ParentMemoryMgr, VkDeviceSize PageSize, uint32_t MemoryTypeIndex, bool IsHostVisible)noexcept : - m_ParentMemoryMgr(ParentMemoryMgr), - m_AllocationMgr(PageSize, ParentMemoryMgr.m_Allocator) + m_ParentMemoryMgr{ParentMemoryMgr}, + m_AllocationMgr {PageSize, ParentMemoryMgr.m_Allocator} { VkMemoryAllocateInfo MemAlloc = {}; MemAlloc.pNext = nullptr; @@ -76,7 +76,7 @@ VulkanMemoryPage::~VulkanMemoryPage() VulkanMemoryAllocation VulkanMemoryPage::Allocate(VkDeviceSize size, VkDeviceSize alignment) { - std::lock_guard<std::mutex> Lock(m_Mutex); + std::lock_guard<std::mutex> Lock{m_Mutex}; auto Allocation = m_AllocationMgr.Allocate(size, alignment); if (Allocation.IsValid()) { @@ -94,7 +94,7 @@ VulkanMemoryAllocation VulkanMemoryPage::Allocate(VkDeviceSize size, VkDeviceSiz void VulkanMemoryPage::Free(VulkanMemoryAllocation&& Allocation) { m_ParentMemoryMgr.OnFreeAllocation(Allocation.Size, m_CPUMemory != nullptr); - std::lock_guard<std::mutex> Lock(m_Mutex); + std::lock_guard<std::mutex> Lock{m_Mutex}; m_AllocationMgr.Free(Allocation.UnalignedOffset, Allocation.Size); Allocation = VulkanMemoryAllocation{}; } @@ -143,7 +143,7 @@ VulkanMemoryAllocation VulkanMemoryManager::Allocate(VkDeviceSize Size, VkDevice // allocations. Staging allocations are short-living and will be released when upload is // complete, while GPU-only allocations are expected to be long-living. MemoryPageIndex PageIdx{MemoryTypeIndex, HostVisible}; - std::lock_guard<std::mutex> Lock(m_PagesMtx); + std::lock_guard<std::mutex> Lock{m_PagesMtx}; auto range = m_Pages.equal_range(PageIdx); for(auto page_it = range.first; page_it != range.second; ++page_it) { @@ -184,7 +184,7 @@ VulkanMemoryAllocation VulkanMemoryManager::Allocate(VkDeviceSize Size, VkDevice void VulkanMemoryManager::ShrinkMemory() { - std::lock_guard<std::mutex> Lock(m_PagesMtx); + std::lock_guard<std::mutex> Lock{m_PagesMtx}; if (m_CurrAllocatedSize[0] <= m_DeviceLocalReserveSize && m_CurrAllocatedSize[1] <= m_HostVisibleReserveSize) return; diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp index 5d7bdf3e..ba2e0dda 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp @@ -30,12 +30,12 @@ namespace VulkanUtilities { std::unique_ptr<VulkanPhysicalDevice> VulkanPhysicalDevice::Create(VkPhysicalDevice vkDevice) { - auto *PhysicalDevice = new VulkanPhysicalDevice(vkDevice); - return std::unique_ptr<VulkanPhysicalDevice>(PhysicalDevice); + auto* PhysicalDevice = new VulkanPhysicalDevice{vkDevice}; + return std::unique_ptr<VulkanPhysicalDevice>{PhysicalDevice}; } VulkanPhysicalDevice::VulkanPhysicalDevice(VkPhysicalDevice vkDevice) : - m_VkDevice(vkDevice) + m_VkDevice{vkDevice} { VERIFY_EXPR(m_VkDevice != VK_NULL_HANDLE); |
