vk_object_base_finish(&device->base);
}
+void *
+vk_object_alloc(struct vk_device *device,
+ const VkAllocationCallbacks *alloc,
+ size_t size,
+ VkObjectType obj_type)
+{
+ void *ptr = vk_alloc2(&device->alloc, alloc, size, 8,
+ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+ if (ptr == NULL)
+ return NULL;
+
+ vk_object_base_init(device, (struct vk_object_base *)ptr, obj_type);
+
+ return ptr;
+}
+
+void *
+vk_object_zalloc(struct vk_device *device,
+ const VkAllocationCallbacks *alloc,
+ size_t size,
+ VkObjectType obj_type)
+{
+ void *ptr = vk_zalloc2(&device->alloc, alloc, size, 8,
+ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+ if (ptr == NULL)
+ return NULL;
+
+ vk_object_base_init(device, (struct vk_object_base *)ptr, obj_type);
+
+ return ptr;
+}
+
+void
+vk_object_free(struct vk_device *device,
+ const VkAllocationCallbacks *alloc,
+ void *data)
+{
+ vk_object_base_finish((struct vk_object_base *)data);
+ vk_free2(&device->alloc, alloc, data);
+}
+
VkResult
vk_private_data_slot_create(struct vk_device *device,
const VkPrivateDataSlotCreateInfoEXT* pCreateInfo,
#define VK_FROM_HANDLE(__driver_type, __name, __handle) \
struct __driver_type *__name = __driver_type ## _from_handle(__handle)
+/* Helpers for vk object (de)allocation and (de)initialization */
+void *
+vk_object_alloc(struct vk_device *device,
+ const VkAllocationCallbacks *alloc,
+ size_t size,
+ VkObjectType vk_obj_type);
+
+void *
+vk_object_zalloc(struct vk_device *device,
+ const VkAllocationCallbacks *alloc,
+ size_t size,
+ VkObjectType vk_obj_type);
+
+void
+vk_object_free(struct vk_device *device,
+ const VkAllocationCallbacks *alloc,
+ void *data);
+
struct vk_private_data_slot {
struct vk_object_base base;