From c926e6d7de5c6861eafcbfb7fefc61ffdf95bfeb Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bruyère Date: Tue, 7 Dec 2021 18:41:24 +0100 Subject: samples --- samples/create_device/Program.cs | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'samples/create_device/Program.cs') diff --git a/samples/create_device/Program.cs b/samples/create_device/Program.cs index d3ab3fb..ef7339d 100644 --- a/samples/create_device/Program.cs +++ b/samples/create_device/Program.cs @@ -1,35 +1,13 @@ using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Text; using Vulkan; using static Vulkan.Vk; using static samples.Utils; -using Version = Vulkan.Version; using System.Linq; namespace tests { class Program { - - static bool TryGetPhysicalDevice (VkInstance inst, VkPhysicalDeviceType deviceType, out VkPhysicalDevice phy) { - CheckResult (vkEnumeratePhysicalDevices (inst, out uint phyCount, IntPtr.Zero)); - - VkPhysicalDevice[] phys = new VkPhysicalDevice[phyCount]; - - CheckResult (vkEnumeratePhysicalDevices (inst, out phyCount, phys.Pin())); - - for (int i = 0; i < phys.Length; i++) - { - phy = phys[i]; - vkGetPhysicalDeviceProperties (phy, out VkPhysicalDeviceProperties props); - if (props.deviceType == deviceType) - return true; - } - phy = default; - return false; - } static void Main(string[] args) { VkInstance inst; @@ -47,6 +25,12 @@ namespace tests if (!TryGetPhysicalDevice (inst, VkPhysicalDeviceType.Cpu, out phy)) throw new Exception ("no suitable physical device found"); + foreach (VkPhysicalDeviceToolPropertiesEXT toolProp in GetToolProperties(phy)) { + Console.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine ($"Enabled Tool: {toolProp.name}({toolProp.version})"); + Console.ResetColor (); + } + vkGetPhysicalDeviceQueueFamilyProperties (phy, out uint queueFamilyCount, IntPtr.Zero); VkQueueFamilyProperties[] phys = new VkQueueFamilyProperties[queueFamilyCount]; vkGetPhysicalDeviceQueueFamilyProperties (phy, out queueFamilyCount, phys.Pin()); -- cgit v1.3.1-4-g156e