venus: use common vk_command_pool
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34083>
This commit is contained in:
@@ -717,7 +717,7 @@ vn_CreateCommandPool(VkDevice device,
|
||||
if (!pool)
|
||||
return vn_error(dev->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
|
||||
|
||||
vn_object_base_init(&pool->base, VK_OBJECT_TYPE_COMMAND_POOL, &dev->base);
|
||||
vn_command_pool_base_init(&pool->base, &dev->base, pCreateInfo, alloc);
|
||||
|
||||
pool->allocator = *alloc;
|
||||
pool->device = dev;
|
||||
@@ -789,7 +789,7 @@ vn_DestroyCommandPool(VkDevice device,
|
||||
|
||||
vn_cached_storage_fini(&pool->storage);
|
||||
|
||||
vn_object_base_fini(&pool->base);
|
||||
vn_command_pool_base_fini(&pool->base);
|
||||
vk_free(alloc, pool);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#include "vn_cs.h"
|
||||
|
||||
struct vn_command_pool {
|
||||
struct vn_object_base base;
|
||||
struct vn_command_pool_base base;
|
||||
|
||||
VkAllocationCallbacks allocator;
|
||||
struct vn_device *device;
|
||||
@@ -45,7 +45,7 @@ struct vn_command_pool {
|
||||
struct vn_cached_storage storage;
|
||||
};
|
||||
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_command_pool,
|
||||
base.vk,
|
||||
base.vk.base,
|
||||
VkCommandPool,
|
||||
VK_OBJECT_TYPE_COMMAND_POOL)
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "util/u_math.h"
|
||||
#include "util/xmlconfig.h"
|
||||
#include "vk_alloc.h"
|
||||
#include "vk_command_pool.h"
|
||||
#include "vk_debug_report.h"
|
||||
#include "vk_device.h"
|
||||
#include "vk_device_memory.h"
|
||||
@@ -159,6 +160,12 @@ struct vn_queue_base {
|
||||
vn_object_id id;
|
||||
};
|
||||
|
||||
/* base class of vn_command_pool */
|
||||
struct vn_command_pool_base {
|
||||
struct vk_command_pool vk;
|
||||
vn_object_id id;
|
||||
};
|
||||
|
||||
/* base class of vn_device_memory */
|
||||
struct vn_device_memory_base {
|
||||
struct vk_device_memory vk;
|
||||
@@ -486,6 +493,24 @@ vn_queue_base_fini(struct vn_queue_base *queue)
|
||||
vk_queue_finish(&queue->vk);
|
||||
}
|
||||
|
||||
static inline VkResult
|
||||
vn_command_pool_base_init(struct vn_command_pool_base *cmd_pool,
|
||||
struct vn_device_base *dev,
|
||||
const VkCommandPoolCreateInfo *info,
|
||||
const VkAllocationCallbacks *alloc)
|
||||
{
|
||||
VkResult result =
|
||||
vk_command_pool_init(&dev->vk, &cmd_pool->vk, info, alloc);
|
||||
cmd_pool->id = vn_get_next_obj_id();
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline void
|
||||
vn_command_pool_base_fini(struct vn_command_pool_base *cmd_pool)
|
||||
{
|
||||
vk_command_pool_finish(&cmd_pool->vk);
|
||||
}
|
||||
|
||||
static inline void
|
||||
vn_object_base_init(struct vn_object_base *obj,
|
||||
VkObjectType type,
|
||||
@@ -518,6 +543,9 @@ vn_object_set_id(void *obj, vn_object_id id, VkObjectType type)
|
||||
case VK_OBJECT_TYPE_QUEUE:
|
||||
((struct vn_queue_base *)obj)->id = id;
|
||||
break;
|
||||
case VK_OBJECT_TYPE_COMMAND_POOL:
|
||||
((struct vn_command_pool_base *)obj)->id = id;
|
||||
break;
|
||||
case VK_OBJECT_TYPE_DEVICE_MEMORY:
|
||||
((struct vn_device_memory_base *)obj)->id = id;
|
||||
break;
|
||||
@@ -543,6 +571,8 @@ vn_object_get_id(const void *obj, VkObjectType type)
|
||||
return ((struct vn_device_base *)obj)->id;
|
||||
case VK_OBJECT_TYPE_QUEUE:
|
||||
return ((struct vn_queue_base *)obj)->id;
|
||||
case VK_OBJECT_TYPE_COMMAND_POOL:
|
||||
return ((struct vn_command_pool_base *)obj)->id;
|
||||
case VK_OBJECT_TYPE_DEVICE_MEMORY:
|
||||
return ((struct vn_device_memory_base *)obj)->id;
|
||||
case VK_OBJECT_TYPE_IMAGE:
|
||||
|
||||
Reference in New Issue
Block a user