blob: 8c6b7726ae79cb5021f8f108819e6903dec0a0f8 (
plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#pragma once
#include <vulkan/vk_platform.h>
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_core.h>
#include "defines.h"
#include "ral.h"
// #include "vulkan_helpers.h"
#define GPU_SWAPCHAIN_IMG_COUNT 2
/*
Conventions:
- Place the 'handle' as the first field of a struct
- Vulkan specific data goes at the top, followed by our internal data
*/
typedef struct queue_family_indices {
u32 graphics_family_index;
u32 present_family_index;
u32 compute_family_index;
u32 transfer_family_index;
bool has_graphics;
bool has_present;
bool has_compute;
bool has_transfer;
} queue_family_indices;
typedef struct gpu_swapchain {
VkSwapchainKHR handle;
} gpu_swapchain;
typedef struct gpu_device {
// In Vulkan we store both physical and logical device here
VkPhysicalDevice physical_device;
VkDevice logical_device;
VkPhysicalDeviceProperties properties;
VkPhysicalDeviceFeatures features;
VkPhysicalDeviceMemoryProperties memory;
queue_family_indices queue_family_indicies;
VkQueue graphics_queue;
VkQueue present_queue;
VkQueue compute_queue;
VkQueue transfer_queue;
VkCommandPool pool;
} gpu_device;
typedef struct gpu_pipeline_layout {
VkPipelineLayout handle;
} gpu_pipeline_layout;
typedef struct gpu_pipeline {
VkPipeline handle;
VkPipelineLayout layout_handle;
} gpu_pipeline;
typedef struct gpu_renderpass {
VkRenderPass handle;
VkFramebuffer framebuffers[GPU_SWAPCHAIN_IMG_COUNT];
} gpu_renderpass;
typedef struct gpu_cmd_encoder {
VkCommandBuffer cmd_buffer;
} gpu_cmd_encoder;
|