Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
VulkanBuffer.hpp
Go to the documentation of this file.
1 #pragma once
3 #ifdef USING_VULKAN
4 
5 #include <ThirdParty/Vulkan/Include/vulkan/vulkan.h>
6 
9 
10 namespace Engine {
11 
12  class VulkanBuffer
13  {
14  public:
15  VulkanBuffer(VulkanLogicalDevice* device, VmaAllocator allocator, uint32_t size, VkBufferUsageFlags usage, bool gpu, VkCommandPool pool);
16  VulkanBuffer(VulkanLogicalDevice* device, VmaAllocator allocator, uint32_t size, VkBufferUsageFlags usage, VmaMemoryUsage memoryType, VkCommandPool pool);
17  ~VulkanBuffer();
18 
19  void CreateBufferView(uint32_t range, uint32_t offset, VkFormat format);
20 
21  VkBuffer GetBuffer() const;
22 
23  VkBufferView GetBufferView() const;
24 
25  VmaAllocationInfo getAllocationInfo();
26 
27  void UpdateBuffer(void* data, uint32_t offset, uint32_t size);
28 
29  void MapBuffer(void* location);
30 
31  void UnmapBuffer();
32 
33  void ClearBuffer() const;
34 
35  protected:
36  VmaAllocator allocator;
37  VmaAllocation allocation;
38  VmaAllocationInfo allocationInfo;
39 
40  VkBuffer buffer;
41 
42  VkBufferView view;
43 
44  VkBufferUsageFlags usage;
45 
46  uint32_t size;
47 
48  VulkanLogicalDevice* device;
49 
50  VkCommandPool pool;
51 
52  bool gpu;
53 
54 
55  };
56 
57 }
58 
59 #endif // USING_VULKAN