mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-06 23:38:25 +02:00
vulkan: return pQueue with matching flags
Searching device->queues only according to queueIndex and queueFamilyIndex could cause this issue: if there are two queues A and B created with same queueIndex and queueFamilyIndex but different flags. When user try to get B but vk_foreach_queue loop return A when it get A and find it have the request queueIndex and queueFamilyIndex. So this add a check of queue flags and return the queue with matching flags, queueIndex and queueFamilyIndex. Signed-off-by: Julia Zhang <Julia.Zhang@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40669>
This commit is contained in:
parent
007cfd138d
commit
32d04bcdcd
1 changed files with 11 additions and 13 deletions
|
|
@ -471,15 +471,6 @@ vk_common_GetDeviceQueue2(VkDevice _device,
|
|||
{
|
||||
VK_FROM_HANDLE(vk_device, device, _device);
|
||||
|
||||
struct vk_queue *queue = NULL;
|
||||
vk_foreach_queue(iter, device) {
|
||||
if (iter->queue_family_index == pQueueInfo->queueFamilyIndex &&
|
||||
iter->index_in_family == pQueueInfo->queueIndex) {
|
||||
queue = iter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* From the Vulkan 1.1.70 spec:
|
||||
*
|
||||
* "The queue returned by vkGetDeviceQueue2 must have the same flags
|
||||
|
|
@ -487,10 +478,17 @@ vk_common_GetDeviceQueue2(VkDevice _device,
|
|||
* VkDeviceQueueCreateInfo instance. If no matching flags were specified
|
||||
* at device creation time then pQueue will return VK_NULL_HANDLE."
|
||||
*/
|
||||
if (queue && queue->flags == pQueueInfo->flags)
|
||||
*pQueue = vk_queue_to_handle(queue);
|
||||
else
|
||||
*pQueue = VK_NULL_HANDLE;
|
||||
struct vk_queue *queue = NULL;
|
||||
vk_foreach_queue(iter, device) {
|
||||
if (iter->queue_family_index == pQueueInfo->queueFamilyIndex &&
|
||||
iter->index_in_family == pQueueInfo->queueIndex &&
|
||||
iter->flags == pQueueInfo->flags) {
|
||||
queue = iter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
*pQueue = queue ? vk_queue_to_handle(queue) : VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue