]> O.S.I.I.S - jp/vke.net.git/commitdiff
query mesh shader infos
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sat, 5 Nov 2022 13:05:03 +0000 (14:05 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 6 Nov 2022 16:39:15 +0000 (17:39 +0100)
samples/ExternalMemmories/Program.cs
samples/MeshShader/main.cs
vke/src/base/Instance.cs
vke/src/base/PhysicalDevice.cs

index 2526b4926f6853c9aeac1d8f2f597524af05cc23..d9837c6c1d686de3252f25aa88b64805c7790109 100644 (file)
@@ -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}");
                                                }
index 6f96028a62855462eb78cb85eaaa6ec17597ca51..5625588c382a788d911fad310dc8305a1c754b41 100644 (file)
@@ -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<VkPhysicalDeviceMeshShaderPropertiesEXT>()) {
+                               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) {
index 966383ae953b53aaad1a04c48acca25e45012b60..d7bd82be0bdca8fe91b9b6bec66ed759f25fda38 100644 (file)
@@ -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";
 
index 3ef8269c6750c8bc30cebd181560c48302f1a46b..d08e481373a6a141bfe20d9721cfe58c2dbd85e5 100644 (file)
@@ -49,8 +49,8 @@ namespace vke {
        /// </summary>
        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<VkPhysicalDeviceMemoryProperties> ());
-                       vkGetPhysicalDeviceMemoryProperties (phy, tmp);
-
-                       memoryProperties = Marshal.PtrToStructure<VkPhysicalDeviceMemoryProperties> (tmp);
-                       Marshal.FreeHGlobal (tmp);
+                       vkGetPhysicalDeviceMemoryProperties (phy, out _memoryProperties);
 
                        vkGetPhysicalDeviceQueueFamilyProperties (phy, out uint queueFamilyCount, IntPtr.Zero);
                        QueueFamilies = new VkQueueFamilyProperties [queueFamilyCount];