venus: rename common vk object base member to vk

This way we avoid the confusing base.base or even base.base.base when
venus uses common objects. This also aligns with the naming of the other
drivers.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34083>
This commit is contained in:
Yiwei Zhang 2025-03-14 16:14:01 -07:00 committed by Marge Bot
parent 2ee3bef252
commit dfcad90240
31 changed files with 177 additions and 179 deletions

View file

@ -18,7 +18,7 @@ vn_CreateAccelerationStructureKHR(
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
struct vn_acceleration_structure *accel =
vk_zalloc(alloc, sizeof(*accel), VN_DEFAULT_ALIGN,
@ -49,7 +49,7 @@ vn_DestroyAccelerationStructureKHR(
struct vn_acceleration_structure *accel =
vn_acceleration_structure_from_handle(accelerationStructure);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!accel)
return;

View file

@ -12,7 +12,7 @@ struct vn_acceleration_structure {
struct vn_object_base base;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_acceleration_structure,
base.base,
base.vk,
VkAccelerationStructureKHR,
VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR)

View file

@ -661,8 +661,7 @@ vn_android_get_wsi_memory_from_bind_info(
struct vn_image *img = vn_image_from_handle(bind_info->image);
VkResult result = vn_android_image_from_anb_internal(
dev, &img->deferred_info->create, anb_info, &dev->base.base.alloc,
&img);
dev, &img->deferred_info->create, anb_info, &dev->base.vk.alloc, &img);
if (result != VK_SUCCESS)
return NULL;
@ -928,7 +927,7 @@ vn_android_device_import_ahb(
struct vn_device_memory *mem,
const struct VkMemoryDedicatedAllocateInfo *dedicated_info)
{
const struct vk_device_memory *mem_vk = &mem->base.base;
const struct vk_device_memory *mem_vk = &mem->base.vk;
const native_handle_t *handle = NULL;
int dma_buf_fd = -1;
int dup_fd = -1;

View file

@ -64,8 +64,8 @@ vn_buffer_get_max_buffer_size(struct vn_physical_device *physical_dev)
* - mali: UINT32_MAX
*/
static const uint64_t safe_max_buffer_size = 1ULL << 30;
return physical_dev->base.base.supported_features.maintenance4
? physical_dev->base.base.properties.maxBufferSize
return physical_dev->base.vk.supported_features.maintenance4
? physical_dev->base.vk.properties.maxBufferSize
: safe_max_buffer_size;
}
@ -363,7 +363,7 @@ vn_CreateBuffer(VkDevice device,
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
const VkExternalMemoryHandleTypeFlagBits renderer_handle_type =
dev->physical_device->external_memory.renderer_handle_type;
@ -408,7 +408,7 @@ vn_DestroyBuffer(VkDevice device,
struct vn_device *dev = vn_device_from_handle(device);
struct vn_buffer *buf = vn_buffer_from_handle(buffer);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!buf)
return;
@ -478,7 +478,7 @@ vn_CreateBufferView(VkDevice device,
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
struct vn_buffer_view *view =
vk_zalloc(alloc, sizeof(*view), VN_DEFAULT_ALIGN,
@ -505,7 +505,7 @@ vn_DestroyBufferView(VkDevice device,
struct vn_device *dev = vn_device_from_handle(device);
struct vn_buffer_view *view = vn_buffer_view_from_handle(bufferView);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!view)
return;

View file

@ -50,7 +50,7 @@ struct vn_buffer {
struct vn_buffer_memory_requirements requirements;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_buffer,
base.base,
base.vk,
VkBuffer,
VK_OBJECT_TYPE_BUFFER)
@ -58,7 +58,7 @@ struct vn_buffer_view {
struct vn_object_base base;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_buffer_view,
base.base,
base.vk,
VkBufferView,
VK_OBJECT_TYPE_BUFFER_VIEW)

View file

@ -243,7 +243,7 @@ vn_cmd_fix_image_memory_barrier_common(const struct vn_image *img,
result.availability_op_needed = false;
result.external_acquire_unmodified = true;
if (img->base.base.sharing_mode == VK_SHARING_MODE_CONCURRENT) {
if (img->base.vk.sharing_mode == VK_SHARING_MODE_CONCURRENT) {
*src_qfi = VK_QUEUE_FAMILY_FOREIGN_EXT;
*dst_qfi = VK_QUEUE_FAMILY_IGNORED;
} else if (*dst_qfi == *src_qfi || *dst_qfi == cmd_pool_qfi) {
@ -263,7 +263,7 @@ vn_cmd_fix_image_memory_barrier_common(const struct vn_image *img,
result.visibility_op_needed = false;
if (img->base.base.sharing_mode == VK_SHARING_MODE_CONCURRENT) {
if (img->base.vk.sharing_mode == VK_SHARING_MODE_CONCURRENT) {
*src_qfi = VK_QUEUE_FAMILY_IGNORED;
*dst_qfi = VK_QUEUE_FAMILY_FOREIGN_EXT;
} else if (*src_qfi == *dst_qfi || *src_qfi == cmd_pool_qfi) {
@ -709,7 +709,7 @@ vn_CreateCommandPool(VkDevice device,
VN_TRACE_FUNC();
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
struct vn_command_pool *pool =
vk_zalloc(alloc, sizeof(*pool), VN_DEFAULT_ALIGN,

View file

@ -45,7 +45,7 @@ struct vn_command_pool {
struct vn_cached_storage storage;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_command_pool,
base.base,
base.vk,
VkCommandPool,
VK_OBJECT_TYPE_COMMAND_POOL)
@ -95,7 +95,7 @@ struct vn_command_buffer {
struct list_head head;
};
VK_DEFINE_HANDLE_CASTS(vn_command_buffer,
base.base,
base.vk,
VkCommandBuffer,
VK_OBJECT_TYPE_COMMAND_BUFFER)

View file

@ -137,43 +137,43 @@ typedef uint64_t vn_object_id;
/* base class of vn_instance */
struct vn_instance_base {
struct vk_instance base;
struct vk_instance vk;
vn_object_id id;
};
/* base class of vn_physical_device */
struct vn_physical_device_base {
struct vk_physical_device base;
struct vk_physical_device vk;
vn_object_id id;
};
/* base class of vn_device */
struct vn_device_base {
struct vk_device base;
struct vk_device vk;
vn_object_id id;
};
/* base class of vn_queue */
struct vn_queue_base {
struct vk_queue base;
struct vk_queue vk;
vn_object_id id;
};
/* base class of vn_device_memory */
struct vn_device_memory_base {
struct vk_device_memory base;
struct vk_device_memory vk;
vn_object_id id;
};
/* base class of vn_image */
struct vn_image_base {
struct vk_image base;
struct vk_image vk;
vn_object_id id;
};
/* base class of other driver objects */
struct vn_object_base {
struct vk_object_base base;
struct vk_object_base vk;
vn_object_id id;
};
@ -417,7 +417,7 @@ vn_instance_base_init(
const VkInstanceCreateInfo *info,
const VkAllocationCallbacks *alloc)
{
VkResult result = vk_instance_init(&instance->base, supported_extensions,
VkResult result = vk_instance_init(&instance->vk, supported_extensions,
dispatch_table, info, alloc);
instance->id = vn_get_next_obj_id();
return result;
@ -426,7 +426,7 @@ vn_instance_base_init(
static inline void
vn_instance_base_fini(struct vn_instance_base *instance)
{
vk_instance_finish(&instance->base);
vk_instance_finish(&instance->vk);
}
static inline VkResult
@ -436,9 +436,9 @@ vn_physical_device_base_init(
const struct vk_device_extension_table *supported_extensions,
const struct vk_physical_device_dispatch_table *dispatch_table)
{
VkResult result = vk_physical_device_init(
&physical_dev->base, &instance->base, supported_extensions, NULL, NULL,
dispatch_table);
VkResult result = vk_physical_device_init(&physical_dev->vk, &instance->vk,
supported_extensions, NULL, NULL,
dispatch_table);
physical_dev->id = vn_get_next_obj_id();
return result;
}
@ -446,7 +446,7 @@ vn_physical_device_base_init(
static inline void
vn_physical_device_base_fini(struct vn_physical_device_base *physical_dev)
{
vk_physical_device_finish(&physical_dev->base);
vk_physical_device_finish(&physical_dev->vk);
}
static inline VkResult
@ -456,7 +456,7 @@ vn_device_base_init(struct vn_device_base *dev,
const VkDeviceCreateInfo *info,
const VkAllocationCallbacks *alloc)
{
VkResult result = vk_device_init(&dev->base, &physical_dev->base,
VkResult result = vk_device_init(&dev->vk, &physical_dev->vk,
dispatch_table, info, alloc);
dev->id = vn_get_next_obj_id();
return result;
@ -465,7 +465,7 @@ vn_device_base_init(struct vn_device_base *dev,
static inline void
vn_device_base_fini(struct vn_device_base *dev)
{
vk_device_finish(&dev->base);
vk_device_finish(&dev->vk);
}
static inline VkResult
@ -475,7 +475,7 @@ vn_queue_base_init(struct vn_queue_base *queue,
uint32_t queue_index)
{
VkResult result =
vk_queue_init(&queue->base, &dev->base, queue_info, queue_index);
vk_queue_init(&queue->vk, &dev->vk, queue_info, queue_index);
queue->id = vn_get_next_obj_id();
return result;
}
@ -483,7 +483,7 @@ vn_queue_base_init(struct vn_queue_base *queue,
static inline void
vn_queue_base_fini(struct vn_queue_base *queue)
{
vk_queue_finish(&queue->base);
vk_queue_finish(&queue->vk);
}
static inline void
@ -491,14 +491,14 @@ vn_object_base_init(struct vn_object_base *obj,
VkObjectType type,
struct vn_device_base *dev)
{
vk_object_base_init(&dev->base, &obj->base, type);
vk_object_base_init(&dev->vk, &obj->vk, type);
obj->id = vn_get_next_obj_id();
}
static inline void
vn_object_base_fini(struct vn_object_base *obj)
{
vk_object_base_finish(&obj->base);
vk_object_base_finish(&obj->vk);
}
static inline void

View file

@ -25,7 +25,7 @@ vn_descriptor_set_layout_destroy(struct vn_device *dev,
VkDevice dev_handle = vn_device_to_handle(dev);
VkDescriptorSetLayout layout_handle =
vn_descriptor_set_layout_to_handle(layout);
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
const VkAllocationCallbacks *alloc = &dev->base.vk.alloc;
vn_async_vkDestroyDescriptorSetLayout(dev->primary_ring, dev_handle,
layout_handle, NULL);
@ -202,7 +202,7 @@ vn_CreateDescriptorSetLayout(
{
struct vn_device *dev = vn_device_from_handle(device);
/* ignore pAllocator as the layout is reference-counted */
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
const VkAllocationCallbacks *alloc = &dev->base.vk.alloc;
STACK_ARRAY(VkDescriptorSetLayoutBinding, bindings,
pCreateInfo->bindingCount);
@ -283,7 +283,7 @@ vn_CreateDescriptorPool(VkDevice device,
VN_TRACE_FUNC();
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
const VkDescriptorPoolInlineUniformBlockCreateInfo *iub_info =
vk_find_struct_const(pCreateInfo->pNext,
@ -969,7 +969,7 @@ vn_CreateDescriptorUpdateTemplate(
VN_TRACE_FUNC();
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
const size_t templ_size =
offsetof(struct vn_descriptor_update_template,
@ -1010,7 +1010,7 @@ vn_DestroyDescriptorUpdateTemplate(
struct vn_descriptor_update_template *templ =
vn_descriptor_update_template_from_handle(descriptorUpdateTemplate);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!templ)
return;

View file

@ -53,7 +53,7 @@ struct vn_descriptor_set_layout {
struct vn_descriptor_set_layout_binding bindings[];
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_descriptor_set_layout,
base.base,
base.vk,
VkDescriptorSetLayout,
VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT)
@ -107,7 +107,7 @@ struct vn_descriptor_pool {
struct vn_descriptor_pool_state_mutable *mutable_states;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_descriptor_pool,
base.base,
base.vk,
VkDescriptorPool,
VK_OBJECT_TYPE_DESCRIPTOR_POOL)
@ -120,7 +120,7 @@ struct vn_descriptor_set {
struct list_head head;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_descriptor_set,
base.base,
base.vk,
VkDescriptorSet,
VK_OBJECT_TYPE_DESCRIPTOR_SET)
@ -141,7 +141,7 @@ struct vn_descriptor_update_template {
VkDescriptorUpdateTemplateEntry entries[];
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_descriptor_update_template,
base.base,
base.vk,
VkDescriptorUpdateTemplate,
VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE)

View file

@ -25,7 +25,7 @@
static void
vn_queue_fini(struct vn_queue *queue)
{
VkDevice dev_handle = vk_device_to_handle(queue->base.base.base.device);
VkDevice dev_handle = vk_device_to_handle(queue->base.vk.base.device);
if (queue->wait_fence != VK_NULL_HANDLE) {
vn_DestroyFence(dev_handle, queue->wait_fence, NULL);
@ -49,7 +49,7 @@ vn_queue_init(struct vn_device *dev,
if (result != VK_SUCCESS)
return result;
vn_cached_storage_init(&queue->storage, &dev->base.base.alloc);
vn_cached_storage_init(&queue->storage, &dev->base.vk.alloc);
if (dev->physical_device->emulate_second_queue ==
queue_info->queueFamilyIndex &&
@ -91,7 +91,7 @@ static VkResult
vn_device_init_queues(struct vn_device *dev,
const VkDeviceCreateInfo *create_info)
{
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
const VkAllocationCallbacks *alloc = &dev->base.vk.alloc;
uint32_t count = 0;
for (uint32_t i = 0; i < create_info->queueCreateInfoCount; i++)
@ -135,7 +135,7 @@ static bool
vn_device_queue_family_init(struct vn_device *dev,
const VkDeviceCreateInfo *create_info)
{
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
const VkAllocationCallbacks *alloc = &dev->base.vk.alloc;
uint32_t *queue_families = NULL;
uint32_t count = 0;
@ -169,7 +169,7 @@ vn_device_queue_family_init(struct vn_device *dev,
static inline void
vn_device_queue_family_fini(struct vn_device *dev)
{
vk_free(&dev->base.base.alloc, dev->queue_families);
vk_free(&dev->base.vk.alloc, dev->queue_families);
}
static bool
@ -224,7 +224,7 @@ vn_device_fix_create_info(const struct vn_device *dev,
{
const struct vn_physical_device *physical_dev = dev->physical_device;
const struct vk_device_extension_table *app_exts =
&dev->base.base.enabled_extensions;
&dev->base.vk.enabled_extensions;
/* extra_exts and block_exts must not overlap */
const char *extra_exts[16];
const char *block_exts[16];
@ -364,7 +364,7 @@ vn_device_feedback_pool_init(struct vn_device *dev)
* events, which well covers the common scenarios. Pool can grow anyway.
*/
static const uint32_t pool_size = 4096;
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
const VkAllocationCallbacks *alloc = &dev->base.vk.alloc;
if (VN_PERF(NO_EVENT_FEEDBACK) && VN_PERF(NO_FENCE_FEEDBACK) &&
VN_PERF(NO_SEMAPHORE_FEEDBACK))
@ -396,7 +396,7 @@ vn_device_update_shader_cache_id(struct vn_device *dev)
*/
#if !DETECT_OS_ANDROID && defined(ENABLE_SHADER_CACHE)
const uint8_t *device_uuid =
dev->physical_device->base.base.properties.pipelineCacheUUID;
dev->physical_device->base.vk.properties.pipelineCacheUUID;
char uuid[VK_UUID_SIZE * 2 + 1];
mesa_bytes_to_hex(uuid, device_uuid, VK_UUID_SIZE);
@ -534,7 +534,7 @@ vn_CreateDevice(VkPhysicalDevice physicalDevice,
vn_physical_device_from_handle(physicalDevice);
struct vn_instance *instance = physical_dev->instance;
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &instance->base.base.alloc;
pAllocator ? pAllocator : &instance->base.vk.alloc;
struct vn_device *dev;
VkResult result;
@ -563,8 +563,8 @@ vn_CreateDevice(VkPhysicalDevice physicalDevice,
}
if (VN_DEBUG(LOG_CTX_INFO)) {
vn_log(instance, "%s", physical_dev->base.base.properties.deviceName);
vn_log(instance, "%s", physical_dev->base.base.properties.driverInfo);
vn_log(instance, "%s", physical_dev->base.vk.properties.deviceName);
vn_log(instance, "%s", physical_dev->base.vk.properties.driverInfo);
}
vn_tls_set_async_pipeline_create();
@ -580,7 +580,7 @@ vn_DestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator)
VN_TRACE_FUNC();
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!dev)
return;
@ -618,7 +618,7 @@ PFN_vkVoidFunction
vn_GetDeviceProcAddr(VkDevice device, const char *pName)
{
struct vn_device *dev = vn_device_from_handle(device);
return vk_device_get_proc_addr(&dev->base.base, pName);
return vk_device_get_proc_addr(&dev->base.vk, pName);
}
void

View file

@ -46,7 +46,7 @@ struct vn_device {
struct vn_image_reqs_cache image_reqs_cache;
};
VK_DEFINE_HANDLE_CASTS(vn_device,
base.base.base,
base.vk.base,
VkDevice,
VK_OBJECT_TYPE_DEVICE)

View file

@ -89,7 +89,7 @@ vn_device_memory_bo_init(struct vn_device *dev, struct vn_device_memory *mem)
if (result != VK_SUCCESS)
return result;
const struct vk_device_memory *mem_vk = &mem->base.base;
const struct vk_device_memory *mem_vk = &mem->base.vk;
const VkMemoryType *mem_type = &dev->physical_device->memory_properties
.memoryTypes[mem_vk->memory_type_index];
return vn_renderer_bo_create_from_device_memory(
@ -155,7 +155,7 @@ vn_device_memory_alloc_guest_vram(struct vn_device *dev,
struct vn_device_memory *mem,
const VkMemoryAllocateInfo *alloc_info)
{
const struct vk_device_memory *mem_vk = &mem->base.base;
const struct vk_device_memory *mem_vk = &mem->base.vk;
const VkMemoryType *mem_type = &dev->physical_device->memory_properties
.memoryTypes[mem_vk->memory_type_index];
VkMemoryPropertyFlags flags = mem_type->propertyFlags;
@ -288,7 +288,7 @@ vn_device_memory_alloc(struct vn_device *dev,
struct vn_device_memory *mem,
const VkMemoryAllocateInfo *alloc_info)
{
struct vk_device_memory *mem_vk = &mem->base.base;
struct vk_device_memory *mem_vk = &mem->base.vk;
const VkMemoryType *mem_type = &dev->physical_device->memory_properties
.memoryTypes[mem_vk->memory_type_index];
@ -324,12 +324,12 @@ vn_device_memory_emit_report(struct vn_device *dev,
bool is_alloc,
VkResult result)
{
struct vk_device *dev_vk = &dev->base.base;
struct vk_device *dev_vk = &dev->base.vk;
if (likely(!dev_vk->memory_reports))
return;
const struct vk_device_memory *mem_vk = &mem->base.base;
const struct vk_device_memory *mem_vk = &mem->base.vk;
VkDeviceMemoryReportEventTypeEXT type;
if (result != VK_SUCCESS) {
type = VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_ALLOCATION_FAILED_EXT;
@ -377,14 +377,14 @@ vn_AllocateMemory(VkDevice device,
}
struct vn_device_memory *mem = vk_device_memory_create(
&dev->base.base, pAllocateInfo, pAllocator, sizeof(*mem));
&dev->base.vk, pAllocateInfo, pAllocator, sizeof(*mem));
if (!mem)
return vn_error(dev->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
vn_object_set_id(mem, vn_get_next_obj_id(), VK_OBJECT_TYPE_DEVICE_MEMORY);
VkResult result;
if (mem->base.base.ahardware_buffer) {
if (mem->base.vk.ahardware_buffer) {
result = vn_android_device_import_ahb(dev, mem, dedicated_info);
} else if (import_fd_info) {
result = vn_device_memory_import_dma_buf(dev, mem, pAllocateInfo, false,
@ -396,7 +396,7 @@ vn_AllocateMemory(VkDevice device,
vn_device_memory_emit_report(dev, mem, /* is_alloc */ true, result);
if (result != VK_SUCCESS) {
vk_device_memory_destroy(&dev->base.base, pAllocator, &mem->base.base);
vk_device_memory_destroy(&dev->base.vk, pAllocator, &mem->base.vk);
return vn_error(dev->instance, result);
}
@ -424,7 +424,7 @@ vn_FreeMemory(VkDevice device,
vn_ring_wait_roundtrip(dev->primary_ring, mem->bo_roundtrip_seqno);
vn_device_memory_free_simple(dev, mem);
vk_device_memory_destroy(&dev->base.base, pAllocator, &mem->base.base);
vk_device_memory_destroy(&dev->base.vk, pAllocator, &mem->base.vk);
}
uint64_t
@ -447,7 +447,7 @@ vn_MapMemory2(VkDevice device,
vn_device_memory_from_handle(pMemoryMapInfo->memory);
const VkDeviceSize offset = pMemoryMapInfo->offset;
const VkDeviceSize size = pMemoryMapInfo->size;
const struct vk_device_memory *mem_vk = &mem->base.base;
const struct vk_device_memory *mem_vk = &mem->base.vk;
const bool need_bo = !mem->base_bo;
void *ptr = NULL;
VkResult result;

View file

@ -50,7 +50,7 @@ struct vn_device_memory {
VkDeviceSize map_end;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_device_memory,
base.base.base,
base.vk.base,
VkDeviceMemory,
VK_OBJECT_TYPE_DEVICE_MEMORY)

View file

@ -521,7 +521,7 @@ struct vn_semaphore_feedback_cmd *
vn_semaphore_feedback_cmd_alloc(struct vn_device *dev,
struct vn_feedback_slot *dst_slot)
{
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
const VkAllocationCallbacks *alloc = &dev->base.vk.alloc;
struct vn_semaphore_feedback_cmd *sfb_cmd;
VkCommandBuffer *cmd_handles;
@ -565,7 +565,7 @@ void
vn_semaphore_feedback_cmd_free(struct vn_device *dev,
struct vn_semaphore_feedback_cmd *sfb_cmd)
{
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
const VkAllocationCallbacks *alloc = &dev->base.vk.alloc;
for (uint32_t i = 0; i < dev->queue_family_count; i++) {
vn_feedback_cmd_free(vn_device_to_handle(dev), &dev->fb_cmd_pools[i],
@ -798,7 +798,7 @@ vn_feedback_cmd_free(VkDevice dev_handle,
VkResult
vn_feedback_cmd_pools_init(struct vn_device *dev)
{
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
const VkAllocationCallbacks *alloc = &dev->base.vk.alloc;
VkDevice dev_handle = vn_device_to_handle(dev);
struct vn_feedback_cmd_pool *fb_cmd_pools;
VkCommandPoolCreateInfo info = {
@ -848,7 +848,7 @@ vn_feedback_cmd_pools_init(struct vn_device *dev)
void
vn_feedback_cmd_pools_fini(struct vn_device *dev)
{
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
const VkAllocationCallbacks *alloc = &dev->base.vk.alloc;
VkDevice dev_handle = vn_device_to_handle(dev);
if (!dev->fb_cmd_pools)

View file

@ -200,7 +200,7 @@ vn_image_reqs_cache_init(struct vn_device *dev)
void
vn_image_reqs_cache_fini(struct vn_device *dev)
{
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
const VkAllocationCallbacks *alloc = &dev->base.vk.alloc;
struct vn_image_reqs_cache *cache = &dev->image_reqs_cache;
if (!cache->ht)
@ -277,7 +277,7 @@ vn_image_store_reqs_in_cache(struct vn_device *dev,
uint32_t plane_count,
struct vn_image_memory_requirements *requirements)
{
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
const VkAllocationCallbacks *alloc = &dev->base.vk.alloc;
struct vn_image_reqs_cache *cache = &dev->image_reqs_cache;
struct vn_image_reqs_cache_entry *cache_entry;
@ -503,7 +503,7 @@ vn_image_create(struct vn_device *dev,
struct vn_image **out_img)
{
struct vn_image *img =
vk_image_create(&dev->base.base, create_info, alloc, sizeof(*img));
vk_image_create(&dev->base.vk, create_info, alloc, sizeof(*img));
if (!img)
return VK_ERROR_OUT_OF_HOST_MEMORY;
@ -511,7 +511,7 @@ vn_image_create(struct vn_device *dev,
VkResult result = vn_image_init(dev, create_info, img);
if (result != VK_SUCCESS) {
vk_image_destroy(&dev->base.base, alloc, &img->base.base);
vk_image_destroy(&dev->base.vk, alloc, &img->base.vk);
return result;
}
@ -537,7 +537,7 @@ vn_image_create_deferred(struct vn_device *dev,
struct vn_image **out_img)
{
struct vn_image *img =
vk_image_create(&dev->base.base, create_info, alloc, sizeof(*img));
vk_image_create(&dev->base.vk, create_info, alloc, sizeof(*img));
if (!img)
return VK_ERROR_OUT_OF_HOST_MEMORY;
@ -545,7 +545,7 @@ vn_image_create_deferred(struct vn_device *dev,
VkResult result = vn_image_deferred_info_init(img, create_info, alloc);
if (result != VK_SUCCESS) {
vk_image_destroy(&dev->base.base, alloc, &img->base.base);
vk_image_destroy(&dev->base.vk, alloc, &img->base.vk);
return result;
}
@ -622,7 +622,7 @@ vn_CreateImage(VkDevice device,
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
const VkExternalMemoryHandleTypeFlagBits renderer_handle_type =
dev->physical_device->external_memory.renderer_handle_type;
struct vn_image *img;
@ -714,7 +714,7 @@ vn_DestroyImage(VkDevice device,
struct vn_device *dev = vn_device_from_handle(device);
struct vn_image *img = vn_image_from_handle(image);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!img)
return;
@ -730,7 +730,7 @@ vn_DestroyImage(VkDevice device,
vn_image_deferred_info_fini(img, alloc);
vk_image_destroy(&dev->base.base, alloc, &img->base.base);
vk_image_destroy(&dev->base.vk, alloc, &img->base.vk);
}
void
@ -918,7 +918,7 @@ vn_CreateImageView(VkDevice device,
struct vn_device *dev = vn_device_from_handle(device);
struct vn_image *img = vn_image_from_handle(pCreateInfo->image);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
VkImageViewCreateInfo local_info;
if (img->deferred_info && img->deferred_info->from_external_format) {
@ -957,7 +957,7 @@ vn_DestroyImageView(VkDevice device,
struct vn_device *dev = vn_device_from_handle(device);
struct vn_image_view *view = vn_image_view_from_handle(imageView);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!view)
return;
@ -978,7 +978,7 @@ vn_CreateSampler(VkDevice device,
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
struct vn_sampler *sampler =
vk_zalloc(alloc, sizeof(*sampler), VN_DEFAULT_ALIGN,
@ -1005,7 +1005,7 @@ vn_DestroySampler(VkDevice device,
struct vn_device *dev = vn_device_from_handle(device);
struct vn_sampler *sampler = vn_sampler_from_handle(_sampler);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!sampler)
return;
@ -1027,7 +1027,7 @@ vn_CreateSamplerYcbcrConversion(
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
const VkExternalFormatANDROID *ext_info =
vk_find_struct_const(pCreateInfo->pNext, EXTERNAL_FORMAT_ANDROID);
@ -1075,7 +1075,7 @@ vn_DestroySamplerYcbcrConversion(VkDevice device,
struct vn_sampler_ycbcr_conversion *conv =
vn_sampler_ycbcr_conversion_from_handle(ycbcrConversion);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!conv)
return;

View file

@ -84,7 +84,7 @@ struct vn_image {
} wsi;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_image,
base.base.base,
base.vk.base,
VkImage,
VK_OBJECT_TYPE_IMAGE)
@ -94,7 +94,7 @@ struct vn_image_view {
const struct vn_image *image;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_image_view,
base.base,
base.vk,
VkImageView,
VK_OBJECT_TYPE_IMAGE_VIEW)
@ -102,7 +102,7 @@ struct vn_sampler {
struct vn_object_base base;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_sampler,
base.base,
base.vk,
VkSampler,
VK_OBJECT_TYPE_SAMPLER)
@ -110,7 +110,7 @@ struct vn_sampler_ycbcr_conversion {
struct vn_object_base base;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_sampler_ycbcr_conversion,
base.base,
base.vk,
VkSamplerYcbcrConversion,
VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION)

View file

@ -113,7 +113,7 @@ vn_instance_init_renderer_versions(struct vn_instance *instance)
/* request at least VN_MIN_RENDERER_VERSION internally */
instance->renderer_api_version =
MAX2(instance->base.base.app_info.api_version, VN_MIN_RENDERER_VERSION);
MAX2(instance->base.vk.app_info.api_version, VN_MIN_RENDERER_VERSION);
/* instance version for internal use is capped */
instance_version = MIN3(instance_version, instance->renderer_api_version,
@ -167,7 +167,7 @@ vn_instance_init_ring(struct vn_instance *instance)
static VkResult
vn_instance_init_renderer(struct vn_instance *instance)
{
const VkAllocationCallbacks *alloc = &instance->base.base.alloc;
const VkAllocationCallbacks *alloc = &instance->base.vk.alloc;
VkResult result = vn_renderer_create(instance, alloc, &instance->renderer);
if (result != VK_SUCCESS)
@ -296,8 +296,7 @@ vn_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
mtx_init(&instance->physical_device.mutex, mtx_plain);
mtx_init(&instance->ring_idx_mutex, mtx_plain);
if (!vn_icd_supports_api_version(
instance->base.base.app_info.api_version)) {
if (!vn_icd_supports_api_version(instance->base.vk.app_info.api_version)) {
result = VK_ERROR_INCOMPATIBLE_DRIVER;
goto out_mtx_destroy;
}
@ -337,7 +336,7 @@ vn_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
pCreateInfo = &local_create_info;
VkApplicationInfo local_app_info;
if (instance->base.base.app_info.api_version <
if (instance->base.vk.app_info.api_version <
instance->renderer_api_version) {
if (pCreateInfo->pApplicationInfo) {
local_app_info = *pCreateInfo->pApplicationInfo;
@ -360,10 +359,10 @@ vn_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
ARRAY_SIZE(vn_dri_options));
driParseConfigFiles(&instance->dri_options,
&instance->available_dri_options, 0, "venus", NULL,
NULL, instance->base.base.app_info.app_name,
instance->base.base.app_info.app_version,
instance->base.base.app_info.engine_name,
instance->base.base.app_info.engine_version);
NULL, instance->base.vk.app_info.app_name,
instance->base.vk.app_info.app_version,
instance->base.vk.app_info.engine_name,
instance->base.vk.app_info.engine_version);
instance->renderer->info.has_implicit_fencing =
driQueryOptionb(&instance->dri_options, "venus_implicit_fencing");
@ -375,7 +374,7 @@ vn_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
instance->enable_wsi_multi_plane_modifiers ? "yes" : "no");
}
const char *engine_name = instance->base.base.app_info.engine_name;
const char *engine_name = instance->base.vk.app_info.engine_name;
if (engine_name) {
instance->engine_is_zink = strcmp(engine_name, "mesa zink") == 0;
}
@ -410,7 +409,7 @@ vn_DestroyInstance(VkInstance _instance,
VN_TRACE_FUNC();
struct vn_instance *instance = vn_instance_from_handle(_instance);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &instance->base.base.alloc;
pAllocator ? pAllocator : &instance->base.vk.alloc;
if (!instance)
return;
@ -452,6 +451,6 @@ PFN_vkVoidFunction
vn_GetInstanceProcAddr(VkInstance _instance, const char *pName)
{
struct vn_instance *instance = vn_instance_from_handle(_instance);
return vk_instance_get_proc_addr(&instance->base.base,
return vk_instance_get_proc_addr(&instance->base.vk,
&vn_instance_entrypoints, pName);
}

View file

@ -76,7 +76,7 @@ struct vn_instance {
} physical_device;
};
VK_DEFINE_HANDLE_CASTS(vn_instance,
base.base.base,
base.vk.base,
VkInstance,
VK_OBJECT_TYPE_INSTANCE)

View file

@ -369,7 +369,7 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev)
vn_call_vkGetPhysicalDeviceFeatures2(
ring, vn_physical_device_to_handle(physical_dev), &feats2);
struct vk_features *feats = &physical_dev->base.base.supported_features;
struct vk_features *feats = &physical_dev->base.vk.supported_features;
vk_set_physical_device_features(feats, &feats2);
/* Enable features for extensions natively implemented in Venus driver.
@ -403,7 +403,7 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev)
static void
vn_physical_device_init_uuids(struct vn_physical_device *physical_dev)
{
struct vk_properties *props = &physical_dev->base.base.properties;
struct vk_properties *props = &physical_dev->base.vk.properties;
struct mesa_sha1 sha1_ctx;
uint8_t sha1[SHA1_DIGEST_LENGTH];
@ -439,7 +439,7 @@ static void
vn_physical_device_sanitize_properties(struct vn_physical_device *physical_dev)
{
struct vn_instance *instance = physical_dev->instance;
struct vk_properties *props = &physical_dev->base.base.properties;
struct vk_properties *props = &physical_dev->base.vk.properties;
const uint32_t version_override = vk_get_version_override();
if (version_override) {
@ -464,14 +464,14 @@ vn_physical_device_sanitize_properties(struct vn_physical_device *physical_dev)
* is required for 1.3.
* See vn_physical_device_get_passthrough_extensions()
*/
if (!physical_dev->base.base.supported_extensions.KHR_synchronization2)
if (!physical_dev->base.vk.supported_extensions.KHR_synchronization2)
ver = MIN2(VK_API_VERSION_1_2, ver);
props->apiVersion = ver;
}
/* ANGLE relies on ARM proprietary driver version for workarounds */
const char *engine_name = instance->base.base.app_info.engine_name;
const char *engine_name = instance->base.vk.app_info.engine_name;
const bool forward_driver_version =
props->driverID == VK_DRIVER_ID_ARM_PROPRIETARY && engine_name &&
strcmp(engine_name, "ANGLE") == 0;
@ -511,7 +511,7 @@ vn_physical_device_init_properties(struct vn_physical_device *physical_dev)
const uint32_t renderer_version = physical_dev->renderer_version;
struct vn_instance *instance = physical_dev->instance;
const struct vn_renderer_info *renderer_info = &instance->renderer->info;
struct vk_properties *props = &physical_dev->base.base.properties;
struct vk_properties *props = &physical_dev->base.vk.properties;
const struct vk_device_extension_table *exts =
&physical_dev->renderer_extensions;
VkPhysicalDeviceProperties2 props2 = {
@ -785,14 +785,14 @@ vn_physical_device_init_queue_family_properties(
{
struct vn_instance *instance = physical_dev->instance;
struct vn_ring *ring = instance->ring.ring;
const VkAllocationCallbacks *alloc = &instance->base.base.alloc;
const VkAllocationCallbacks *alloc = &instance->base.vk.alloc;
uint32_t count = 0;
vn_call_vkGetPhysicalDeviceQueueFamilyProperties2(
ring, vn_physical_device_to_handle(physical_dev), &count, NULL);
const bool can_query_prio =
physical_dev->base.base.supported_features.globalPriorityQuery;
physical_dev->base.vk.supported_features.globalPriorityQuery;
VkQueueFamilyProperties2 *props;
VkQueueFamilyGlobalPriorityProperties *prio_props;
@ -819,7 +819,7 @@ vn_physical_device_init_queue_family_properties(
/* Starting from Android 14 (Android U), framework HWUI has required a
* second graphics queue to avoid racing between webview and skiavk.
*/
const char *engine_name = instance->base.base.app_info.engine_name;
const char *engine_name = instance->base.vk.app_info.engine_name;
const bool require_second_queue =
engine_name && strcmp(engine_name, "android framework") == 0;
;
@ -1362,11 +1362,11 @@ vn_physical_device_init_supported_extensions(
#endif
if (native.extensions[i]) {
physical_dev->base.base.supported_extensions.extensions[i] = true;
physical_dev->base.vk.supported_extensions.extensions[i] = true;
physical_dev->extension_spec_versions[i] = props->specVersion;
} else if (passthrough.extensions[i] &&
physical_dev->renderer_extensions.extensions[i]) {
physical_dev->base.base.supported_extensions.extensions[i] = true;
physical_dev->base.vk.supported_extensions.extensions[i] = true;
physical_dev->extension_spec_versions[i] = MIN2(
physical_dev->extension_spec_versions[i], props->specVersion);
}
@ -1379,7 +1379,7 @@ vn_physical_device_init_renderer_extensions(
{
struct vn_instance *instance = physical_dev->instance;
struct vn_ring *ring = instance->ring.ring;
const VkAllocationCallbacks *alloc = &instance->base.base.alloc;
const VkAllocationCallbacks *alloc = &instance->base.vk.alloc;
/* get renderer extensions */
uint32_t count = 0;
@ -1501,7 +1501,7 @@ static void
vn_image_format_cache_fini(struct vn_physical_device *physical_dev)
{
const VkAllocationCallbacks *alloc =
&physical_dev->base.base.instance->alloc;
&physical_dev->base.vk.instance->alloc;
struct vn_image_format_properties_cache *cache =
&physical_dev->image_format_cache;
@ -1534,7 +1534,7 @@ vn_physical_device_disable_sparse_binding(
* get filtered out then disable the feature.
*/
struct vk_features *feats = &physical_dev->base.base.supported_features;
struct vk_features *feats = &physical_dev->base.vk.supported_features;
feats->sparseBinding = false;
feats->sparseResidencyBuffer = false;
feats->sparseResidencyImage2D = false;
@ -1545,7 +1545,7 @@ vn_physical_device_disable_sparse_binding(
feats->sparseResidency16Samples = false;
feats->sparseResidencyAliased = false;
struct vk_properties *props = &physical_dev->base.base.properties;
struct vk_properties *props = &physical_dev->base.vk.properties;
props->sparseAddressSpaceSize = 0;
props->sparseResidencyStandard2DBlockShape = 0;
props->sparseResidencyStandard2DMultisampleBlockShape = 0;
@ -1558,7 +1558,7 @@ static VkResult
vn_physical_device_init(struct vn_physical_device *physical_dev)
{
struct vn_instance *instance = physical_dev->instance;
const VkAllocationCallbacks *alloc = &instance->base.base.alloc;
const VkAllocationCallbacks *alloc = &instance->base.vk.alloc;
VkResult result;
result = vn_physical_device_init_renderer_extensions(physical_dev);
@ -1605,7 +1605,7 @@ void
vn_physical_device_fini(struct vn_physical_device *physical_dev)
{
struct vn_instance *instance = physical_dev->instance;
const VkAllocationCallbacks *alloc = &instance->base.base.alloc;
const VkAllocationCallbacks *alloc = &instance->base.vk.alloc;
vn_image_format_cache_fini(physical_dev);
@ -1639,7 +1639,7 @@ vn_instance_enumerate_physical_device_groups_locked(
{
VkInstance instance_handle = vn_instance_to_handle(instance);
struct vn_ring *ring = instance->ring.ring;
const VkAllocationCallbacks *alloc = &instance->base.base.alloc;
const VkAllocationCallbacks *alloc = &instance->base.vk.alloc;
VkResult result;
uint32_t count = 0;
@ -1674,7 +1674,7 @@ vn_instance_enumerate_physical_device_groups_locked(
for (uint32_t j = 0; j < VK_MAX_DEVICE_GROUP_SIZE; j++) {
struct vn_physical_device_base *temp_obj =
&temp_objs[VK_MAX_DEVICE_GROUP_SIZE * i + j];
temp_obj->base.base.type = VK_OBJECT_TYPE_PHYSICAL_DEVICE;
temp_obj->vk.base.type = VK_OBJECT_TYPE_PHYSICAL_DEVICE;
group->physicalDevices[j] = (VkPhysicalDevice)temp_obj;
}
}
@ -1732,7 +1732,7 @@ enumerate_physical_devices(struct vn_instance *instance,
struct vn_physical_device **out_physical_devs,
uint32_t *out_count)
{
const VkAllocationCallbacks *alloc = &instance->base.base.alloc;
const VkAllocationCallbacks *alloc = &instance->base.vk.alloc;
struct vn_ring *ring = instance->ring.ring;
struct vn_physical_device *physical_devs = NULL;
VkResult result;
@ -1821,7 +1821,7 @@ filter_physical_devices(struct vn_physical_device *physical_devs,
static VkResult
vn_instance_enumerate_physical_devices_and_groups(struct vn_instance *instance)
{
const VkAllocationCallbacks *alloc = &instance->base.base.alloc;
const VkAllocationCallbacks *alloc = &instance->base.vk.alloc;
struct vn_physical_device *physical_devs = NULL;
uint32_t count = 0;
VkResult result = VK_SUCCESS;
@ -1940,7 +1940,7 @@ vn_EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
VK_OUTARRAY_MAKE_TYPED(VkExtensionProperties, out, pProperties,
pPropertyCount);
for (uint32_t i = 0; i < VK_DEVICE_EXTENSION_COUNT; i++) {
if (physical_dev->base.base.supported_extensions.extensions[i]) {
if (physical_dev->base.vk.supported_extensions.extensions[i]) {
vk_outarray_append_typed(VkExtensionProperties, &out, prop) {
*prop = vk_device_extensions[i];
prop->specVersion = physical_dev->extension_spec_versions[i];
@ -2026,7 +2026,7 @@ vn_GetPhysicalDeviceMemoryProperties2(
VkPhysicalDeviceMemoryBudgetPropertiesEXT *memory_budget = NULL;
/* Don't waste time searching for unsupported structs. */
if (physical_dev->base.base.supported_extensions.EXT_memory_budget) {
if (physical_dev->base.vk.supported_extensions.EXT_memory_budget) {
memory_budget =
vk_find_struct(pMemoryProperties->pNext,
PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT);
@ -2513,7 +2513,7 @@ vn_image_store_format_in_cache(
VkResult cached_result)
{
const VkAllocationCallbacks *alloc =
&physical_dev->base.base.instance->alloc;
&physical_dev->base.vk.instance->alloc;
struct vn_image_format_properties_cache *cache =
&physical_dev->image_format_cache;
struct vn_image_format_cache_entry *cache_entry = NULL;

View file

@ -124,7 +124,7 @@ struct vn_physical_device {
struct vn_image_format_properties_cache image_format_cache;
};
VK_DEFINE_HANDLE_CASTS(vn_physical_device,
base.base.base,
base.vk.base,
VkPhysicalDevice,
VK_OBJECT_TYPE_PHYSICAL_DEVICE)

View file

@ -252,7 +252,7 @@ vn_CreateShaderModule(VkDevice device,
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
struct vn_shader_module *mod =
vk_zalloc(alloc, sizeof(*mod), VN_DEFAULT_ALIGN,
@ -279,7 +279,7 @@ vn_DestroyShaderModule(VkDevice device,
struct vn_device *dev = vn_device_from_handle(device);
struct vn_shader_module *mod = vn_shader_module_from_handle(shaderModule);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!mod)
return;
@ -297,7 +297,7 @@ static void
vn_pipeline_layout_destroy(struct vn_device *dev,
struct vn_pipeline_layout *pipeline_layout)
{
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
const VkAllocationCallbacks *alloc = &dev->base.vk.alloc;
if (pipeline_layout->push_descriptor_set_layout) {
vn_descriptor_set_layout_unref(
dev, pipeline_layout->push_descriptor_set_layout);
@ -334,7 +334,7 @@ vn_CreatePipelineLayout(VkDevice device,
{
struct vn_device *dev = vn_device_from_handle(device);
/* ignore pAllocator as the pipeline layout is reference-counted */
const VkAllocationCallbacks *alloc = &dev->base.base.alloc;
const VkAllocationCallbacks *alloc = &dev->base.vk.alloc;
struct vn_pipeline_layout *layout =
vk_zalloc(alloc, sizeof(*layout), VN_DEFAULT_ALIGN,
@ -403,7 +403,7 @@ vn_CreatePipelineCache(VkDevice device,
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
struct vn_pipeline_cache *cache =
vk_zalloc(alloc, sizeof(*cache), VN_DEFAULT_ALIGN,
@ -443,7 +443,7 @@ vn_DestroyPipelineCache(VkDevice device,
struct vn_pipeline_cache *cache =
vn_pipeline_cache_from_handle(pipelineCache);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!cache)
return;
@ -507,7 +507,7 @@ vn_GetPipelineCacheData(VkDevice device,
return VK_INCOMPLETE;
}
const struct vk_properties *props = &physical_dev->base.base.properties;
const struct vk_properties *props = &physical_dev->base.vk.properties;
header->header_size = sizeof(*header);
header->header_version = VK_PIPELINE_CACHE_HEADER_VERSION_ONE;
header->vendor_id = props->vendorID;
@ -1677,7 +1677,7 @@ vn_CreateGraphicsPipelines(VkDevice device,
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
bool want_sync = false;
VkResult result;
@ -1770,7 +1770,7 @@ vn_CreateComputePipelines(VkDevice device,
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
bool want_sync = false;
VkResult result;
@ -1829,7 +1829,7 @@ vn_DestroyPipeline(VkDevice device,
struct vn_device *dev = vn_device_from_handle(device);
struct vn_pipeline *pipeline = vn_pipeline_from_handle(_pipeline);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!pipeline)
return;
@ -1856,7 +1856,7 @@ vn_CreateRayTracingPipelinesKHR(
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
bool want_sync = false;
VkResult result = VK_SUCCESS;

View file

@ -17,7 +17,7 @@ struct vn_shader_module {
struct vn_object_base base;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_shader_module,
base.base,
base.vk,
VkShaderModule,
VK_OBJECT_TYPE_SHADER_MODULE)
@ -29,7 +29,7 @@ struct vn_pipeline_layout {
struct vn_refcount refcount;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_pipeline_layout,
base.base,
base.vk,
VkPipelineLayout,
VK_OBJECT_TYPE_PIPELINE_LAYOUT)
@ -37,7 +37,7 @@ struct vn_pipeline_cache {
struct vn_object_base base;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_pipeline_cache,
base.base,
base.vk,
VkPipelineCache,
VK_OBJECT_TYPE_PIPELINE_CACHE)
@ -69,7 +69,7 @@ struct vn_pipeline {
struct vn_pipeline_layout *layout;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_pipeline,
base.base,
base.vk,
VkPipeline,
VK_OBJECT_TYPE_PIPELINE)

View file

@ -26,7 +26,7 @@ vn_CreateQueryPool(VkDevice device,
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
struct vn_query_pool *pool =
vk_zalloc(alloc, sizeof(*pool), VN_DEFAULT_ALIGN,

View file

@ -29,7 +29,7 @@ struct vn_query_pool {
bool saturate_on_overflow;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_query_pool,
base.base,
base.vk,
VkQueryPool,
VK_OBJECT_TYPE_QUERY_POOL)

View file

@ -263,7 +263,7 @@ static bool
vn_has_zink_sync_batch(struct vn_queue_submission *submit)
{
struct vn_queue *queue = vn_queue_from_handle(submit->queue_handle);
struct vn_device *dev = (void *)queue->base.base.base.device;
struct vn_device *dev = (void *)queue->base.vk.base.device;
struct vn_instance *instance = dev->instance;
const uint32_t last_batch_index = submit->batch_count - 1;
@ -1030,7 +1030,7 @@ static VkResult
vn_queue_submit(struct vn_queue_submission *submit)
{
struct vn_queue *queue = vn_queue_from_handle(submit->queue_handle);
struct vn_device *dev = (void *)queue->base.base.base.device;
struct vn_device *dev = (void *)queue->base.vk.base.device;
struct vn_instance *instance = dev->instance;
VkResult result;
@ -1160,7 +1160,7 @@ static VkResult
vn_queue_bind_sparse_submit(struct vn_queue_submission *submit)
{
struct vn_queue *queue = vn_queue_from_handle(submit->queue_handle);
struct vn_device *dev = (void *)queue->base.base.base.device;
struct vn_device *dev = (void *)queue->base.vk.base.device;
struct vn_instance *instance = dev->instance;
VkResult result;
@ -1188,7 +1188,7 @@ vn_queue_bind_sparse_submit_batch(struct vn_queue_submission *submit,
uint32_t batch_index)
{
struct vn_queue *queue = vn_queue_from_handle(submit->queue_handle);
VkDevice dev_handle = vk_device_to_handle(queue->base.base.base.device);
VkDevice dev_handle = vk_device_to_handle(queue->base.vk.base.device);
const VkBindSparseInfo *sparse_info = &submit->sparse_batches[batch_index];
const VkSemaphore *signal_sem = sparse_info->pSignalSemaphores;
uint32_t signal_sem_count = sparse_info->signalSemaphoreCount;
@ -1376,7 +1376,7 @@ vn_QueueWaitIdle(VkQueue _queue)
{
VN_TRACE_FUNC();
struct vn_queue *queue = vn_queue_from_handle(_queue);
VkDevice dev_handle = vk_device_to_handle(queue->base.base.base.device);
VkDevice dev_handle = vk_device_to_handle(queue->base.vk.base.device);
struct vn_device *dev = vn_device_from_handle(dev_handle);
VkResult result;
@ -1523,7 +1523,7 @@ vn_CreateFence(VkDevice device,
VN_TRACE_FUNC();
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
const bool signaled = pCreateInfo->flags & VK_FENCE_CREATE_SIGNALED_BIT;
VkResult result;
@ -1571,7 +1571,7 @@ vn_DestroyFence(VkDevice device,
struct vn_device *dev = vn_device_from_handle(device);
struct vn_fence *fence = vn_fence_from_handle(_fence);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!fence)
return;
@ -2009,7 +2009,7 @@ vn_CreateSemaphore(VkDevice device,
VN_TRACE_FUNC();
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
struct vn_semaphore *sem = vk_zalloc(alloc, sizeof(*sem), VN_DEFAULT_ALIGN,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
@ -2069,7 +2069,7 @@ vn_DestroySemaphore(VkDevice device,
struct vn_device *dev = vn_device_from_handle(device);
struct vn_semaphore *sem = vn_semaphore_from_handle(semaphore);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!sem)
return;
@ -2392,7 +2392,7 @@ vn_CreateEvent(VkDevice device,
VN_TRACE_FUNC();
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
struct vn_event *ev = vk_zalloc(alloc, sizeof(*ev), VN_DEFAULT_ALIGN,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
@ -2426,7 +2426,7 @@ vn_DestroyEvent(VkDevice device,
struct vn_device *dev = vn_device_from_handle(device);
struct vn_event *ev = vn_event_from_handle(event);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!ev)
return;

View file

@ -34,7 +34,7 @@ struct vn_queue {
/* for vn_queue_submission storage */
struct vn_cached_storage storage;
};
VK_DEFINE_HANDLE_CASTS(vn_queue, base.base.base, VkQueue, VK_OBJECT_TYPE_QUEUE)
VK_DEFINE_HANDLE_CASTS(vn_queue, base.vk.base, VkQueue, VK_OBJECT_TYPE_QUEUE)
enum vn_sync_type {
/* no payload */
@ -86,7 +86,7 @@ struct vn_fence {
struct vn_sync_payload_external external_payload;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_fence,
base.base,
base.vk,
VkFence,
VK_OBJECT_TYPE_FENCE)
@ -134,7 +134,7 @@ struct vn_semaphore {
struct vn_sync_payload_external external_payload;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_semaphore,
base.base,
base.vk,
VkSemaphore,
VK_OBJECT_TYPE_SEMAPHORE)
@ -148,7 +148,7 @@ struct vn_event {
struct vn_feedback_slot *feedback_slot;
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_event,
base.base,
base.vk,
VkEvent,
VK_OBJECT_TYPE_EVENT)

View file

@ -202,7 +202,7 @@ vn_CreateRenderPass(VkDevice device,
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
uint32_t acquire_count;
uint32_t release_count;
@ -257,7 +257,7 @@ vn_CreateRenderPass2(VkDevice device,
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
uint32_t acquire_count;
uint32_t release_count;
@ -307,7 +307,7 @@ vn_DestroyRenderPass(VkDevice device,
struct vn_device *dev = vn_device_from_handle(device);
struct vn_render_pass *pass = vn_render_pass_from_handle(renderPass);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!pass)
return;
@ -356,7 +356,7 @@ vn_CreateFramebuffer(VkDevice device,
{
struct vn_device *dev = vn_device_from_handle(device);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
/* Two render passes differ only in attachment image layouts are considered
* compatible. We must not use pCreateInfo->renderPass here.
@ -394,7 +394,7 @@ vn_DestroyFramebuffer(VkDevice device,
struct vn_device *dev = vn_device_from_handle(device);
struct vn_framebuffer *fb = vn_framebuffer_from_handle(framebuffer);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &dev->base.base.alloc;
pAllocator ? pAllocator : &dev->base.vk.alloc;
if (!fb)
return;

View file

@ -57,7 +57,7 @@ struct vn_render_pass {
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_render_pass,
base.base,
base.vk,
VkRenderPass,
VK_OBJECT_TYPE_RENDER_PASS)
@ -68,7 +68,7 @@ struct vn_framebuffer {
VkImageView image_views[];
};
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_framebuffer,
base.base,
base.vk,
VkFramebuffer,
VK_OBJECT_TYPE_FRAMEBUFFER)

View file

@ -275,7 +275,7 @@ vn_ring_create(struct vn_instance *instance,
{
VN_TRACE_FUNC();
const VkAllocationCallbacks *alloc = &instance->base.base.alloc;
const VkAllocationCallbacks *alloc = &instance->base.vk.alloc;
struct vn_ring *ring = vk_zalloc(alloc, sizeof(*ring), VN_DEFAULT_ALIGN,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
@ -369,7 +369,7 @@ vn_ring_destroy(struct vn_ring *ring)
{
VN_TRACE_FUNC();
const VkAllocationCallbacks *alloc = &ring->instance->base.base.alloc;
const VkAllocationCallbacks *alloc = &ring->instance->base.vk.alloc;
uint32_t destroy_ring_data[4];
struct vn_cs_encoder local_enc = VN_CS_ENCODER_INITIALIZER_LOCAL(

View file

@ -69,14 +69,14 @@ vn_wsi_proc_addr(VkPhysicalDevice physicalDevice, const char *pName)
struct vn_physical_device *physical_dev =
vn_physical_device_from_handle(physicalDevice);
return vk_instance_get_proc_addr_unchecked(
&physical_dev->instance->base.base, pName);
&physical_dev->instance->base.vk, pName);
}
VkResult
vn_wsi_init(struct vn_physical_device *physical_dev)
{
const VkAllocationCallbacks *alloc =
&physical_dev->instance->base.base.alloc;
&physical_dev->instance->base.vk.alloc;
VkResult result = wsi_device_init(
&physical_dev->wsi_device, vn_physical_device_to_handle(physical_dev),
vn_wsi_proc_addr, alloc, -1, &physical_dev->instance->dri_options,
@ -88,7 +88,7 @@ vn_wsi_init(struct vn_physical_device *physical_dev)
return result;
physical_dev->wsi_device.supports_modifiers = true;
physical_dev->base.base.wsi_device = &physical_dev->wsi_device;
physical_dev->base.vk.wsi_device = &physical_dev->wsi_device;
return VK_SUCCESS;
}
@ -97,8 +97,8 @@ void
vn_wsi_fini(struct vn_physical_device *physical_dev)
{
const VkAllocationCallbacks *alloc =
&physical_dev->instance->base.base.alloc;
physical_dev->base.base.wsi_device = NULL;
&physical_dev->instance->base.vk.alloc;
physical_dev->base.vk.wsi_device = NULL;
wsi_device_finish(&physical_dev->wsi_device, alloc);
}