diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-12-07 18:41:24 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-12-07 18:41:24 +0100 |
| commit | c926e6d7de5c6861eafcbfb7fefc61ffdf95bfeb (patch) | |
| tree | 1e291882dba10163458457035f619c945c1b1699 /samples/create_device | |
| parent | e35fe3571a0576a7f60d67d59f4d797712fda393 (diff) | |
samples
Diffstat (limited to 'samples/create_device')
| -rw-r--r-- | samples/create_device/Program.cs | 28 |
1 files changed, 6 insertions, 22 deletions
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()); |