Skip to content

Commit ae8f903

Browse files
VulkanUtilities: a bit more object renaming
VulkanMemoryAllocation -> MemoryAllocation VulkanMemoryPage -> MemoryPage VulkanRecycledSemaphore -> RecycledSemaphore VulkanRecycledFence -> RecycledFence
1 parent cbcd163 commit ae8f903

19 files changed

+99
-99
lines changed

Graphics/GraphicsEngineVulkan/include/BottomLevelASVkImpl.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ class BottomLevelASVkImpl final : public BottomLevelASBase<EngineVkImplTraits>
6565
IMPLEMENT_QUERY_INTERFACE_IN_PLACE(IID_BottomLevelASVk, TBottomLevelASBase)
6666

6767
private:
68-
VkDeviceAddress m_DeviceAddress = 0;
69-
VulkanUtilities::AccelStructWrapper m_VulkanBLAS;
70-
VulkanUtilities::BufferWrapper m_VulkanBuffer;
71-
VulkanUtilities::VulkanMemoryAllocation m_MemoryAllocation;
72-
VkDeviceSize m_MemoryAlignedOffset = 0;
68+
VkDeviceAddress m_DeviceAddress = 0;
69+
VulkanUtilities::AccelStructWrapper m_VulkanBLAS;
70+
VulkanUtilities::BufferWrapper m_VulkanBuffer;
71+
VulkanUtilities::MemoryAllocation m_MemoryAllocation;
72+
VkDeviceSize m_MemoryAlignedOffset = 0;
7373
};
7474

7575
} // namespace Diligent

Graphics/GraphicsEngineVulkan/include/BufferVkImpl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ class BufferVkImpl final : public BufferBase<EngineVkImplTraits>
111111
Uint32 m_DynamicOffsetAlignment = 0;
112112
VkDeviceSize m_BufferMemoryAlignedOffset = 0;
113113

114-
VulkanUtilities::BufferWrapper m_VulkanBuffer;
115-
VulkanUtilities::VulkanMemoryAllocation m_MemoryAllocation;
114+
VulkanUtilities::BufferWrapper m_VulkanBuffer;
115+
VulkanUtilities::MemoryAllocation m_MemoryAllocation;
116116
};
117117

118118
} // namespace Diligent

Graphics/GraphicsEngineVulkan/include/CommandQueueVkImpl.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,15 @@ class SyncPointVk final : public std::enable_shared_from_this<SyncPointVk>
6060

6161
static constexpr size_t SizeOf(Uint32 NumContexts)
6262
{
63-
return sizeof(SyncPointVk) + sizeof(VulkanUtilities::VulkanRecycledSemaphore) * (NumContexts - _countof(SyncPointVk::m_Semaphores));
63+
return sizeof(SyncPointVk) + sizeof(VulkanUtilities::RecycledSemaphore) * (NumContexts - _countof(SyncPointVk::m_Semaphores));
6464
}
6565

6666
public:
6767
~SyncPointVk();
6868

6969
// Returns semaphore which is in signaled state.
7070
// Access to semaphore in CommandQueueId index must be thread safe.
71-
VulkanUtilities::VulkanRecycledSemaphore ExtractSemaphore(Uint32 CommandQueueId)
71+
VulkanUtilities::RecycledSemaphore ExtractSemaphore(Uint32 CommandQueueId)
7272
{
7373
return std::move(m_Semaphores[CommandQueueId]);
7474
}
@@ -86,10 +86,10 @@ class SyncPointVk final : public std::enable_shared_from_this<SyncPointVk>
8686
}
8787

8888
private:
89-
const SoftwareQueueIndex m_CommandQueueId;
90-
const Uint8 m_NumSemaphores; // same as NumContexts
91-
VulkanUtilities::VulkanRecycledFence m_Fence;
92-
VulkanUtilities::VulkanRecycledSemaphore m_Semaphores[1]; // [m_NumSemaphores]
89+
const SoftwareQueueIndex m_CommandQueueId;
90+
const Uint8 m_NumSemaphores; // same as NumContexts
91+
VulkanUtilities::RecycledFence m_Fence;
92+
VulkanUtilities::RecycledSemaphore m_Semaphores[1]; // [m_NumSemaphores]
9393
};
9494

9595

Graphics/GraphicsEngineVulkan/include/DeviceContextVkImpl.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,9 @@ class DeviceContextVkImpl final : public DeviceContextNextGenBase<EngineVkImplTr
582582
FixedBlockMemoryAllocator m_CmdListAllocator;
583583

584584
// Semaphores are not owned by the command context
585-
std::vector<RefCntAutoPtr<ManagedSemaphore>> m_WaitManagedSemaphores;
586-
std::vector<RefCntAutoPtr<ManagedSemaphore>> m_SignalManagedSemaphores;
587-
std::vector<VulkanUtilities::VulkanRecycledSemaphore> m_WaitRecycledSemaphores;
585+
std::vector<RefCntAutoPtr<ManagedSemaphore>> m_WaitManagedSemaphores;
586+
std::vector<RefCntAutoPtr<ManagedSemaphore>> m_SignalManagedSemaphores;
587+
std::vector<VulkanUtilities::RecycledSemaphore> m_WaitRecycledSemaphores;
588588

589589
std::vector<VkSemaphore> m_VkWaitSemaphores;
590590
std::vector<VkSemaphore> m_VkSignalSemaphores;

Graphics/GraphicsEngineVulkan/include/FenceVkImpl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class FenceVkImpl final : public FenceBase<EngineVkImplTraits>
7373
/// Implementation of IFenceVk::GetVkSemaphore().
7474
virtual VkSemaphore DILIGENT_CALL_TYPE GetVkSemaphore() override final { return m_TimelineSemaphore; }
7575

76-
VulkanUtilities::VulkanRecycledSemaphore ExtractSignalSemaphore(SoftwareQueueIndex CommandQueueId, Uint64 Value);
76+
VulkanUtilities::RecycledSemaphore ExtractSignalSemaphore(SoftwareQueueIndex CommandQueueId, Uint64 Value);
7777

7878
void Reset(Uint64 Value);
7979

Graphics/GraphicsEngineVulkan/include/RenderDeviceVkImpl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,11 @@ class RenderDeviceVkImpl final : public RenderDeviceNextGenBase<RenderDeviceBase
242242
FramebufferCache* GetFramebufferCache() { return m_FramebufferCache.get(); }
243243
RenderPassCache* GetImplicitRenderPassCache() { return m_ImplicitRenderPassCache.get(); }
244244

245-
VulkanUtilities::VulkanMemoryAllocation AllocateMemory(const VkMemoryRequirements& MemReqs, VkMemoryPropertyFlags MemoryProperties, VkMemoryAllocateFlags AllocateFlags = 0)
245+
VulkanUtilities::MemoryAllocation AllocateMemory(const VkMemoryRequirements& MemReqs, VkMemoryPropertyFlags MemoryProperties, VkMemoryAllocateFlags AllocateFlags = 0)
246246
{
247247
return m_MemoryMgr.Allocate(MemReqs, MemoryProperties, AllocateFlags);
248248
}
249-
VulkanUtilities::VulkanMemoryAllocation AllocateMemory(VkDeviceSize Size, VkDeviceSize Alignment, uint32_t MemoryTypeIndex, VkMemoryAllocateFlags AllocateFlags = 0)
249+
VulkanUtilities::MemoryAllocation AllocateMemory(VkDeviceSize Size, VkDeviceSize Alignment, uint32_t MemoryTypeIndex, VkMemoryAllocateFlags AllocateFlags = 0)
250250
{
251251
const auto& MemoryProps = m_PhysicalDevice->GetMemoryProperties();
252252
VERIFY_EXPR(MemoryTypeIndex < MemoryProps.memoryTypeCount);

Graphics/GraphicsEngineVulkan/include/TextureVkImpl.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ class TextureVkImpl final : public TextureBase<EngineVkImplTraits>
115115

116116
void InitSparseProperties() noexcept(false);
117117

118-
VulkanUtilities::ImageWrapper m_VulkanImage;
119-
VulkanUtilities::BufferWrapper m_StagingBuffer;
120-
VulkanUtilities::VulkanMemoryAllocation m_MemoryAllocation;
121-
VkDeviceSize m_StagingDataAlignedOffset = 0;
118+
VulkanUtilities::ImageWrapper m_VulkanImage;
119+
VulkanUtilities::BufferWrapper m_StagingBuffer;
120+
VulkanUtilities::MemoryAllocation m_MemoryAllocation;
121+
VkDeviceSize m_StagingDataAlignedOffset = 0;
122122
};
123123

124124
} // namespace Diligent

Graphics/GraphicsEngineVulkan/include/TopLevelASVkImpl.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ class TopLevelASVkImpl final : public TopLevelASBase<EngineVkImplTraits>
6767
const VkAccelerationStructureKHR* GetVkTLASPtr() const { return &m_VulkanTLAS; }
6868

6969
private:
70-
VkDeviceAddress m_DeviceAddress = 0;
71-
VulkanUtilities::AccelStructWrapper m_VulkanTLAS;
72-
VulkanUtilities::BufferWrapper m_VulkanBuffer;
73-
VulkanUtilities::VulkanMemoryAllocation m_MemoryAllocation;
74-
VkDeviceSize m_MemoryAlignedOffset = 0;
70+
VkDeviceAddress m_DeviceAddress = 0;
71+
VulkanUtilities::AccelStructWrapper m_VulkanTLAS;
72+
VulkanUtilities::BufferWrapper m_VulkanBuffer;
73+
VulkanUtilities::MemoryAllocation m_MemoryAllocation;
74+
VkDeviceSize m_MemoryAlignedOffset = 0;
7575
};
7676

7777
} // namespace Diligent

Graphics/GraphicsEngineVulkan/include/VulkanUploadHeap.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class VulkanUploadHeap
120120
struct UploadPageInfo
121121
{
122122
// clang-format off
123-
UploadPageInfo(VulkanUtilities::VulkanMemoryAllocation&& _MemAllocation,
123+
UploadPageInfo(VulkanUtilities::MemoryAllocation&& _MemAllocation,
124124
VulkanUtilities::BufferWrapper&& _Buffer,
125125
Uint8* _CPUAddress) :
126126
MemAllocation{std::move(_MemAllocation)},
@@ -130,9 +130,9 @@ class VulkanUploadHeap
130130
}
131131
// clang-format on
132132

133-
VulkanUtilities::VulkanMemoryAllocation MemAllocation;
134-
VulkanUtilities::BufferWrapper Buffer;
135-
Uint8* const CPUAddress = nullptr;
133+
VulkanUtilities::MemoryAllocation MemAllocation;
134+
VulkanUtilities::BufferWrapper Buffer;
135+
Uint8* const CPUAddress = nullptr;
136136
};
137137
std::vector<UploadPageInfo> m_Pages;
138138

Graphics/GraphicsEngineVulkan/include/VulkanUtilities/MemoryManager.hpp

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,24 @@
4242
namespace VulkanUtilities
4343
{
4444

45-
class VulkanMemoryPage;
45+
class MemoryPage;
4646
class MemoryManager;
4747

48-
struct VulkanMemoryAllocation
48+
struct MemoryAllocation
4949
{
50-
VulkanMemoryAllocation() noexcept {}
50+
MemoryAllocation() noexcept {}
5151

5252
// clang-format off
53-
VulkanMemoryAllocation (const VulkanMemoryAllocation&) = delete;
54-
VulkanMemoryAllocation& operator= (const VulkanMemoryAllocation&) = delete;
53+
MemoryAllocation (const MemoryAllocation&) = delete;
54+
MemoryAllocation& operator= (const MemoryAllocation&) = delete;
5555

56-
VulkanMemoryAllocation(VulkanMemoryPage* _Page, VkDeviceSize _UnalignedOffset, VkDeviceSize _Size)noexcept :
56+
MemoryAllocation(MemoryPage* _Page, VkDeviceSize _UnalignedOffset, VkDeviceSize _Size)noexcept :
5757
Page {_Page },
5858
UnalignedOffset{_UnalignedOffset},
5959
Size {_Size }
6060
{}
6161

62-
VulkanMemoryAllocation(VulkanMemoryAllocation&& rhs)noexcept :
62+
MemoryAllocation(MemoryAllocation&& rhs)noexcept :
6363
Page {rhs.Page },
6464
UnalignedOffset{rhs.UnalignedOffset},
6565
Size {rhs.Size }
@@ -69,7 +69,7 @@ struct VulkanMemoryAllocation
6969
rhs.Size = 0;
7070
}
7171

72-
VulkanMemoryAllocation& operator= (VulkanMemoryAllocation&& rhs)noexcept
72+
MemoryAllocation& operator= (MemoryAllocation&& rhs)noexcept
7373
{
7474
Page = rhs.Page;
7575
UnalignedOffset = rhs.UnalignedOffset;
@@ -94,25 +94,25 @@ struct VulkanMemoryAllocation
9494

9595
// Destructor immediately returns the allocation to the parent page.
9696
// The allocation must not be in use by the GPU.
97-
~VulkanMemoryAllocation();
97+
~MemoryAllocation();
9898

99-
VulkanMemoryPage* Page = nullptr; // Memory page that contains this allocation
100-
VkDeviceSize UnalignedOffset = 0; // Unaligned offset from the start of the memory
101-
VkDeviceSize Size = 0; // Reserved size of this allocation
99+
MemoryPage* Page = nullptr; // Memory page that contains this allocation
100+
VkDeviceSize UnalignedOffset = 0; // Unaligned offset from the start of the memory
101+
VkDeviceSize Size = 0; // Reserved size of this allocation
102102
};
103103

104-
class VulkanMemoryPage
104+
class MemoryPage
105105
{
106106
public:
107-
VulkanMemoryPage(MemoryManager& ParentMemoryMgr,
108-
VkDeviceSize PageSize,
109-
uint32_t MemoryTypeIndex,
110-
bool IsHostVisible,
111-
VkMemoryAllocateFlags AllocateFlags);
112-
~VulkanMemoryPage();
107+
MemoryPage(MemoryManager& ParentMemoryMgr,
108+
VkDeviceSize PageSize,
109+
uint32_t MemoryTypeIndex,
110+
bool IsHostVisible,
111+
VkMemoryAllocateFlags AllocateFlags);
112+
~MemoryPage();
113113

114114
// clang-format off
115-
VulkanMemoryPage(VulkanMemoryPage&& rhs)noexcept :
115+
MemoryPage(MemoryPage&& rhs)noexcept :
116116
m_ParentMemoryMgr {rhs.m_ParentMemoryMgr },
117117
m_AllocationMgr {std::move(rhs.m_AllocationMgr)},
118118
m_VkMemory {std::move(rhs.m_VkMemory) },
@@ -121,9 +121,9 @@ class VulkanMemoryPage
121121
rhs.m_CPUMemory = nullptr;
122122
}
123123

124-
VulkanMemoryPage (const VulkanMemoryPage&) = delete;
125-
VulkanMemoryPage& operator= (VulkanMemoryPage&) = delete;
126-
VulkanMemoryPage& operator= (VulkanMemoryPage&& rhs) = delete;
124+
MemoryPage (const MemoryPage&) = delete;
125+
MemoryPage& operator= (MemoryPage&) = delete;
126+
MemoryPage& operator= (MemoryPage&& rhs) = delete;
127127

128128
bool IsEmpty() const { return m_AllocationMgr.IsEmpty(); }
129129
bool IsFull() const { return m_AllocationMgr.IsFull(); }
@@ -132,18 +132,18 @@ class VulkanMemoryPage
132132

133133
// clang-format on
134134

135-
VulkanMemoryAllocation Allocate(VkDeviceSize size, VkDeviceSize alignment);
135+
MemoryAllocation Allocate(VkDeviceSize size, VkDeviceSize alignment);
136136

137137
VkDeviceMemory GetVkMemory() const { return m_VkMemory; }
138138
void* GetCPUMemory() const { return m_CPUMemory; }
139139

140140
private:
141141
using AllocationsMgrOffsetType = Diligent::VariableSizeAllocationsManager::OffsetType;
142142

143-
friend struct VulkanMemoryAllocation;
143+
friend struct MemoryAllocation;
144144

145145
// Memory is reclaimed immediately. The application is responsible to ensure it is not in use by the GPU
146-
void Free(VulkanMemoryAllocation&& Allocation);
146+
void Free(MemoryAllocation&& Allocation);
147147

148148
MemoryManager& m_ParentMemoryMgr;
149149
std::mutex m_Mutex;
@@ -208,15 +208,15 @@ class MemoryManager
208208
MemoryManager& operator= (MemoryManager&&) = delete;
209209
// clang-format on
210210

211-
VulkanMemoryAllocation Allocate(VkDeviceSize Size, VkDeviceSize Alignment, uint32_t MemoryTypeIndex, bool HostVisible, VkMemoryAllocateFlags AllocateFlags);
212-
VulkanMemoryAllocation Allocate(const VkMemoryRequirements& MemReqs, VkMemoryPropertyFlags MemoryProps, VkMemoryAllocateFlags AllocateFlags);
213-
void ShrinkMemory();
211+
MemoryAllocation Allocate(VkDeviceSize Size, VkDeviceSize Alignment, uint32_t MemoryTypeIndex, bool HostVisible, VkMemoryAllocateFlags AllocateFlags);
212+
MemoryAllocation Allocate(const VkMemoryRequirements& MemReqs, VkMemoryPropertyFlags MemoryProps, VkMemoryAllocateFlags AllocateFlags);
213+
void ShrinkMemory();
214214

215215
protected:
216-
friend class VulkanMemoryPage;
216+
friend class MemoryPage;
217217

218-
virtual void OnNewPageCreated(VulkanMemoryPage& NewPage) {}
219-
virtual void OnPageDestroy(VulkanMemoryPage& Page) {}
218+
virtual void OnNewPageCreated(MemoryPage& NewPage) {}
219+
virtual void OnPageDestroy(MemoryPage& Page) {}
220220

221221
std::string m_MgrName;
222222

@@ -257,7 +257,7 @@ class MemoryManager
257257
}
258258
};
259259
};
260-
std::unordered_multimap<MemoryPageIndex, VulkanMemoryPage, MemoryPageIndex::Hasher> m_Pages;
260+
std::unordered_multimap<MemoryPageIndex, MemoryPage, MemoryPageIndex::Hasher> m_Pages;
261261

262262
const VkDeviceSize m_DeviceLocalPageSize;
263263
const VkDeviceSize m_HostVisiblePageSize;

0 commit comments

Comments
 (0)