-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgpu.h
More file actions
40 lines (32 loc) · 1.16 KB
/
gpu.h
File metadata and controls
40 lines (32 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef gpu_h
#define gpu_h
#include "vulkan.h"
#define set_debug_name(device, type, object, name) \
gpu_set_debug_name_(device, VK_DEBUG_REPORT_OBJECT_TYPE_##type##_EXT, (uint64_t) object, name)
#define gpu_set_debug_name(...) set_debug_name(__VA_ARGS__)
typedef struct {
VkDeviceMemory memory;
VkDeviceSize offset;
VkDeviceSize length;
} MemoryBlock;
#define MAX_BLOCKS 8
typedef struct {
uint32_t memory_type;
MemoryBlock blocks[MAX_BLOCKS];
uint32_t block_count;
} MemoryHeap;
typedef struct {
VkInstance instance;
VkPhysicalDevice physical_device;
uint32_t queue_family;
VkDevice device;
VkQueue queue;
MemoryHeap device_local_heap;
MemoryHeap host_visible_heap;
} GPU;
GPU gpu_create();
void gpu_destroy(GPU* gpu);
void gpu_set_debug_name_(const GPU* gpu, VkDebugReportObjectTypeEXT type, uint64_t object, const char* name);
MemoryBlock gpu_allocate_memory(GPU* gpu, MemoryHeap* heap, const VkMemoryRequirements* requirements);
VkRenderPass gpu_create_render_pass(GPU* gpu);
#endif