mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-14 17:46:23 +00:00
winevulkan: Separate PE and Unix VkQueue structs.
This commit is contained in:
parent
a6dc349aad
commit
59d13f3d35
|
@ -428,11 +428,16 @@ VkResult WINAPI vkCreateDevice(VkPhysicalDevice phys_dev, const VkDeviceCreateIn
|
|||
const VkAllocationCallbacks *allocator, VkDevice *ret)
|
||||
{
|
||||
struct vkCreateDevice_params params;
|
||||
uint32_t queue_count = 0, i;
|
||||
VkDevice device;
|
||||
VkResult result;
|
||||
|
||||
if (!(device = alloc_vk_object(sizeof(*device))))
|
||||
for (i = 0; i < create_info->queueCreateInfoCount; i++)
|
||||
queue_count += create_info->pQueueCreateInfos[i].queueCount;
|
||||
if (!(device = alloc_vk_object(FIELD_OFFSET(struct VkDevice_T, queues[queue_count]))))
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
for (i = 0; i < queue_count; i++)
|
||||
device->queues[i].base.loader_magic = VULKAN_ICD_MAGIC_VALUE;
|
||||
|
||||
params.physicalDevice = phys_dev;
|
||||
params.pCreateInfo = create_info;
|
||||
|
|
|
@ -1063,6 +1063,8 @@ class VkHandle(object):
|
|||
return "{0}->funcs".format(param)
|
||||
elif self.name == "VkDevice":
|
||||
return "wine_device_from_handle({0})->funcs".format(param)
|
||||
elif self.name == "VkQueue":
|
||||
return "wine_queue_from_handle({0})->device->funcs".format(param)
|
||||
elif self.parent in ["VkInstance", "VkPhysicalDevice"]:
|
||||
return "{0}->instance->funcs".format(param)
|
||||
elif self.parent in ["VkDevice", "VkCommandPool"]:
|
||||
|
@ -1102,6 +1104,8 @@ class VkHandle(object):
|
|||
return "wine_debug_report_callback_from_handle({0})->debug_callback".format(name)
|
||||
if self.name == "VkDevice":
|
||||
return "wine_device_from_handle({0})->device".format(name)
|
||||
if self.name == "VkQueue":
|
||||
return "wine_queue_from_handle({0})->queue".format(name)
|
||||
if self.name == "VkSurfaceKHR":
|
||||
return "wine_surface_from_handle({0})->surface".format(name)
|
||||
|
||||
|
@ -1113,8 +1117,6 @@ class VkHandle(object):
|
|||
native_handle_name = "instance"
|
||||
if self.name == "VkPhysicalDevice":
|
||||
native_handle_name = "phys_dev"
|
||||
if self.name == "VkQueue":
|
||||
native_handle_name = "queue"
|
||||
|
||||
if native_handle_name:
|
||||
return "{0}->{1}".format(name, native_handle_name)
|
||||
|
|
|
@ -324,17 +324,17 @@ static void wine_vk_free_command_buffers(struct wine_device *device,
|
|||
|
||||
static void wine_vk_device_get_queues(struct wine_device *device,
|
||||
uint32_t family_index, uint32_t queue_count, VkDeviceQueueCreateFlags flags,
|
||||
struct VkQueue_T* queues)
|
||||
struct wine_queue *queues, VkQueue *handles)
|
||||
{
|
||||
VkDeviceQueueInfo2 queue_info;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < queue_count; i++)
|
||||
{
|
||||
struct VkQueue_T *queue = &queues[i];
|
||||
struct wine_queue *queue = &queues[i];
|
||||
|
||||
queue->base.loader_magic = VULKAN_ICD_MAGIC_VALUE;
|
||||
queue->device = device;
|
||||
queue->handle = (*handles)++;
|
||||
queue->family_index = family_index;
|
||||
queue->queue_index = i;
|
||||
queue->flags = flags;
|
||||
|
@ -358,7 +358,8 @@ static void wine_vk_device_get_queues(struct wine_device *device,
|
|||
device->funcs.p_vkGetDeviceQueue(device->device, family_index, i, &queue->queue);
|
||||
}
|
||||
|
||||
WINE_VK_ADD_DISPATCHABLE_MAPPING(device->phys_dev->instance, queue, queue->queue, queue);
|
||||
queue->handle->base.unix_handle = (uintptr_t)queue;
|
||||
WINE_VK_ADD_DISPATCHABLE_MAPPING(device->phys_dev->instance, queue->handle, queue->queue, queue);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,7 +407,7 @@ static VkResult wine_vk_device_convert_create_info(const VkDeviceCreateInfo *src
|
|||
*/
|
||||
static void wine_vk_device_free(struct wine_device *device)
|
||||
{
|
||||
struct VkQueue_T *queue;
|
||||
struct wine_queue *queue;
|
||||
|
||||
if (!device)
|
||||
return;
|
||||
|
@ -702,7 +703,8 @@ NTSTATUS wine_vkCreateDevice(void *args)
|
|||
VkDevice *ret_device = params->pDevice;
|
||||
VkDevice device_handle = params->client_ptr;
|
||||
VkDeviceCreateInfo create_info_host;
|
||||
struct VkQueue_T *next_queue;
|
||||
struct VkQueue_T *queue_handles;
|
||||
struct wine_queue *next_queue;
|
||||
struct wine_device *object;
|
||||
unsigned int i;
|
||||
VkResult res;
|
||||
|
@ -768,6 +770,7 @@ NTSTATUS wine_vkCreateDevice(void *args)
|
|||
}
|
||||
|
||||
next_queue = object->queues;
|
||||
queue_handles = device_handle->queues;
|
||||
for (i = 0; i < create_info_host.queueCreateInfoCount; i++)
|
||||
{
|
||||
uint32_t flags = create_info_host.pQueueCreateInfos[i].flags;
|
||||
|
@ -776,7 +779,7 @@ NTSTATUS wine_vkCreateDevice(void *args)
|
|||
|
||||
TRACE("Queue family index %u, queue count %u.\n", family_index, queue_count);
|
||||
|
||||
wine_vk_device_get_queues(object, family_index, queue_count, flags, next_queue);
|
||||
wine_vk_device_get_queues(object, family_index, queue_count, flags, next_queue, &queue_handles);
|
||||
next_queue += queue_count;
|
||||
}
|
||||
|
||||
|
@ -1072,7 +1075,7 @@ NTSTATUS wine_vkFreeCommandBuffers(void *args)
|
|||
static VkQueue wine_vk_device_find_queue(VkDevice handle, const VkDeviceQueueInfo2 *info)
|
||||
{
|
||||
struct wine_device *device = wine_device_from_handle(handle);
|
||||
struct VkQueue_T* queue;
|
||||
struct wine_queue *queue;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < device->queue_count; i++)
|
||||
|
@ -1082,7 +1085,7 @@ static VkQueue wine_vk_device_find_queue(VkDevice handle, const VkDeviceQueueInf
|
|||
&& queue->queue_index == info->queueIndex
|
||||
&& queue->flags == info->flags)
|
||||
{
|
||||
return queue;
|
||||
return queue->handle;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,10 +54,16 @@ struct wine_vk_base
|
|||
UINT64 unix_handle;
|
||||
};
|
||||
|
||||
struct VkQueue_T
|
||||
{
|
||||
struct wine_vk_base base;
|
||||
};
|
||||
|
||||
struct VkDevice_T
|
||||
{
|
||||
struct wine_vk_base base;
|
||||
unsigned int quirks;
|
||||
struct VkQueue_T queues[1];
|
||||
};
|
||||
|
||||
struct vulkan_func
|
||||
|
|
|
@ -61,7 +61,7 @@ struct wine_device
|
|||
VkDevice handle; /* client device */
|
||||
VkDevice device; /* native device */
|
||||
|
||||
struct VkQueue_T* queues;
|
||||
struct wine_queue *queues;
|
||||
uint32_t queue_count;
|
||||
|
||||
struct wine_vk_mapping mapping;
|
||||
|
@ -124,10 +124,11 @@ struct VkPhysicalDevice_T
|
|||
struct wine_vk_mapping mapping;
|
||||
};
|
||||
|
||||
struct VkQueue_T
|
||||
struct wine_queue
|
||||
{
|
||||
struct wine_vk_base base;
|
||||
struct wine_device *device; /* parent */
|
||||
|
||||
VkQueue handle; /* client queue */
|
||||
VkQueue queue; /* native queue */
|
||||
|
||||
uint32_t family_index;
|
||||
|
@ -137,6 +138,11 @@ struct VkQueue_T
|
|||
struct wine_vk_mapping mapping;
|
||||
};
|
||||
|
||||
static inline struct wine_queue *wine_queue_from_handle(VkQueue handle)
|
||||
{
|
||||
return (struct wine_queue *)(uintptr_t)handle->base.unix_handle;
|
||||
}
|
||||
|
||||
struct wine_cmd_pool
|
||||
{
|
||||
VkCommandPool command_pool;
|
||||
|
|
|
@ -9459,7 +9459,7 @@ static NTSTATUS wine_vkGetQueueCheckpointData2NV(void *args)
|
|||
{
|
||||
struct vkGetQueueCheckpointData2NV_params *params = args;
|
||||
TRACE("%p, %p, %p\n", params->queue, params->pCheckpointDataCount, params->pCheckpointData);
|
||||
params->queue->device->funcs.p_vkGetQueueCheckpointData2NV(params->queue->queue, params->pCheckpointDataCount, params->pCheckpointData);
|
||||
wine_queue_from_handle(params->queue)->device->funcs.p_vkGetQueueCheckpointData2NV(wine_queue_from_handle(params->queue)->queue, params->pCheckpointDataCount, params->pCheckpointData);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -9467,7 +9467,7 @@ static NTSTATUS wine_vkGetQueueCheckpointDataNV(void *args)
|
|||
{
|
||||
struct vkGetQueueCheckpointDataNV_params *params = args;
|
||||
TRACE("%p, %p, %p\n", params->queue, params->pCheckpointDataCount, params->pCheckpointData);
|
||||
params->queue->device->funcs.p_vkGetQueueCheckpointDataNV(params->queue->queue, params->pCheckpointDataCount, params->pCheckpointData);
|
||||
wine_queue_from_handle(params->queue)->device->funcs.p_vkGetQueueCheckpointDataNV(wine_queue_from_handle(params->queue)->queue, params->pCheckpointDataCount, params->pCheckpointData);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -9609,7 +9609,7 @@ static NTSTATUS wine_vkQueueBeginDebugUtilsLabelEXT(void *args)
|
|||
{
|
||||
struct vkQueueBeginDebugUtilsLabelEXT_params *params = args;
|
||||
TRACE("%p, %p\n", params->queue, params->pLabelInfo);
|
||||
params->queue->device->funcs.p_vkQueueBeginDebugUtilsLabelEXT(params->queue->queue, params->pLabelInfo);
|
||||
wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueBeginDebugUtilsLabelEXT(wine_queue_from_handle(params->queue)->queue, params->pLabelInfo);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -9622,13 +9622,13 @@ static NTSTATUS wine_vkQueueBindSparse(void *args)
|
|||
TRACE("%p, %u, %p, 0x%s\n", params->queue, params->bindInfoCount, params->pBindInfo, wine_dbgstr_longlong(params->fence));
|
||||
|
||||
pBindInfo_host = convert_VkBindSparseInfo_array_win_to_host(params->pBindInfo, params->bindInfoCount);
|
||||
result = params->queue->device->funcs.p_vkQueueBindSparse(params->queue->queue, params->bindInfoCount, pBindInfo_host, params->fence);
|
||||
result = wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueBindSparse(wine_queue_from_handle(params->queue)->queue, params->bindInfoCount, pBindInfo_host, params->fence);
|
||||
|
||||
free_VkBindSparseInfo_array(pBindInfo_host, params->bindInfoCount);
|
||||
return result;
|
||||
#else
|
||||
TRACE("%p, %u, %p, 0x%s\n", params->queue, params->bindInfoCount, params->pBindInfo, wine_dbgstr_longlong(params->fence));
|
||||
return params->queue->device->funcs.p_vkQueueBindSparse(params->queue->queue, params->bindInfoCount, params->pBindInfo, params->fence);
|
||||
return wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueBindSparse(wine_queue_from_handle(params->queue)->queue, params->bindInfoCount, params->pBindInfo, params->fence);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -9636,7 +9636,7 @@ static NTSTATUS wine_vkQueueEndDebugUtilsLabelEXT(void *args)
|
|||
{
|
||||
struct vkQueueEndDebugUtilsLabelEXT_params *params = args;
|
||||
TRACE("%p\n", params->queue);
|
||||
params->queue->device->funcs.p_vkQueueEndDebugUtilsLabelEXT(params->queue->queue);
|
||||
wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueEndDebugUtilsLabelEXT(wine_queue_from_handle(params->queue)->queue);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -9644,7 +9644,7 @@ static NTSTATUS wine_vkQueueInsertDebugUtilsLabelEXT(void *args)
|
|||
{
|
||||
struct vkQueueInsertDebugUtilsLabelEXT_params *params = args;
|
||||
TRACE("%p, %p\n", params->queue, params->pLabelInfo);
|
||||
params->queue->device->funcs.p_vkQueueInsertDebugUtilsLabelEXT(params->queue->queue, params->pLabelInfo);
|
||||
wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueInsertDebugUtilsLabelEXT(wine_queue_from_handle(params->queue)->queue, params->pLabelInfo);
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -9652,14 +9652,14 @@ static NTSTATUS wine_vkQueuePresentKHR(void *args)
|
|||
{
|
||||
struct vkQueuePresentKHR_params *params = args;
|
||||
TRACE("%p, %p\n", params->queue, params->pPresentInfo);
|
||||
return params->queue->device->funcs.p_vkQueuePresentKHR(params->queue->queue, params->pPresentInfo);
|
||||
return wine_queue_from_handle(params->queue)->device->funcs.p_vkQueuePresentKHR(wine_queue_from_handle(params->queue)->queue, params->pPresentInfo);
|
||||
}
|
||||
|
||||
static NTSTATUS wine_vkQueueSetPerformanceConfigurationINTEL(void *args)
|
||||
{
|
||||
struct vkQueueSetPerformanceConfigurationINTEL_params *params = args;
|
||||
TRACE("%p, 0x%s\n", params->queue, wine_dbgstr_longlong(params->configuration));
|
||||
return params->queue->device->funcs.p_vkQueueSetPerformanceConfigurationINTEL(params->queue->queue, params->configuration);
|
||||
return wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueSetPerformanceConfigurationINTEL(wine_queue_from_handle(params->queue)->queue, params->configuration);
|
||||
}
|
||||
|
||||
static NTSTATUS wine_vkQueueSubmit(void *args)
|
||||
|
@ -9670,7 +9670,7 @@ static NTSTATUS wine_vkQueueSubmit(void *args)
|
|||
TRACE("%p, %u, %p, 0x%s\n", params->queue, params->submitCount, params->pSubmits, wine_dbgstr_longlong(params->fence));
|
||||
|
||||
pSubmits_host = convert_VkSubmitInfo_array_win_to_host(params->pSubmits, params->submitCount);
|
||||
result = params->queue->device->funcs.p_vkQueueSubmit(params->queue->queue, params->submitCount, pSubmits_host, params->fence);
|
||||
result = wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueSubmit(wine_queue_from_handle(params->queue)->queue, params->submitCount, pSubmits_host, params->fence);
|
||||
|
||||
free_VkSubmitInfo_array(pSubmits_host, params->submitCount);
|
||||
return result;
|
||||
|
@ -9685,7 +9685,7 @@ static NTSTATUS wine_vkQueueSubmit2(void *args)
|
|||
TRACE("%p, %u, %p, 0x%s\n", params->queue, params->submitCount, params->pSubmits, wine_dbgstr_longlong(params->fence));
|
||||
|
||||
pSubmits_host = convert_VkSubmitInfo2_array_win_to_host(params->pSubmits, params->submitCount);
|
||||
result = params->queue->device->funcs.p_vkQueueSubmit2(params->queue->queue, params->submitCount, pSubmits_host, params->fence);
|
||||
result = wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueSubmit2(wine_queue_from_handle(params->queue)->queue, params->submitCount, pSubmits_host, params->fence);
|
||||
|
||||
free_VkSubmitInfo2_array(pSubmits_host, params->submitCount);
|
||||
return result;
|
||||
|
@ -9695,7 +9695,7 @@ static NTSTATUS wine_vkQueueSubmit2(void *args)
|
|||
TRACE("%p, %u, %p, 0x%s\n", params->queue, params->submitCount, params->pSubmits, wine_dbgstr_longlong(params->fence));
|
||||
|
||||
pSubmits_host = convert_VkSubmitInfo2_array_win_to_host(params->pSubmits, params->submitCount);
|
||||
result = params->queue->device->funcs.p_vkQueueSubmit2(params->queue->queue, params->submitCount, pSubmits_host, params->fence);
|
||||
result = wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueSubmit2(wine_queue_from_handle(params->queue)->queue, params->submitCount, pSubmits_host, params->fence);
|
||||
|
||||
free_VkSubmitInfo2_array(pSubmits_host, params->submitCount);
|
||||
return result;
|
||||
|
@ -9711,7 +9711,7 @@ static NTSTATUS wine_vkQueueSubmit2KHR(void *args)
|
|||
TRACE("%p, %u, %p, 0x%s\n", params->queue, params->submitCount, params->pSubmits, wine_dbgstr_longlong(params->fence));
|
||||
|
||||
pSubmits_host = convert_VkSubmitInfo2_array_win_to_host(params->pSubmits, params->submitCount);
|
||||
result = params->queue->device->funcs.p_vkQueueSubmit2KHR(params->queue->queue, params->submitCount, pSubmits_host, params->fence);
|
||||
result = wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueSubmit2KHR(wine_queue_from_handle(params->queue)->queue, params->submitCount, pSubmits_host, params->fence);
|
||||
|
||||
free_VkSubmitInfo2_array(pSubmits_host, params->submitCount);
|
||||
return result;
|
||||
|
@ -9721,7 +9721,7 @@ static NTSTATUS wine_vkQueueSubmit2KHR(void *args)
|
|||
TRACE("%p, %u, %p, 0x%s\n", params->queue, params->submitCount, params->pSubmits, wine_dbgstr_longlong(params->fence));
|
||||
|
||||
pSubmits_host = convert_VkSubmitInfo2_array_win_to_host(params->pSubmits, params->submitCount);
|
||||
result = params->queue->device->funcs.p_vkQueueSubmit2KHR(params->queue->queue, params->submitCount, pSubmits_host, params->fence);
|
||||
result = wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueSubmit2KHR(wine_queue_from_handle(params->queue)->queue, params->submitCount, pSubmits_host, params->fence);
|
||||
|
||||
free_VkSubmitInfo2_array(pSubmits_host, params->submitCount);
|
||||
return result;
|
||||
|
@ -9732,7 +9732,7 @@ static NTSTATUS wine_vkQueueWaitIdle(void *args)
|
|||
{
|
||||
struct vkQueueWaitIdle_params *params = args;
|
||||
TRACE("%p\n", params->queue);
|
||||
return params->queue->device->funcs.p_vkQueueWaitIdle(params->queue->queue);
|
||||
return wine_queue_from_handle(params->queue)->device->funcs.p_vkQueueWaitIdle(wine_queue_from_handle(params->queue)->queue);
|
||||
}
|
||||
|
||||
static NTSTATUS wine_vkReleasePerformanceConfigurationINTEL(void *args)
|
||||
|
@ -10341,7 +10341,7 @@ uint64_t wine_vk_unwrap_handle(VkObjectType type, uint64_t handle)
|
|||
case VK_OBJECT_TYPE_PHYSICAL_DEVICE:
|
||||
return (uint64_t) (uintptr_t) ((VkPhysicalDevice) (uintptr_t) handle)->phys_dev;
|
||||
case VK_OBJECT_TYPE_QUEUE:
|
||||
return (uint64_t) (uintptr_t) ((VkQueue) (uintptr_t) handle)->queue;
|
||||
return (uint64_t) (uintptr_t) wine_queue_from_handle(((VkQueue) (uintptr_t) handle))->queue;
|
||||
case VK_OBJECT_TYPE_SURFACE_KHR:
|
||||
return (uint64_t) wine_surface_from_handle(handle)->surface;
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue