summaryrefslogtreecommitdiff
path: root/src/renderer/backends/backend_vulkan.h
blob: dfe6a0f9d2150b2802f9fe34b64c70e7c35b858f (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
#pragma once
#include <vulkan/vk_platform.h>
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_core.h>

#include "defines.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 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;
  VkCommandPool pool;
} gpu_device;
typedef struct gpu_pipeline {
} gpu_pipeline;

typedef struct gpu_renderpass {
  VkRenderPass vk_handle;
  VkFramebuffer framebuffers[GPU_SWAPCHAIN_IMG_COUNT];
} gpu_renderpass;

typedef struct gpu_cmd_encoder {
  VkCommandBuffer cmd_buffer;
} gpu_cmd_encoder;