VOX
A little voxel engine
Loading...
Searching...
No Matches
Buffer.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "vk_define.hpp"
5
6#include <vulkan/vulkan.h>
7
8#include <stdexcept>
9
10class Buffer
11{
12
13public:
14
16 {
17 VkDeviceSize size;
18 VkBufferUsageFlags usage;
19 VkMemoryPropertyFlags memory_properties;
20 };
21
22 Buffer();
23 Buffer(
24 VkDevice device,
25 VkPhysicalDevice physical_device,
26 const CreateInfo & create_info
27 );
28 ~Buffer();
29
30 Buffer(const Buffer &) = delete;
31 Buffer(Buffer && other) noexcept;
32 Buffer & operator=(const Buffer &) = delete;
33 Buffer & operator=(Buffer && other) noexcept;
34
35 void clear();
36
37 VkDeviceSize size() const { return m_size; }
38
39 void * mappedMemory();
40
41 VkBuffer buffer;
42 VkDeviceMemory memory;
43
44private:
45
46 VkDevice m_device;
47
48 VkDeviceSize m_size;
49
50 void * m_mapped_memory;
51};
Definition: Buffer.hpp:11
VkBuffer buffer
Definition: Buffer.hpp:41
VkDeviceSize size() const
Definition: Buffer.hpp:37
VkDeviceMemory memory
Definition: Buffer.hpp:42
Buffer & operator=(const Buffer &)=delete
Buffer(const Buffer &)=delete
void * mappedMemory()
Definition: Buffer.cpp:127
~Buffer()
Definition: Buffer.cpp:68
Buffer()
Definition: Buffer.cpp:5
void clear()
Definition: Buffer.cpp:109
Definition: Buffer.hpp:16
VkDeviceSize size
Definition: Buffer.hpp:17
VkMemoryPropertyFlags memory_properties
Definition: Buffer.hpp:19
VkBufferUsageFlags usage
Definition: Buffer.hpp:18