Polyphase Game Engine
Loading...
Searching...
No Matches
Buffer.h
Go to the documentation of this file.
1#pragma once
2
3#if API_VULKAN
4
6
7#include <vulkan/vulkan.h>
8
9class DestroyQueue;
10
11enum class BufferType
12{
13 Vertex,
14 Index,
15 Uniform,
16 Transfer,
17 Storage,
18
19 Count
20};
21
22class Buffer
23{
24public:
25
26 Buffer(
27 BufferType type,
28 size_t size,
29 const char* debugObjectName,
30 const void* srcData = nullptr,
31 bool hostVisible = true);
32
33 void Update(const void* srcData, size_t srcSize, size_t dstOffset = 0);
34
35 void* Map();
36 void Unmap();
37
38 VkBuffer Get();
39 size_t GetSize() const;
40 BufferType GetType() const;
41
42 void* GetMappedPointer();
43
44private:
45
46 friend class DestroyQueue;
47 ~Buffer();
48
49 VkBuffer mBuffer = VK_NULL_HANDLE;
50 VramAllocation mMemory;
51 BufferType mType = BufferType::Count;
52 size_t mSize = 0;
53 void* mMappedPointer = nullptr;
54 bool mHostVisible = false;
55};
56
57#endif
bool Update()
Definition Engine.cpp:710
Definition Vertex.h:20