vulkan: Add a common vk_command_buffer 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 <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13000>
This commit is contained in:
Yevhenii Kolesnikov 2021-04-02 17:52:34 +03:00 committed by Marge Bot
parent 611d583e64
commit ef9c371f60
3 changed files with 103 additions and 0 deletions

View File

@ -52,6 +52,8 @@ files_vulkan_util = files(
'vk_alloc.c',
'vk_alloc.h',
'vk_cmd_copy.c',
'vk_command_buffer.c',
'vk_command_buffer.h',
'vk_debug_report.c',
'vk_debug_report.h',
'vk_deferred_operation.c',

View File

@ -0,0 +1,46 @@
/*
* 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_command_buffer.h"
VkResult
vk_command_buffer_init(struct vk_command_buffer *command_buffer,
struct vk_device *device)
{
memset(command_buffer, 0, sizeof(*command_buffer));
vk_object_base_init(device, &command_buffer->base,
VK_OBJECT_TYPE_COMMAND_BUFFER);
return VK_SUCCESS;
}
void
vk_command_buffer_reset(struct vk_command_buffer *command_buffer)
{
}
void
vk_command_buffer_finish(struct vk_command_buffer *command_buffer)
{
vk_object_base_finish(&command_buffer->base);
}

View File

@ -0,0 +1,55 @@
/*
* 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_COMMAND_BUFFER_H
#define VK_COMMAND_BUFFER_H
#include "vk_object.h"
#include "util/u_dynarray.h"
#ifdef __cplusplus
extern "C" {
#endif
struct vk_command_buffer {
struct vk_object_base base;
};
VK_DEFINE_HANDLE_CASTS(vk_command_buffer, base, VkCommandBuffer,
VK_OBJECT_TYPE_COMMAND_BUFFER)
VkResult MUST_CHECK
vk_command_buffer_init(struct vk_command_buffer *command_buffer,
struct vk_device *device);
void
vk_command_buffer_reset(struct vk_command_buffer *command_buffer);
void
vk_command_buffer_finish(struct vk_command_buffer *command_buffer);
#ifdef __cplusplus
}
#endif
#endif /* VK_COMMAND_BUFFER_H */