main
1#include "gogerr.h"
2#include <vulkan/vulkan_core.h>
3#include <SDL2/SDL.h>
4#include <SDL2/SDL_events.h>
5#include <SDL2/SDL_video.h>
6#include <SDL2/SDL_vulkan.h>
7
8#ifndef GOG_ENGINE_NAME
9#define GOG_ENGINE_NAME "gog"
10#endif
11
12#ifndef GOG_APPLICATION_NAME
13#define GOG_APPLICATION_NAME "gog"
14#endif
15
16#ifndef GOG_WINDOW_TITLE
17#define GOG_WINDOW_TITLE "gog"
18#endif
19
20#ifndef GOG_WINDOW_REZ_WIDTH
21#define GOG_WINDOW_REZ_WIDTH 1920
22#endif
23
24#ifndef GOG_WINDOW_REZ_HEIGHT
25#define GOG_WINDOW_REZ_HEIGHT 1080
26#endif
27
28#define GOG_USE_QUEUE_GRAPHICS 0x1
29#define GOG_USE_QUEUE_PRESENT 0x2
30
31typedef struct vk_graphics_vars
32{
33 VkInstance vk_instance;
34 VkSurfaceKHR vk_surface;
35 VkDevice vk_device;
36 VkPhysicalDevice vk_gpu;
37 int32_t vk_queue_index_graphics;
38 int32_t vk_queue_index_compute;
39 int32_t vk_queue_index_transfer;
40 int32_t vk_queue_index_sparse_binding;
41 int32_t vk_queue_index_present;
42 int32_t vk_queues_c;
43 VkQueue * vk_queues_p;
44 VkSwapchainKHR vk_swapchain;
45 VkSharingMode * vk_shaders_p;
46 VkPipeline * vk_pipelines_p;
47 VkPipelineLayout * vk_pipeline_layouts_p;
48
49 SDL_Window * sdl_window_p;
50}gog_graphics_hndl;
51
52struct gog_vk_ext
53{
54 int vk_ext_count;
55 const char ** vk_ext_pp;
56};
57
58
59gog_result gog_open_sdl_window(SDL_Window ** window, struct gog_vk_ext * extensions);
60gog_result gog_vulkan_init(VkInstance * instance, struct gog_vk_ext extensions, int flags);
61gog_result gog_get_physical_device(gog_graphics_hndl *gh, struct gog_vk_ext ext, int flags);
62gog_result gog_verify_device_extensions(struct gog_vk_ext gog_ext,VkExtensionProperties *ext, int ext_count);
63gog_result gog_find_device_queues(gog_graphics_hndl *gh, VkQueueFamilyProperties * queue_prop_p, int queue_prop_count);
64gog_result gog_device_init(gog_graphics_hndl *gh, struct gog_vk_ext gog_ext);
65gog_result gog_graphics_init(gog_graphics_hndl *gh);