2019-07-08 16:00:47 +00:00
|
|
|
#ifndef __vid_vulkan_h
|
|
|
|
#define __vid_vulkan_h
|
|
|
|
|
|
|
|
#ifndef VK_NO_PROTOTYPES
|
|
|
|
#define VK_NO_PROTOTYPES
|
|
|
|
#endif
|
|
|
|
#include <vulkan/vulkan.h>
|
|
|
|
|
2020-02-18 08:18:37 +00:00
|
|
|
#include "QF/darray.h"
|
2020-02-16 13:45:27 +00:00
|
|
|
|
2020-02-18 05:28:28 +00:00
|
|
|
typedef struct vulkan_renderpass_s {
|
2020-02-18 08:18:37 +00:00
|
|
|
VkRenderPass renderpass;
|
2020-02-18 05:28:28 +00:00
|
|
|
struct qfv_imageresource_s *colorImage;
|
|
|
|
struct qfv_imageresource_s *depthImage;
|
|
|
|
} vulkan_renderpass_t;
|
|
|
|
|
2020-02-18 08:18:37 +00:00
|
|
|
typedef struct vulkan_framebuffer_s {
|
|
|
|
VkFramebuffer framebuffer;
|
|
|
|
VkFence fence;
|
|
|
|
VkSemaphore imageAvailableSemaphore;
|
|
|
|
VkSemaphore renderDoneSemaphore;
|
|
|
|
VkCommandBuffer cmdBuffer;
|
|
|
|
} vulkan_framebuffer_t;
|
|
|
|
|
|
|
|
typedef struct vulkan_framebufferset_s
|
|
|
|
DARRAY_TYPE (vulkan_framebuffer_t) vulkan_framebufferset_t;
|
|
|
|
|
2019-07-08 16:00:47 +00:00
|
|
|
typedef struct vulkan_ctx_s {
|
|
|
|
void (*load_vulkan) (struct vulkan_ctx_s *ctx);
|
|
|
|
void (*unload_vulkan) (struct vulkan_ctx_s *ctx);
|
|
|
|
|
2019-07-09 02:54:23 +00:00
|
|
|
const char **required_extensions;
|
2019-07-08 16:00:47 +00:00
|
|
|
struct vulkan_presentation_s *presentation;
|
|
|
|
int (*get_presentation_support) (struct vulkan_ctx_s *ctx,
|
|
|
|
VkPhysicalDevice physicalDevice,
|
|
|
|
uint32_t queueFamilyIndex);
|
2019-07-09 07:33:44 +00:00
|
|
|
void (*choose_visual) (struct vulkan_ctx_s *ctx);
|
|
|
|
void (*create_window) (struct vulkan_ctx_s *ctx);
|
2019-07-08 16:00:47 +00:00
|
|
|
VkSurfaceKHR (*create_surface) (struct vulkan_ctx_s *ctx);
|
2019-07-09 02:54:23 +00:00
|
|
|
|
2019-07-12 04:15:25 +00:00
|
|
|
struct qfv_instance_s *instance;
|
|
|
|
struct qfv_device_s *device;
|
|
|
|
struct qfv_swapchain_s *swapchain;
|
|
|
|
VkSurfaceKHR surface; //FIXME surface = window, so "contains" swapchain
|
2020-02-16 13:45:27 +00:00
|
|
|
|
2020-02-17 11:29:35 +00:00
|
|
|
VkCommandPool cmdpool;
|
2020-02-18 05:28:28 +00:00
|
|
|
VkCommandBuffer cmdbuffer;
|
|
|
|
VkFence fence; // for ctx->cmdbuffer only
|
|
|
|
vulkan_renderpass_t renderpass;
|
2020-02-18 08:18:37 +00:00
|
|
|
size_t curFrame;
|
|
|
|
vulkan_framebufferset_t framebuffers;
|
2020-02-16 13:45:27 +00:00
|
|
|
|
2019-07-08 16:00:47 +00:00
|
|
|
#define EXPORTED_VULKAN_FUNCTION(fname) PFN_##fname fname;
|
|
|
|
#define GLOBAL_LEVEL_VULKAN_FUNCTION(fname) PFN_##fname fname;
|
|
|
|
#include "QF/Vulkan/funclist.h"
|
|
|
|
} vulkan_ctx_t;
|
|
|
|
|
|
|
|
#endif//__vid_vulkan_h
|