Mesa (main): vulkan/cmd_queue: Generate enqueue entrypoints
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Mar 10 16:28:32 UTC 2022
Module: Mesa
Branch: main
Commit: 719b949575dabfddd56bedbffb7a188555401a31
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=719b949575dabfddd56bedbffb7a188555401a31
Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date: Tue Mar 8 16:45:55 2022 -0600
vulkan/cmd_queue: Generate enqueue entrypoints
Reviewed-by: Boris Brezillon <boris.brezillon at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15311>
---
src/vulkan/runtime/meson.build | 15 ++++++++++++++-
src/vulkan/runtime/vk_device.h | 6 ++++++
src/vulkan/util/vk_cmd_queue_gen.py | 28 ++++++++++++++++++++++++++++
3 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/src/vulkan/runtime/meson.build b/src/vulkan/runtime/meson.build
index b9c4ed759c1..b1fbef54deb 100644
--- a/src/vulkan/runtime/meson.build
+++ b/src/vulkan/runtime/meson.build
@@ -108,6 +108,18 @@ vk_cmd_queue = custom_target(
depend_files : vk_cmd_queue_gen_depend_files,
)
+vk_cmd_enqueue_entrypoints = custom_target(
+ 'vk_cmd_enqueue_entrypoints',
+ input : [vk_entrypoints_gen, vk_api_xml],
+ output : ['vk_cmd_enqueue_entrypoints.h', 'vk_cmd_enqueue_entrypoints.c'],
+ command : [
+ prog_python, '@INPUT0@', '--xml', '@INPUT1@', '--proto', '--weak',
+ '--out-h', '@OUTPUT0@', '--out-c', '@OUTPUT1@',
+ '--prefix', 'vk_cmd_enqueue',
+ ],
+ depend_files : vk_entrypoints_gen_depend_files,
+)
+
vk_dispatch_trampolines = custom_target(
'vk_dispatch_trampolines',
input : [vk_dispatch_trampolines_gen, vk_api_xml],
@@ -132,7 +144,8 @@ vk_physical_device_features = custom_target(
libvulkan_runtime = static_library(
'vulkan_runtime',
- [vulkan_runtime_files, vk_common_entrypoints, vk_cmd_queue,
+ [vulkan_runtime_files, vk_common_entrypoints,
+ vk_cmd_queue, vk_cmd_enqueue_entrypoints,
vk_dispatch_trampolines, vk_physical_device_features],
include_directories : [inc_include, inc_src, inc_gallium],
dependencies : vulkan_runtime_deps,
diff --git a/src/vulkan/runtime/vk_device.h b/src/vulkan/runtime/vk_device.h
index a74d4a06cc9..9dced009cc8 100644
--- a/src/vulkan/runtime/vk_device.h
+++ b/src/vulkan/runtime/vk_device.h
@@ -45,6 +45,12 @@ struct vk_device {
struct vk_device_dispatch_table dispatch_table;
+ /** Command dispatch table
+ *
+ * This is used for emulated secondary command buffer support.
+ */
+ const struct vk_device_dispatch_table *command_dispatch_table;
+
/* For VK_EXT_private_data */
uint32_t private_data_next_index;
diff --git a/src/vulkan/util/vk_cmd_queue_gen.py b/src/vulkan/util/vk_cmd_queue_gen.py
index 2911eae34a0..8e4312846ca 100644
--- a/src/vulkan/util/vk_cmd_queue_gen.py
+++ b/src/vulkan/util/vk_cmd_queue_gen.py
@@ -185,6 +185,8 @@ TEMPLATE_C = Template(COPYRIGHT + """
#include <vulkan/vulkan.h>
#include "vk_alloc.h"
+#include "vk_cmd_enqueue_entrypoints.h"
+#include "vk_command_buffer.h"
const char *vk_cmd_queue_type_names[] = {
% for c in commands:
@@ -272,6 +274,32 @@ vk_free_queue(struct vk_cmd_queue *queue)
}
}
+% for c in commands:
+% if c.name in manual_commands:
+/* TODO: Generate vk_cmd_enqueue_${c.name}() */
+<% continue %>
+% endif
+
+% if c.guard is not None:
+#ifdef ${c.guard}
+% endif
+<% assert c.return_type == 'void' %>
+VKAPI_ATTR void VKAPI_CALL
+vk_cmd_enqueue_${c.name}(${c.decl_params()})
+{
+ VK_FROM_HANDLE(vk_command_buffer, cmd_buffer, commandBuffer);
+
+% if len(c.params) == 1:
+ vk_enqueue_${to_underscore(c.name)}(&cmd_buffer->cmd_queue);
+% else:
+ vk_enqueue_${to_underscore(c.name)}(&cmd_buffer->cmd_queue,
+ ${c.call_params(1)});
+% endif
+}
+% if c.guard is not None:
+#endif // ${c.guard}
+% endif
+% endfor
""", output_encoding='utf-8')
def remove_prefix(text, prefix):
More information about the mesa-commit
mailing list