-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgpu_mini.h
113 lines (96 loc) · 2.35 KB
/
gpu_mini.h
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#ifndef GPU_MINI_H
#define GPU_MINI_H
#define GPU_MINI_VERSION 0.1
#include <stdio.h>
/*
#if defined(_WIN32)
#include <windows.h>
#else
//...
#endif
*/
#if defined(_WIN32)
#define VK_USE_PLATFORM_WIN32_KHR
#else //< elif defined(__linux__)
#define VK_USE_PLATFORM_XLIB_KHR
#endif
#include <vulkan/vulkan.h>
//void(*on_print)(char* a, FILE* b);
void gm_set_on_print(void(*a)(char*,FILE*));
void gm_unset_on_print();
//*****************************************************************************
// vulkan
//*****************************************************************************
struct gm_info_about_vulkan_t
{
int apiVersion;
struct
{
VkInstance a;
} vkinstance;
};
enum
{
EGMLoadVulkanParametersFlag_Safety = 1
};
struct gm_load_vulkan_parameters_t
{
int flags;
// NOTE: *ApiVersion == 0 is equivalent to VK_API_VERSION_1_0
// ^
// consistent with "providing an apiVersion of 0 is equivalent to..
// .. providing an apiVersion of VK_MAKE_API_VERSION(0,1,0,0)"
// ^
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkApplicationInfo.html
int minApiVersion;
// NOTE: maxApiVersion == -1 is equivalent to *ApiVersion ==..
// .. <gm_info_about_vulkan_t>.apiVersion (i.e. installed api..
// .. version)
int maxApiVersion;
};
static const struct gm_load_vulkan_parameters_t gm_load_vulkan_parameters_default = {
#ifdef GM_SAFETY
.flags = EGMLoadVulkanParametersFlag_Safety,
#else
.flags = 0,
#endif
.minApiVersion = 0,
.maxApiVersion = -1
};
int gm_load_vulkan(struct gm_load_vulkan_parameters_t* parameters);
int gm_unload_vulkan();
int gm_get_info_about_vulkan(struct gm_info_about_vulkan_t* infoAboutVulkan);
struct gm_load_vkinstance_parameters_t
{
#if defined(_WIN32)
struct
{
struct
{
HINSTANCE a;
} hinstance;
struct
{
HWND a;
} hwnd;
} win32;
#else //< #elif defined(__linux__)
struct
{
struct
{
Display* a;
} display;
struct
{
Window a;
} window;
} xlib;
#endif
};
int gm_load_vkinstance(struct gm_load_vkinstance_parameters_t* parameters);
int gm_unload_vkinstance();
//int gm_load_vkdevice(struct gm_load_vkdevice_parameters_t* parameters);
//int gm_unload_vkdevice();
//int gm_load_opengl
#endif