From: Jean-Philippe Bruyère Date: Sat, 5 Nov 2022 13:05:03 +0000 (+0100) Subject: query mesh shader infos X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=3a04982a29a800be22a7f367c9b94c91283f10ba;p=jp%2Fvke.net.git query mesh shader infos --- diff --git a/samples/ExternalMemmories/Program.cs b/samples/ExternalMemmories/Program.cs index 2526b49..d9837c6 100644 --- a/samples/ExternalMemmories/Program.cs +++ b/samples/ExternalMemmories/Program.cs @@ -42,12 +42,12 @@ namespace ExternalMemmories gQ = new Queue (dev, Vulkan.VkQueueFlags.Graphics); VkPhysicalDeviceFeatures features = default; - dev.Activate (features, new string[] { + dev.Activate (IntPtr.Zero, features, Ext.D.VK_KHR_external_memory, Ext.D.VK_EXT_external_memory_host, Ext.D.VK_EXT_external_memory_dma_buf, - Ext.D.VK_KHR_external_memory_fd, - }); + Ext.D.VK_KHR_external_memory_fd + ); } public bool TryGetImageFormatProperties (VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, out VkImageFormatProperties properties, @@ -68,7 +68,7 @@ namespace ExternalMemmories public void listFormat () { foreach (VkFormat format in Enum.GetValues(typeof(VkFormat))) { - if (format == VkFormat.G16B16R163plane444UnormKHR) + if (format == VkFormat.G16B16R16_3plane444Unorm) break; vkGetPhysicalDeviceFormatProperties (phy.Handle, format, out VkFormatProperties props); @@ -101,7 +101,7 @@ namespace ExternalMemmories foreach (VkExternalMemoryHandleTypeFlags handleType in Enum.GetValues (typeof(VkExternalMemoryHandleTypeFlags))) { extImgFormatInfo.handleType = handleType; - VkResult res = vkGetPhysicalDeviceImageFormatProperties2 (phy.Handle, ref imgFormatInfo2, out imgProps2); + VkResult res = vkGetPhysicalDeviceImageFormatProperties2 (phy.Handle, ref imgFormatInfo2, ref imgProps2); if (res == VkResult.Success) { Console.WriteLine ($"\t{handleType}: f:{extProps.externalMemoryProperties.externalMemoryFeatures} c:{extProps.externalMemoryProperties.compatibleHandleTypes} e:{extProps.externalMemoryProperties.exportFromImportedHandleTypes}"); } diff --git a/samples/MeshShader/main.cs b/samples/MeshShader/main.cs index 6f96028..5625588 100644 --- a/samples/MeshShader/main.cs +++ b/samples/MeshShader/main.cs @@ -34,9 +34,22 @@ namespace MeshShader { Console.WriteLine($"Mesh Shader Support:\t{meshFeat.Val.meshShader}"); Console.WriteLine($"Task Shader Support:\t{meshFeat.Val.taskShader}"); if (!(meshFeat.Val.meshShader && meshFeat.Val.taskShader)) { - phy = null; + phy = null; + return; } } + + VkPhysicalDeviceProperties2 phyProp2 = VkPhysicalDeviceProperties2.New; + using (var meshP = new PNext()) { + phyProp2.pNext = meshP; + + Vk.vkGetPhysicalDeviceProperties2(phy.Handle, ref phyProp2); + + Console.WriteLine($"maxMeshOutputPrimitives:\t{meshP.Val.maxMeshOutputPrimitives}"); + Console.WriteLine($"prefersLocalInvocationPrimitiveOutput:\t{meshP.Val.prefersLocalInvocationPrimitiveOutput}"); + Console.WriteLine($"maxMeshOutputVertices:\t{meshP.Val.maxMeshOutputVertices}"); + Console.WriteLine($"prefersLocalInvocationVertexOutput:\t{meshP.Val.prefersLocalInvocationVertexOutput}"); + } } static void Main (string[] args) { diff --git a/vke/src/base/Instance.cs b/vke/src/base/Instance.cs index 966383a..d7bd82b 100644 --- a/vke/src/base/Instance.cs +++ b/vke/src/base/Instance.cs @@ -32,10 +32,6 @@ namespace vke { public IntPtr Handle => inst.Handle; public VkInstance VkInstance => inst; - static class Strings { - - public static FixedUtf8String main = "main"; - } const string strValidationLayer = "VK_LAYER_KHRONOS_validation"; const string strRenderDocLayer = "VK_LAYER_RENDERDOC_Capture"; diff --git a/vke/src/base/PhysicalDevice.cs b/vke/src/base/PhysicalDevice.cs index 3ef8269..d08e481 100644 --- a/vke/src/base/PhysicalDevice.cs +++ b/vke/src/base/PhysicalDevice.cs @@ -49,8 +49,8 @@ namespace vke { /// public class PhysicalDevice { readonly IntPtr phy; - - public VkPhysicalDeviceMemoryProperties memoryProperties { get; private set; } + VkPhysicalDeviceMemoryProperties _memoryProperties; + public VkPhysicalDeviceMemoryProperties memoryProperties => _memoryProperties; public VkQueueFamilyProperties [] QueueFamilies { get; private set; } public VkPhysicalDeviceProperties Properties { get { @@ -75,11 +75,7 @@ namespace vke { phy = vkPhy; // Gather physical Device memory properties - IntPtr tmp = Marshal.AllocHGlobal (Marshal.SizeOf ()); - vkGetPhysicalDeviceMemoryProperties (phy, tmp); - - memoryProperties = Marshal.PtrToStructure (tmp); - Marshal.FreeHGlobal (tmp); + vkGetPhysicalDeviceMemoryProperties (phy, out _memoryProperties); vkGetPhysicalDeviceQueueFamilyProperties (phy, out uint queueFamilyCount, IntPtr.Zero); QueueFamilies = new VkQueueFamilyProperties [queueFamilyCount];