Mercurial > games > semicongine
annotate src/zamikongine/vulkan_helpers.nim @ 39:0cb294c5d2fd
fix: hello cube, add: run_all command
author | Sam <sam@basx.dev> |
---|---|
date | Wed, 18 Jan 2023 13:49:12 +0700 |
parents | c3c963e7c1a6 |
children |
rev | line source |
---|---|
1 | 1 import std/tables |
0 | 2 import std/strutils |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
3 import std/strformat |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
4 import std/logging |
10 | 5 import std/macros |
1 | 6 |
7 import ./vulkan | |
5
4ed9cb098315
add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents:
4
diff
changeset
|
8 import ./window |
1 | 9 |
0 | 10 template checkVkResult*(call: untyped) = |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
11 when defined(release): |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
12 discard call |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
13 else: |
17 | 14 # yes, a bit cheap, but this is only for nice debug output |
15 var callstr = astToStr(call).replace("\n", "") | |
16 while callstr.find(" ") >= 0: | |
17 callstr = callstr.replace(" ", " ") | |
18 debug "CALLING vulkan: ", callstr | |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
19 let value = call |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
20 if value != VK_SUCCESS: |
10 | 21 error "Vulkan error: ", astToStr(call), " returned ", $value |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
22 raise newException(Exception, "Vulkan error: " & astToStr(call) & " returned " & $value) |
0 | 23 |
38
c3c963e7c1a6
did: tons of stuff, input, refactoring, fix some errors, some template improvment, sorry for super-commit
Sam <sam@basx.dev>
parents:
22
diff
changeset
|
24 # the included code need checkVkResult, therefore having the template above |
c3c963e7c1a6
did: tons of stuff, input, refactoring, fix some errors, some template improvment, sorry for super-commit
Sam <sam@basx.dev>
parents:
22
diff
changeset
|
25 when defined(linux): |
c3c963e7c1a6
did: tons of stuff, input, refactoring, fix some errors, some template improvment, sorry for super-commit
Sam <sam@basx.dev>
parents:
22
diff
changeset
|
26 include ./platform/linux/vulkan |
c3c963e7c1a6
did: tons of stuff, input, refactoring, fix some errors, some template improvment, sorry for super-commit
Sam <sam@basx.dev>
parents:
22
diff
changeset
|
27 when defined(windows): |
c3c963e7c1a6
did: tons of stuff, input, refactoring, fix some errors, some template improvment, sorry for super-commit
Sam <sam@basx.dev>
parents:
22
diff
changeset
|
28 include ./platform/windows/vulkan |
c3c963e7c1a6
did: tons of stuff, input, refactoring, fix some errors, some template improvment, sorry for super-commit
Sam <sam@basx.dev>
parents:
22
diff
changeset
|
29 |
c3c963e7c1a6
did: tons of stuff, input, refactoring, fix some errors, some template improvment, sorry for super-commit
Sam <sam@basx.dev>
parents:
22
diff
changeset
|
30 const ENABLEVULKANVALIDATIONLAYERS* = not defined(release) |
c3c963e7c1a6
did: tons of stuff, input, refactoring, fix some errors, some template improvment, sorry for super-commit
Sam <sam@basx.dev>
parents:
22
diff
changeset
|
31 |
5
4ed9cb098315
add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents:
4
diff
changeset
|
32 func addrOrNil[T](obj: var openArray[T]): ptr T = |
4ed9cb098315
add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents:
4
diff
changeset
|
33 if obj.len > 0: addr(obj[0]) else: nil |
0 | 34 |
17 | 35 func VK_MAKE_API_VERSION*(variant: uint32, major: uint32, minor: uint32, patch: uint32): uint32 {.compileTime.} = |
0 | 36 (variant shl 29) or (major shl 22) or (minor shl 12) or patch |
37 | |
1 | 38 |
17 | 39 func filterForSurfaceFormat*(formats: seq[VkSurfaceFormatKHR]): seq[VkSurfaceFormatKHR] = |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
40 for format in formats: |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
41 if format.format == VK_FORMAT_B8G8R8A8_SRGB and format.colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR: |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
42 result.add(format) |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
43 |
17 | 44 func getSuitableSurfaceFormat*(formats: seq[VkSurfaceFormatKHR]): VkSurfaceFormatKHR = |
4
af9183acb173
did: refactor, add resizing, proper cleanup
Sam <sam@basx.dev>
parents:
2
diff
changeset
|
45 let usableSurfaceFormats = filterForSurfaceFormat(formats) |
af9183acb173
did: refactor, add resizing, proper cleanup
Sam <sam@basx.dev>
parents:
2
diff
changeset
|
46 if len(usableSurfaceFormats) == 0: |
af9183acb173
did: refactor, add resizing, proper cleanup
Sam <sam@basx.dev>
parents:
2
diff
changeset
|
47 raise newException(Exception, "No suitable surface formats found") |
af9183acb173
did: refactor, add resizing, proper cleanup
Sam <sam@basx.dev>
parents:
2
diff
changeset
|
48 return usableSurfaceFormats[0] |
af9183acb173
did: refactor, add resizing, proper cleanup
Sam <sam@basx.dev>
parents:
2
diff
changeset
|
49 |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
50 |
17 | 51 func cleanString*(str: openArray[char]): string = |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
52 for i in 0 ..< len(str): |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
53 if str[i] == char(0): |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
54 result = join(str[0 ..< i]) |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
55 break |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
56 |
0 | 57 proc getInstanceExtensions*(): seq[string] = |
58 var extensionCount: uint32 | |
59 checkVkResult vkEnumerateInstanceExtensionProperties(nil, addr(extensionCount), nil) | |
60 var extensions = newSeq[VkExtensionProperties](extensionCount) | |
5
4ed9cb098315
add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents:
4
diff
changeset
|
61 checkVkResult vkEnumerateInstanceExtensionProperties(nil, addr(extensionCount), addrOrNil(extensions)) |
0 | 62 |
63 for extension in extensions: | |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
64 result.add(cleanString(extension.extensionName)) |
0 | 65 |
66 | |
67 proc getDeviceExtensions*(device: VkPhysicalDevice): seq[string] = | |
68 var extensionCount: uint32 | |
69 checkVkResult vkEnumerateDeviceExtensionProperties(device, nil, addr(extensionCount), nil) | |
70 var extensions = newSeq[VkExtensionProperties](extensionCount) | |
5
4ed9cb098315
add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents:
4
diff
changeset
|
71 checkVkResult vkEnumerateDeviceExtensionProperties(device, nil, addr(extensionCount), addrOrNil(extensions)) |
0 | 72 |
73 for extension in extensions: | |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
74 result.add(cleanString(extension.extensionName)) |
0 | 75 |
76 | |
77 proc getValidationLayers*(): seq[string] = | |
78 var n_layers: uint32 | |
79 checkVkResult vkEnumerateInstanceLayerProperties(addr(n_layers), nil) | |
80 var layers = newSeq[VkLayerProperties](n_layers) | |
5
4ed9cb098315
add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents:
4
diff
changeset
|
81 checkVkResult vkEnumerateInstanceLayerProperties(addr(n_layers), addrOrNil(layers)) |
0 | 82 |
83 for layer in layers: | |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
84 result.add(cleanString(layer.layerName)) |
0 | 85 |
86 | |
87 proc getVulkanPhysicalDevices*(instance: VkInstance): seq[VkPhysicalDevice] = | |
88 var n_devices: uint32 | |
89 checkVkResult vkEnumeratePhysicalDevices(instance, addr(n_devices), nil) | |
90 result = newSeq[VkPhysicalDevice](n_devices) | |
5
4ed9cb098315
add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents:
4
diff
changeset
|
91 checkVkResult vkEnumeratePhysicalDevices(instance, addr(n_devices), addrOrNil(result)) |
0 | 92 |
93 | |
94 proc getQueueFamilies*(device: VkPhysicalDevice): seq[VkQueueFamilyProperties] = | |
95 var n_queuefamilies: uint32 | |
96 vkGetPhysicalDeviceQueueFamilyProperties(device, addr(n_queuefamilies), nil) | |
97 result = newSeq[VkQueueFamilyProperties](n_queuefamilies) | |
5
4ed9cb098315
add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents:
4
diff
changeset
|
98 vkGetPhysicalDeviceQueueFamilyProperties(device, addr(n_queuefamilies), addrOrNil(result)) |
0 | 99 |
100 | |
101 proc getDeviceSurfaceFormats*(device: VkPhysicalDevice, surface: VkSurfaceKHR): seq[VkSurfaceFormatKHR] = | |
102 var n_formats: uint32 | |
103 checkVkResult vkGetPhysicalDeviceSurfaceFormatsKHR(device, surface, addr(n_formats), nil); | |
104 result = newSeq[VkSurfaceFormatKHR](n_formats) | |
5
4ed9cb098315
add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents:
4
diff
changeset
|
105 checkVkResult vkGetPhysicalDeviceSurfaceFormatsKHR(device, surface, addr(n_formats), addrOrNil(result)) |
0 | 106 |
107 | |
108 proc getDeviceSurfacePresentModes*(device: VkPhysicalDevice, surface: VkSurfaceKHR): seq[VkPresentModeKHR] = | |
109 var n_modes: uint32 | |
110 checkVkResult vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, addr(n_modes), nil); | |
111 result = newSeq[VkPresentModeKHR](n_modes) | |
5
4ed9cb098315
add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents:
4
diff
changeset
|
112 checkVkResult vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, addr(n_modes), addrOrNil(result)) |
0 | 113 |
114 | |
115 proc getSwapChainImages*(device: VkDevice, swapChain: VkSwapchainKHR): seq[VkImage] = | |
116 var n_images: uint32 | |
117 checkVkResult vkGetSwapchainImagesKHR(device, swapChain, addr(n_images), nil); | |
118 result = newSeq[VkImage](n_images) | |
5
4ed9cb098315
add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents:
4
diff
changeset
|
119 checkVkResult vkGetSwapchainImagesKHR(device, swapChain, addr(n_images), addrOrNil(result)); |
0 | 120 |
121 | |
17 | 122 func getPresentMode*(modes: seq[VkPresentModeKHR]): VkPresentModeKHR = |
0 | 123 let preferredModes = [ |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
124 VK_PRESENT_MODE_MAILBOX_KHR, # triple buffering |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
125 VK_PRESENT_MODE_FIFO_RELAXED_KHR, # double duffering |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
126 VK_PRESENT_MODE_FIFO_KHR, # double duffering |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
127 VK_PRESENT_MODE_IMMEDIATE_KHR, # single buffering |
0 | 128 ] |
129 for preferredMode in preferredModes: | |
130 for mode in modes: | |
131 if preferredMode == mode: | |
132 return mode | |
133 # should never be reached, but seems to be garuanteed by vulkan specs to always be available | |
134 return VK_PRESENT_MODE_FIFO_KHR | |
135 | |
136 | |
137 proc createVulkanInstance*(vulkanVersion: uint32): VkInstance = | |
10 | 138 |
38
c3c963e7c1a6
did: tons of stuff, input, refactoring, fix some errors, some template improvment, sorry for super-commit
Sam <sam@basx.dev>
parents:
22
diff
changeset
|
139 var requiredExtensions = @["VK_KHR_surface".cstring] & REQUIRED_PLATFORM_EXTENSIONS |
12 | 140 when ENABLEVULKANVALIDATIONLAYERS: |
141 requiredExtensions.add("VK_EXT_debug_utils".cstring) | |
10 | 142 |
0 | 143 let availableExtensions = getInstanceExtensions() |
144 for extension in requiredExtensions: | |
10 | 145 assert $extension in availableExtensions, $extension |
0 | 146 |
147 let availableLayers = getValidationLayers() | |
148 var usableLayers = newSeq[cstring]() | |
149 | |
150 when ENABLEVULKANVALIDATIONLAYERS: | |
12 | 151 const desiredLayers = ["VK_LAYER_KHRONOS_validation".cstring, "VK_LAYER_MESA_overlay".cstring] |
22
b45a5d338cd0
did: improve alotof_triangles example, remove glslang lib, use only binary, easier cross-compilation
Sam <sam@basx.dev>
parents:
19
diff
changeset
|
152 else: |
b45a5d338cd0
did: improve alotof_triangles example, remove glslang lib, use only binary, easier cross-compilation
Sam <sam@basx.dev>
parents:
19
diff
changeset
|
153 const desiredLayers = ["VK_LAYER_MESA_overlay".cstring] |
b45a5d338cd0
did: improve alotof_triangles example, remove glslang lib, use only binary, easier cross-compilation
Sam <sam@basx.dev>
parents:
19
diff
changeset
|
154 for layer in desiredLayers: |
b45a5d338cd0
did: improve alotof_triangles example, remove glslang lib, use only binary, easier cross-compilation
Sam <sam@basx.dev>
parents:
19
diff
changeset
|
155 if $layer in availableLayers: |
b45a5d338cd0
did: improve alotof_triangles example, remove glslang lib, use only binary, easier cross-compilation
Sam <sam@basx.dev>
parents:
19
diff
changeset
|
156 usableLayers.add(layer) |
0 | 157 |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
158 echo "Available validation layers: ", availableLayers |
0 | 159 echo "Using validation layers: ", usableLayers |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
160 echo "Available extensions: ", availableExtensions |
0 | 161 echo "Using extensions: ", requiredExtensions |
162 | |
163 var appinfo = VkApplicationInfo( | |
164 sType: VK_STRUCTURE_TYPE_APPLICATION_INFO, | |
165 pApplicationName: "Hello Triangle", | |
166 pEngineName: "Custom engine", | |
167 apiVersion: vulkanVersion, | |
168 ) | |
169 var createinfo = VkInstanceCreateInfo( | |
170 sType: VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, | |
171 pApplicationInfo: addr(appinfo), | |
172 enabledLayerCount: usableLayers.len.uint32, | |
5
4ed9cb098315
add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents:
4
diff
changeset
|
173 ppEnabledLayerNames: cast[ptr UncheckedArray[cstring]](addrOrNil(usableLayers)), |
0 | 174 enabledExtensionCount: requiredExtensions.len.uint32, |
12 | 175 ppEnabledExtensionNames: cast[ptr UncheckedArray[cstring]](addr(requiredExtensions[0])) |
0 | 176 ) |
177 checkVkResult vkCreateInstance(addr(createinfo), nil, addr(result)) | |
178 | |
179 loadVK_KHR_surface() | |
38
c3c963e7c1a6
did: tons of stuff, input, refactoring, fix some errors, some template improvment, sorry for super-commit
Sam <sam@basx.dev>
parents:
22
diff
changeset
|
180 load_platform_extensions() |
0 | 181 loadVK_KHR_swapchain() |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
182 when ENABLEVULKANVALIDATIONLAYERS: |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
183 loadVK_EXT_debug_utils(result) |
0 | 184 |
185 | |
186 proc getVulcanDevice*( | |
187 physicalDevice: var VkPhysicalDevice, | |
188 features: var VkPhysicalDeviceFeatures, | |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
189 graphicsQueueFamily: uint32, |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
190 presentationQueueFamily: uint32, |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
191 ): (VkDevice, VkQueue, VkQueue) = |
0 | 192 # setup queue and device |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
193 # TODO: need check this, possibly wrong logic, see Vulkan tutorial |
0 | 194 var priority = 1.0'f32 |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
195 var queueCreateInfo = [ |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
196 VkDeviceQueueCreateInfo( |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
197 sType: VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
198 queueFamilyIndex: graphicsQueueFamily, |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
199 queueCount: 1, |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
200 pQueuePriorities: addr(priority), |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
201 ), |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
202 ] |
0 | 203 |
204 var requiredExtensions = ["VK_KHR_swapchain".cstring] | |
205 var deviceCreateInfo = VkDeviceCreateInfo( | |
206 sType: VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO, | |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
207 queueCreateInfoCount: uint32(queueCreateInfo.len), |
5
4ed9cb098315
add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents:
4
diff
changeset
|
208 pQueueCreateInfos: addrOrNil(queueCreateInfo), |
0 | 209 pEnabledFeatures: addr(features), |
210 enabledExtensionCount: requiredExtensions.len.uint32, | |
211 ppEnabledExtensionNames: cast[ptr UncheckedArray[cstring]](addr(requiredExtensions)) | |
212 ) | |
213 checkVkResult vkCreateDevice(physicalDevice, addr(deviceCreateInfo), nil, addr(result[0])) | |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
214 vkGetDeviceQueue(result[0], graphicsQueueFamily, 0'u32, addr(result[1])); |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
215 vkGetDeviceQueue(result[0], presentationQueueFamily, 0'u32, addr(result[2])); |
1 | 216 |
2
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
217 proc debugCallback*( |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
218 messageSeverity: VkDebugUtilsMessageSeverityFlagBitsEXT, |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
219 messageTypes: VkDebugUtilsMessageTypeFlagsEXT, |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
220 pCallbackData: VkDebugUtilsMessengerCallbackDataEXT, |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
221 userData: pointer |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
222 ): VkBool32 {.cdecl.} = |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
223 echo &"{messageSeverity}: {VkDebugUtilsMessageTypeFlagBitsEXT(messageTypes)}: {pCallbackData.pMessage}" |
213fdf8d31dd
did: hello world triangle, a bit of code organization
Sam <sam@basx.dev>
parents:
1
diff
changeset
|
224 return VK_FALSE |
5
4ed9cb098315
add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents:
4
diff
changeset
|
225 |
4ed9cb098315
add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents:
4
diff
changeset
|
226 proc getSurfaceCapabilities*(device: VkPhysicalDevice, surface: VkSurfaceKHR): VkSurfaceCapabilitiesKHR = |
4ed9cb098315
add: structure code for crossplatform, add some input handling + bugfixes
Sam <sam@basx.dev>
parents:
4
diff
changeset
|
227 checkVkResult device.vkGetPhysicalDeviceSurfaceCapabilitiesKHR(surface, addr(result)) |