Mercurial > games > semicongine
comparison src/zamikongine/vulkan.nim @ 38:c3c963e7c1a6
did: tons of stuff, input, refactoring, fix some errors, some template improvment, sorry for super-commit
author | Sam <sam@basx.dev> |
---|---|
date | Wed, 18 Jan 2023 09:52:03 +0700 |
parents | b55d6ecde79d |
children |
comparison
equal
deleted
inserted
replaced
37:6859bcfabc62 | 38:c3c963e7c1a6 |
---|---|
6 ## Any edits will be overwritten by the generator. | 6 ## Any edits will be overwritten by the generator. |
7 | 7 |
8 when defined(linux): | 8 when defined(linux): |
9 import x11/x | 9 import x11/x |
10 import x11/xlib | 10 import x11/xlib |
11 when defined(windows): | |
12 import winim | |
13 | |
14 var vkGetProc: proc(procName: cstring): pointer {.cdecl.} | |
15 | |
16 import dynlib | |
17 | |
18 when defined(windows): | |
19 {. emit: """#define VK_USE_PLATFORM_WIN32_KHR""" .} | |
20 const vkDLL = "vulkan-1.dll" | |
21 elif defined(linux): | |
22 {.passl: gorge("pkg-config --libs vulkan").} | |
23 {. emit: """#define VK_USE_PLATFORM_X11_KHR""" .} | |
24 const vkDLL = "libvulkan.so.1" | 11 const vkDLL = "libvulkan.so.1" |
25 else: | 12 else: |
26 raise quit("Unsupported platform") | 13 type |
14 Display* = ptr object | |
15 VisualID* = ptr object | |
16 Window* = ptr object | |
17 | |
18 when defined(windows): | |
19 const vkDLL = "vulkan-1.dll" | |
20 import winim | |
21 else: | |
22 type | |
23 HINSTANCE* = ptr object | |
24 HWND* = ptr object | |
25 HMONITOR* = ptr object | |
26 HANDLE* = ptr object | |
27 SECURITY_ATTRIBUTES* = ptr object | |
28 DWORD* = ptr object | |
29 LPCWSTR* = ptr object | |
30 | |
31 var vkGetProc: proc(procName: cstring): pointer {.cdecl.} | |
32 | |
33 import dynlib | |
27 | 34 |
28 let vkHandleDLL = loadLib(vkDLL) | 35 let vkHandleDLL = loadLib(vkDLL) |
29 if isNil(vkHandleDLL): | 36 if isNil(vkHandleDLL): |
30 quit("could not load: " & vkDLL) | 37 quit("could not load: " & vkDLL) |
31 | 38 |
1186 VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT_EXT = 8 | 1193 VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT_EXT = 8 |
1187 VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT_EXT = 16 | 1194 VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT_EXT = 16 |
1188 | 1195 |
1189 # Types | 1196 # Types |
1190 | 1197 |
1191 # stub types if we are on the wrong platform, so we don't need to "when" all platform functions | |
1192 when not defined(linux): | |
1193 type | |
1194 Display* = ptr object | |
1195 VisualID* = ptr object | |
1196 Window* = ptr object | |
1197 when not defined(windows): | |
1198 type | |
1199 HINSTANCE* = ptr object | |
1200 HWND* = ptr object | |
1201 HMONITOR* = ptr object | |
1202 HANDLE* = ptr object | |
1203 SECURITY_ATTRIBUTES* = ptr object | |
1204 DWORD* = ptr object | |
1205 LPCWSTR* = ptr object | |
1206 | |
1207 type | 1198 type |
1208 RROutput* = ptr object | 1199 RROutput* = ptr object |
1209 wl_display* = ptr object | 1200 wl_display* = ptr object |
1210 wl_surface* = ptr object | 1201 wl_surface* = ptr object |
1211 xcb_connection_t* = ptr object | 1202 xcb_connection_t* = ptr object |