From 0d1e1dc275d8f0dce56030e5b4ba9db8eebbea96 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Bruyère Date: Mon, 2 Mar 2020 13:24:37 +0100 Subject: autogen of preloaded commands list based on first args --- VK/vulkan.csproj | 2 +- vk.generator/Program.cs | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/VK/vulkan.csproj b/VK/vulkan.csproj index 7573b6a..753e3cb 100644 --- a/VK/vulkan.csproj +++ b/VK/vulkan.csproj @@ -3,7 +3,7 @@ netstandard2.0 - 0.2.2.1 + 0.2.2.2 VK Low level vulkan bindings for .net VK diff --git a/vk.generator/Program.cs b/vk.generator/Program.cs index 43fa2a0..ecf7f85 100644 --- a/vk.generator/Program.cs +++ b/vk.generator/Program.cs @@ -178,16 +178,9 @@ namespace vk.generator { //function pointers to retrieve before any other vulkan api call. //those command should not move in other iface than common to be preload by normal dyn load - static string[] preloadedCommands = { - "vkCreateInstance", - "vkDestroyInstance", - "vkGetDeviceProcAddr", - "vkGetInstanceProcAddr", - "vkEnumerateInstanceExtensionProperties", - "vkEnumerateInstanceLayerProperties", - "vkEnumerateInstanceVersion"}; + static List preloadedCommands = new List {"vkGetDeviceProcAddr","vkGetInstanceProcAddr"}; - static string[] reservedNames = { "event", "object" }; + static string [] reservedNames = { "event", "object" }; static Dictionary paramsDefs = new Dictionary (); @@ -773,6 +766,12 @@ namespace vk.generator { tw.WriteLine (); } static void gen_commands (string englobingStaticClass) { + + string [] firstParamPreloadExclusion = { "VkInstance", "VkDevice", "VkPhysicalDevice", "VkQueue", "VkCommandBuffer" }; + preloadedCommands.AddRange ( + commands.Where (c => string.IsNullOrEmpty (c.alias) && c.parameters.Count > 0 && + !firstParamPreloadExclusion.Contains (c.parameters [0].typedef.Name)).Select (c => c.Name)); + using (StreamWriter sr = new StreamWriter ($"commands_{englobingStaticClass}_gen.cs", false, System.Text.Encoding.UTF8)) { using (IndentedTextWriter tw = new IndentedTextWriter (sr)) { writePreamble (tw, vknamespace + ".Generator"); -- cgit v1.3.1-4-g156e