Module: Mesa Branch: main Commit: cff01303b5c804d3651e98035a31ba4915a6b029 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cff01303b5c804d3651e98035a31ba4915a6b029
Author: Yevhenii Kolesnikov <[email protected]> Date: Fri Apr 2 17:55:14 2021 +0300 vulkan: Add a common vk_queue structure This can be used e.g. for storing debug labels for the common implementation of VK_EXT_debug_utils. Signed-off-by: Yevhenii Kolesnikov <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13000> --- src/vulkan/util/meson.build | 2 ++ src/vulkan/util/vk_queue.c | 39 +++++++++++++++++++++++++++++++++++ src/vulkan/util/vk_queue.h | 50 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+) diff --git a/src/vulkan/util/meson.build b/src/vulkan/util/meson.build index 6390fc9050f..ecd2cc8b452 100644 --- a/src/vulkan/util/meson.build +++ b/src/vulkan/util/meson.build @@ -71,6 +71,8 @@ files_vulkan_util = files( 'vk_object.h', 'vk_physical_device.c', 'vk_physical_device.h', + 'vk_queue.c', + 'vk_queue.h', 'vk_render_pass.c', 'vk_shader_module.c', 'vk_shader_module.h', diff --git a/src/vulkan/util/vk_queue.c b/src/vulkan/util/vk_queue.c new file mode 100644 index 00000000000..68000bfe7e5 --- /dev/null +++ b/src/vulkan/util/vk_queue.c @@ -0,0 +1,39 @@ +/* + * Copyright © 2021 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "vk_queue.h" + +VkResult +vk_queue_init(struct vk_queue *queue, struct vk_device *device) +{ + memset(queue, 0, sizeof(*queue)); + vk_object_base_init(device, &queue->base, VK_OBJECT_TYPE_QUEUE); + + return VK_SUCCESS; +} + +void +vk_queue_finish(struct vk_queue *queue) +{ + vk_object_base_finish(&queue->base); +} diff --git a/src/vulkan/util/vk_queue.h b/src/vulkan/util/vk_queue.h new file mode 100644 index 00000000000..a5df99c6bd9 --- /dev/null +++ b/src/vulkan/util/vk_queue.h @@ -0,0 +1,50 @@ +/* + * Copyright © 2021 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#ifndef VK_QUEUE_H +#define VK_QUEUE_H + +#include "vk_object.h" +#include "util/u_dynarray.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct vk_queue { + struct vk_object_base base; +}; + +VK_DEFINE_HANDLE_CASTS(vk_queue, base, VkQueue, VK_OBJECT_TYPE_QUEUE) + +VkResult MUST_CHECK +vk_queue_init(struct vk_queue *queue, struct vk_device *device); + +void +vk_queue_finish(struct vk_queue *queue); + +#ifdef __cplusplus +} +#endif + +#endif /* VK_QUEUE_H */
