554
|
1 import semicongine/vulkan
|
|
2
|
|
3
|
|
4 when isMainModule:
|
|
5 # print basic driver infos
|
|
6 echo "Layers"
|
|
7 for layer in getLayers():
|
|
8 echo " " & layer
|
|
9 echo "Instance extensions"
|
|
10 for extension in getInstanceExtensions():
|
|
11 echo " " & extension
|
|
12
|
|
13 # create instance
|
|
14 var instance = createInstance(
|
|
15 vulkanVersion=VK_MAKE_API_VERSION(0, 1, 3, 0),
|
|
16 instanceExtensions=["VK_EXT_debug_utils"],
|
|
17 layers=["VK_LAYER_KHRONOS_validation"]
|
|
18 )
|
|
19 var debugger = instance.createDebugMessenger()
|
|
20 echo "Devices"
|
|
21 for device in instance.getPhysicalDevices():
|
|
22 echo " " & $device
|
|
23 echo " Extensions"
|
|
24 for extension in device.getExtensions():
|
|
25 echo " " & $extension
|
|
26 echo " Queue families"
|
|
27 for queueFamily in device.getQueueFamilies():
|
|
28 echo " " & $queueFamily
|
|
29
|
|
30 # create devices
|
|
31 var devices: seq[Device]
|
|
32 for physicalDevice in instance.getPhysicalDevices():
|
|
33 devices.add physicalDevice.createDevice([], [], [])
|
|
34
|
|
35 # cleanup
|
|
36 for device in devices.mitems:
|
|
37 device.destroy()
|
|
38
|
|
39 debugger.destroy()
|
|
40 instance.destroy()
|