annotate src/vulkan_helpers.nim @ 461:59d861a6a5c4

add: initial version
author Sam <sam@basx.dev>
date Wed, 14 Dec 2022 00:49:35 +0700
parents
children bb2a7d3a7003
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
461
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
1 import std/strutils
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
2 import std/enumerate
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
3 import vulkan
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
4
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
5 when defined(release):
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
6 const ENABLEVULKANVALIDATIONLAYERS = false
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
7 else:
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
8 const ENABLEVULKANVALIDATIONLAYERS = true
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
9
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
10
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
11 template checkVkResult*(call: untyped) =
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
12 let value = call
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
13 if value != VK_SUCCESS:
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
14 raise newException(Exception, "Vulkan error: " & astToStr(call) & " returned " & $value)
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
15
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
16
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
17 proc VK_MAKE_API_VERSION*(variant: uint32, major: uint32, minor: uint32, patch: uint32): uint32 {.compileTime.} =
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
18 (variant shl 29) or (major shl 22) or (minor shl 12) or patch
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
19
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
20 proc getInstanceExtensions*(): seq[string] =
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
21 var extensionCount: uint32
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
22 checkVkResult vkEnumerateInstanceExtensionProperties(nil, addr(extensionCount), nil)
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
23 var extensions = newSeq[VkExtensionProperties](extensionCount)
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
24 checkVkResult vkEnumerateInstanceExtensionProperties(nil, addr(extensionCount), addr(extensions[0]))
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
25
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
26 for extension in extensions:
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
27 result.add(join(extension.extensionName).strip(chars={char(0)}))
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
28
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
29
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
30 proc getDeviceExtensions*(device: VkPhysicalDevice): seq[string] =
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
31 var extensionCount: uint32
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
32 checkVkResult vkEnumerateDeviceExtensionProperties(device, nil, addr(extensionCount), nil)
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
33 var extensions = newSeq[VkExtensionProperties](extensionCount)
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
34 checkVkResult vkEnumerateDeviceExtensionProperties(device, nil, addr(extensionCount), addr(extensions[0]))
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
35
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
36 for extension in extensions:
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
37 result.add(join(extension.extensionName).strip(chars={char(0)}))
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
38
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
39
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
40 proc getValidationLayers*(): seq[string] =
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
41 var n_layers: uint32
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
42 checkVkResult vkEnumerateInstanceLayerProperties(addr(n_layers), nil)
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
43 var layers = newSeq[VkLayerProperties](n_layers)
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
44 checkVkResult vkEnumerateInstanceLayerProperties(addr(n_layers), addr(layers[0]))
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
45
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
46 for layer in layers:
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
47 result.add(join(layer.layerName).strip(chars={char(0)}))
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
48
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
49
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
50 proc getVulkanPhysicalDevices*(instance: VkInstance): seq[VkPhysicalDevice] =
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
51 var n_devices: uint32
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
52 checkVkResult vkEnumeratePhysicalDevices(instance, addr(n_devices), nil)
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
53 result = newSeq[VkPhysicalDevice](n_devices)
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
54 checkVkResult vkEnumeratePhysicalDevices(instance, addr(n_devices), addr(result[0]))
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
55
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
56
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
57 proc getQueueFamilies*(device: VkPhysicalDevice): seq[VkQueueFamilyProperties] =
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
58 var n_queuefamilies: uint32
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
59 vkGetPhysicalDeviceQueueFamilyProperties(device, addr(n_queuefamilies), nil)
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
60 result = newSeq[VkQueueFamilyProperties](n_queuefamilies)
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
61 vkGetPhysicalDeviceQueueFamilyProperties(device, addr(n_queuefamilies), addr(result[0]))
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
62
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
63
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
64 proc getDeviceSurfaceFormats*(device: VkPhysicalDevice, surface: VkSurfaceKHR): seq[VkSurfaceFormatKHR] =
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
65 var n_formats: uint32
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
66 checkVkResult vkGetPhysicalDeviceSurfaceFormatsKHR(device, surface, addr(n_formats), nil);
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
67 result = newSeq[VkSurfaceFormatKHR](n_formats)
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
68 checkVkResult vkGetPhysicalDeviceSurfaceFormatsKHR(device, surface, addr(n_formats), addr(result[0]))
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
69
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
70
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
71 proc getDeviceSurfacePresentModes*(device: VkPhysicalDevice, surface: VkSurfaceKHR): seq[VkPresentModeKHR] =
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
72 var n_modes: uint32
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
73 checkVkResult vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, addr(n_modes), nil);
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
74 result = newSeq[VkPresentModeKHR](n_modes)
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
75 checkVkResult vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, addr(n_modes), addr(result[0]))
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
76
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
77
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
78 proc getSwapChainImages*(device: VkDevice, swapChain: VkSwapchainKHR): seq[VkImage] =
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
79 var n_images: uint32
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
80 checkVkResult vkGetSwapchainImagesKHR(device, swapChain, addr(n_images), nil);
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
81 result = newSeq[VkImage](n_images)
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
82 checkVkResult vkGetSwapchainImagesKHR(device, swapChain, addr(n_images), addr(result[0]));
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
83
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
84
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
85 proc getPresentMode*(modes: seq[VkPresentModeKHR]): VkPresentModeKHR =
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
86 let preferredModes = [
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
87 VK_PRESENT_MODE_MAILBOX_KHR,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
88 VK_PRESENT_MODE_FIFO_RELAXED_KHR,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
89 VK_PRESENT_MODE_FIFO_KHR,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
90 VK_PRESENT_MODE_IMMEDIATE_KHR,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
91 ]
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
92 for preferredMode in preferredModes:
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
93 for mode in modes:
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
94 if preferredMode == mode:
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
95 return mode
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
96 # should never be reached, but seems to be garuanteed by vulkan specs to always be available
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
97 return VK_PRESENT_MODE_FIFO_KHR
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
98
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
99
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
100 proc createVulkanInstance*(vulkanVersion: uint32): VkInstance =
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
101 var requiredExtensions = [
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
102 "VK_EXT_acquire_xlib_display".cstring,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
103 "VK_EXT_direct_mode_display".cstring,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
104 "VK_KHR_display".cstring,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
105 "VK_KHR_surface".cstring,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
106 "VK_KHR_xlib_surface".cstring,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
107 ]
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
108 let availableExtensions = getInstanceExtensions()
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
109 for extension in requiredExtensions:
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
110 assert $extension in availableExtensions
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
111
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
112 let desiredLayers = ["VK_LAYER_KHRONOS_validation".cstring, "VK_LAYER_MESA_overlay".cstring]
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
113 let availableLayers = getValidationLayers()
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
114 var usableLayers = newSeq[cstring]()
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
115
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
116 when ENABLEVULKANVALIDATIONLAYERS:
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
117 for layer in desiredLayers:
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
118 if $layer in availableLayers:
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
119 usableLayers.add(layer)
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
120
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
121 echo "Using validation layers: ", usableLayers
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
122 echo "Using extensions: ", requiredExtensions
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
123
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
124 var appinfo = VkApplicationInfo(
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
125 sType: VK_STRUCTURE_TYPE_APPLICATION_INFO,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
126 pApplicationName: "Hello Triangle",
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
127 pEngineName: "Custom engine",
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
128 apiVersion: vulkanVersion,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
129 )
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
130 var createinfo = VkInstanceCreateInfo(
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
131 sType: VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
132 pApplicationInfo: addr(appinfo),
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
133 enabledLayerCount: usableLayers.len.uint32,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
134 ppEnabledLayerNames: cast[ptr UncheckedArray[cstring]](addr(usableLayers[0])),
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
135 enabledExtensionCount: requiredExtensions.len.uint32,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
136 ppEnabledExtensionNames: cast[ptr UncheckedArray[cstring]](addr(requiredExtensions))
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
137 )
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
138 checkVkResult vkCreateInstance(addr(createinfo), nil, addr(result))
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
139
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
140 loadVK_KHR_surface()
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
141 loadVK_KHR_xlib_surface()
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
142 loadVK_KHR_swapchain()
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
143
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
144
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
145 proc getVulcanDevice*(
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
146 physicalDevice: var VkPhysicalDevice,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
147 features: var VkPhysicalDeviceFeatures,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
148 selectedQueueFamily: uint32,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
149 ): (VkDevice, VkQueue) =
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
150 # setup queue and device
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
151 var priority = 1.0'f32
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
152 var queueCreateInfo = VkDeviceQueueCreateInfo(
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
153 sType: VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
154 queueFamilyIndex: uint32(selectedQueueFamily),
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
155 queueCount: 1,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
156 pQueuePriorities: addr(priority),
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
157 )
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
158
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
159 var requiredExtensions = ["VK_KHR_swapchain".cstring]
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
160 var deviceCreateInfo = VkDeviceCreateInfo(
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
161 sType: VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
162 pQueueCreateInfos: addr(queueCreateInfo),
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
163 queueCreateInfoCount: 1,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
164 pEnabledFeatures: addr(features),
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
165 enabledExtensionCount: requiredExtensions.len.uint32,
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
166 ppEnabledExtensionNames: cast[ptr UncheckedArray[cstring]](addr(requiredExtensions))
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
167 )
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
168 checkVkResult vkCreateDevice(physicalDevice, addr(deviceCreateInfo), nil, addr(result[0]))
59d861a6a5c4 add: initial version
Sam <sam@basx.dev>
parents:
diff changeset
169 vkGetDeviceQueue(result[0], selectedQueueFamily, 0'u32, addr(result[1]));