Changeset 90880fb in opengl-game for vulkan-buffer.hpp
- Timestamp:
- Jun 17, 2021, 11:59:14 PM (3 years ago)
- Branches:
- feature/imgui-sdl
- Children:
- 2f4ff8c
- Parents:
- 5ea0a37
- git-author:
- Dmitry Portnoy <dportnoy@…> (06/13/21 23:57:17)
- git-committer:
- Dmitry Portnoy <dportnoy@…> (06/17/21 23:59:14)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-buffer.hpp
r5ea0a37 r90880fb 37 37 T& get(uint32_t index); 38 38 void add(T obj); 39 40 void* mapped(size_t idx); 41 42 void map(vector<VkDeviceMemory>& deviceMemory, VkDevice device); 43 void unmap(vector<VkDeviceMemory>& deviceMemory, VkDevice device); 39 44 40 45 void resize(); … … 182 187 183 188 template<class T> 189 void* VulkanBuffer<T>::mapped(size_t idx) { 190 return mappedData[idx]; 191 } 192 193 template<class T> 194 void VulkanBuffer<T>::map(vector<VkDeviceMemory>& deviceMemory, VkDevice device) { 195 // TODO: Make sure that mappedData initally has size 0. If not, it means the memory is already mapped 196 // and I should return some kind of error or warning 197 mappedData.resize(deviceMemory.size()); 198 199 for (size_t i = 0; i < deviceMemory.size(); i++) { 200 vkMapMemory(device, deviceMemory[i], 0, memorySize(), 0, &mappedData[i]); 201 } 202 } 203 204 template<class T> 205 void VulkanBuffer<T>::unmap(vector<VkDeviceMemory>& deviceMemory, VkDevice device) { 206 for (size_t i = 0; i < deviceMemory.size(); i++) { 207 vkUnmapMemory(device, deviceMemory[i]); 208 } 209 210 mappedData.clear(); 211 } 212 213 template<class T> 184 214 void VulkanBuffer<T>::resize() { 185 215 resized = false;
Note:
See TracChangeset
for help on using the changeset viewer.