vulkan: use instance allocator for object_name in some objects

The allocator passed to VkDevice won't be available once it is destroyed
and thefore it cannot be used to allocate `object_name` for instance
level objects such as `VkInstance` or `VkPhysicalDevice` or else there
would be no way of deallocating it when those objects are destroyed.

Cc: mesa-stable
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Mark Collins <mark@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26085>
This commit is contained in:
antonino
2023-11-06 22:52:35 +01:00
committed by Marge Bot
parent fcd025c1ce
commit 2d49f834b2
6 changed files with 51 additions and 9 deletions

View File

@@ -57,6 +57,14 @@ struct vk_object_base {
*/
struct vk_device *device;
/** Pointer to the instance in which this object exists
*
* This is NULL for device level objects as it's main purpose is to make
* the instance allocator reachable for freeing data owned by instance
* level objects.
*/
struct vk_instance *instance;
/* True if this object is fully constructed and visible to the client */
bool client_visible;
@@ -77,6 +85,16 @@ void vk_object_base_init(struct vk_device *device,
struct vk_object_base *base,
VkObjectType obj_type);
/** Initialize a vk_base_object for an instance level object
*
* :param instance: |in| The vk_instance this object was created from
* :param base: |out| The vk_object_base to initialize
* :param obj_type: |in| The VkObjectType of the object being initialized
*/
void vk_object_base_instance_init(struct vk_instance *instance,
struct vk_object_base *base,
VkObjectType obj_type);
/** Tear down a vk_object_base
*
* :param base: |out| The vk_object_base being torn down