# HG changeset patch # User Sam # Date 1677517732 -25200 # Node ID cb773e81032ff5a5681399d5dc4d80630ba68e19 # Parent e872cf35411023ecd2796a442051b36ceeb90e08 add: testing for vulkan API wrapper diff -r e872cf354110 -r cb773e81032f tests/test_vulkan_wrapper.nim --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_vulkan_wrapper.nim Tue Feb 28 00:08:52 2023 +0700 @@ -0,0 +1,40 @@ +import semicongine/vulkan + + +when isMainModule: + # print basic driver infos + echo "Layers" + for layer in getLayers(): + echo " " & layer + echo "Instance extensions" + for extension in getInstanceExtensions(): + echo " " & extension + + # create instance + var instance = createInstance( + vulkanVersion=VK_MAKE_API_VERSION(0, 1, 3, 0), + instanceExtensions=["VK_EXT_debug_utils"], + layers=["VK_LAYER_KHRONOS_validation"] + ) + var debugger = instance.createDebugMessenger() + echo "Devices" + for device in instance.getPhysicalDevices(): + echo " " & $device + echo " Extensions" + for extension in device.getExtensions(): + echo " " & $extension + echo " Queue families" + for queueFamily in device.getQueueFamilies(): + echo " " & $queueFamily + + # create devices + var devices: seq[Device] + for physicalDevice in instance.getPhysicalDevices(): + devices.add physicalDevice.createDevice([], [], []) + + # cleanup + for device in devices.mitems: + device.destroy() + + debugger.destroy() + instance.destroy()