#include <MemoryVk.h>
Definition at line 46 of file MemoryVk.h.
◆ mapcbTy
◆ tb_umapBA
◆ MemoryVk()
vkmm::MemoryVk::MemoryVk |
( |
| ) |
|
|
inline |
Definition at line 60 of file MemoryVk.h.
60 {
61 InitializeSRWLock(&
slim);
62 };
◆ ~MemoryVk()
vkmm::MemoryVk::~MemoryVk |
( |
| ) |
|
|
inline |
◆ createBuffer()
template<typename T = mapcbTy>
void vkmm::MemoryVk::createBuffer |
( |
const char * |
name, |
|
|
VkDeviceSize |
size, |
|
|
VkBufferUsageFlags |
bflags, |
|
|
MemoryUsage |
mflag, |
|
|
T |
cb |
|
) |
| |
|
inline |
BufferInfo.usage = VK_BUFFER_USAGE_STORAGE_BUFFER_BIT;
| vkmm::ALLOCATION_CREATE_MAPPED_BIT;
Definition at line 86 of file MemoryVk.h.
89 {
90
91
92 BufferAllocation balloc = {};
93
94 VkBufferCreateInfo BufferInfo = {};
95 BufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
96 BufferInfo.size = size;
98 BufferInfo.usage = bflags;
99
103 ainfo.
pool = VK_NULL_HANDLE;
107
108 strcpy(ainfo.
name, name);
109 assert(
bamp.count(name) == 0);
110
111 vkmm::CreateBuffer($pallocator, &BufferInfo, ainfo, &balloc.buffer, &balloc.alloc, NULL);
112
113 cb(balloc);
115
116 };
@ ALLOCATION_CREATE_DEDICATED_MEMORY_BIT
VkResult CreateBuffer(Allocator allocator, const VkBufferCreateInfo *pBufferCreateInfo, AllocationCreateInfo &pAllocationCreateInfo, VkBuffer *pBuffer, Allocation *pAllocation, AllocationInfo *pAllocationInfo)
VkMemoryPropertyFlags requiredFlags
VkMemoryPropertyFlags preferredFlags
AllocationCreateFlags flags
Use #VmaAllocationCreateFlagBits enum.
◆ deinitialize()
void vkmm::MemoryVk::deinitialize |
( |
| ) |
|
|
inline |
Definition at line 156 of file MemoryVk.h.
156 {
157
158
159 printf(
" leaking memory %zu ",
bamp.size());
160 std::for_each(
bamp.begin(),
bamp.end(), [&](
auto& p)
161 {
162
163 auto ba = p.second;
164 printf(" leaking memory be released. NAME [ %s] SIZE %zu \n ",(const char*)(p.first.c_str()), ba.alloc->GetSize()) ;
165 vkmm::UnmapMemory($pallocator, ba.alloc);
166 vkmm::DestroyBuffer($pallocator, ba.buffer, ba.alloc);
167
168 });
169
172 };
◆ deleteBuffer()
void vkmm::MemoryVk::deleteBuffer |
( |
std::string |
name | ) |
|
|
inline |
Definition at line 119 of file MemoryVk.h.
119 {
120
121 if (
bamp.count(name) > 0) {
122
123 auto ba =
bamp[name];
124 AcquireSRWLockExclusive(&
slim);
125 bamp.unsafe_erase(name);
126 ReleaseSRWLockExclusive(&
slim);
127
130
131
132 }
133 }
void DestroyBuffer(Allocator allocator, VkBuffer buffer, Allocation allocation)
void UnmapMemory(Allocator allocator, Allocation allocation)
◆ destroy()
template<class T >
void vkmm::MemoryVk::destroy |
( |
T * |
ptr | ) |
|
|
inline |
Definition at line 66 of file MemoryVk.h.
66 {
67
68
69 if (ptr != nullptr)
70 {
71 ptr->~T();
74 {
76 }
77 else
78 {
79 _aligned_free(ptr);
80 }
81 }
82
83 };
const VkAllocationCallbacks * pAllocationCallbacks
Custom CPU memory allocation callbacks. Optional.
vkmm::AllocatorCreateInfo allocInfo
◆ initialize()
void vkmm::MemoryVk::initialize |
( |
| ) |
|
|
inline |
Definition at line 136 of file MemoryVk.h.
136 {
137
138 $Policy_AllocateMemory.pUserData = &$Temperance;
139 $Policy_AllocateMemory.pfnAllocation = &VK_TB_AllocationFunction;
140 $Policy_AllocateMemory.pfnReallocation = &VK_ReallocationFunction;
141 $Policy_AllocateMemory.pfnFree = &VK_TB_FreeFunction;
142
143 $Policy_AllocateMemory.pfnInternalAllocation = nullptr;
144 $Policy_AllocateMemory.pfnInternalFree = nullptr;
145
146
153
154
155 }
AllocatorCreateFlags flags
Flags for created allocator. Use #VmaAllocatorCreateFlagBits enum.
const VkDeviceSize * pHeapSizeLimit
VkDeviceSize preferredLargeHeapBlockSize
◆ allocInfo
◆ bamp
◆ slim
SRWLOCK vkmm::MemoryVk::slim |
The documentation for this struct was generated from the following file: