From 6cb95877b57d79037e43fff22e855e600bcf4c80 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 17 Mar 2022 11:00:27 -0500 Subject: [PATCH] vulkan/cmd_queue: Auto-generate more vk_cmd_enqueue_unless_primary_Cmd* Instead of one MANUAL_COMMANDS, we now have two deny-lists: MANUAL_COMMANDS and NO_ENQUEUE_COMMANDS. The former is for things which have a manually typed implementation in vk_cmd_enqueue.c and the later is for things we want to ignore entirely. This lets us auto-generate vk_cmd_enqueue_unless_primary_Cmd* entrypoints for the manually typed vk_cmd_enqueue_Cmd* entrypoints. Part-of: --- src/vulkan/util/vk_cmd_queue_gen.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/vulkan/util/vk_cmd_queue_gen.py b/src/vulkan/util/vk_cmd_queue_gen.py index 3bd6651f682..52996b6dd5c 100644 --- a/src/vulkan/util/vk_cmd_queue_gen.py +++ b/src/vulkan/util/vk_cmd_queue_gen.py @@ -35,13 +35,11 @@ from mako.template import Template # '{file_without_suffix}_depend_files'. from vk_entrypoints import get_entrypoints_from_xml, EntrypointParam +# These have hand-typed implementations in vk_cmd_enqueue.c MANUAL_COMMANDS = [ # This script doesn't know how to copy arrays in structs in arrays 'CmdPushDescriptorSetKHR', - # pData's size cannot be calculated from the xml - 'CmdPushDescriptorSetWithTemplateKHR', - # The size of the elements is specified in a stride param 'CmdDrawMultiEXT', 'CmdDrawMultiIndexedEXT', @@ -49,6 +47,11 @@ MANUAL_COMMANDS = [ # The VkPipelineLayout object could be released before the command is # executed 'CmdBindDescriptorSets', +] + +NO_ENQUEUE_COMMANDS = [ + # pData's size cannot be calculated from the xml + 'CmdPushDescriptorSetWithTemplateKHR', # These don't return void 'CmdSetPerformanceMarkerINTEL', @@ -131,7 +134,7 @@ struct vk_cmd_queue_entry { }; % for c in commands: -% if c.name in manual_commands: +% if c.name in manual_commands or c.name in no_enqueue_commands: <% continue %> % endif % if c.guard is not None: @@ -207,7 +210,7 @@ const char *vk_cmd_queue_type_names[] = { }; % for c in commands: -% if c.name in manual_commands: +% if c.name in manual_commands or c.name in no_enqueue_commands: <% continue %> % endif % if c.guard is not None: @@ -311,7 +314,7 @@ vk_cmd_queue_execute(struct vk_cmd_queue *queue, } % for c in commands: -% if c.name in manual_commands: +% if c.name in no_enqueue_commands: /* TODO: Generate vk_cmd_enqueue_${c.name}() */ <% continue %> % endif @@ -320,6 +323,10 @@ vk_cmd_queue_execute(struct vk_cmd_queue *queue, #ifdef ${c.guard} % endif <% assert c.return_type == 'void' %> + +% if c.name in manual_commands: +/* vk_cmd_enqueue_${c.name}() is hand-typed in vk_cmd_enqueue.c */ +% else: VKAPI_ATTR void VKAPI_CALL vk_cmd_enqueue_${c.name}(${c.decl_params()}) { @@ -332,6 +339,7 @@ vk_cmd_enqueue_${c.name}(${c.decl_params()}) ${c.call_params(1)}); % endif } +% endif VKAPI_ATTR void VKAPI_CALL vk_cmd_enqueue_unless_primary_${c.name}(${c.decl_params()}) @@ -551,6 +559,7 @@ def main(): 'get_struct_free': get_struct_free, 'types': types, 'manual_commands': MANUAL_COMMANDS, + 'no_enqueue_commands': NO_ENQUEUE_COMMANDS, 'remove_suffix': remove_suffix, }