mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 00:38:48 +02:00
lavapipe: Fix crash when using zero queues
When using VK_KHR_maintenance9 the user can pass a null pointer to VkDeviceQueueCreateInfo and we will create a dummy queue for them. Tested with new dEQP-VK.pipeline.no_queues.* https://gerrit.khronos.org/c/vk-gl-cts/+/18717 Signed-off-by: spencer-lunarg <spencer@lunarg.com> Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38288>
This commit is contained in:
parent
179e744f75
commit
f8e5e7cd7d
1 changed files with 17 additions and 1 deletions
|
|
@ -1861,8 +1861,24 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateDevice(
|
|||
if (pCreateInfo->queueCreateInfoCount) {
|
||||
assert(pCreateInfo->pQueueCreateInfos[0].queueFamilyIndex == 0);
|
||||
assert(pCreateInfo->pQueueCreateInfos[0].queueCount == 1);
|
||||
result = lvp_queue_init(device, &device->queue, pCreateInfo->pQueueCreateInfos, 0);
|
||||
} else {
|
||||
/* VK_KHR_maintenance9 allows zero queues devices used to compile shaders only.
|
||||
* Since we only ever create a single queue, and it has no hardward backing it,
|
||||
* we can just create a dummy queue on the behalf of the user.
|
||||
*/
|
||||
const float fake_priority = 1.0f;
|
||||
const VkDeviceQueueCreateInfo dummy_create_info = {
|
||||
.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
|
||||
.pNext = NULL,
|
||||
.flags = 0,
|
||||
.queueFamilyIndex = 0,
|
||||
.queueCount = 1,
|
||||
.pQueuePriorities = &fake_priority
|
||||
};
|
||||
result = lvp_queue_init(device, &device->queue, &dummy_create_info, 0);
|
||||
}
|
||||
result = lvp_queue_init(device, &device->queue, pCreateInfo->pQueueCreateInfos, 0);
|
||||
|
||||
if (result != VK_SUCCESS) {
|
||||
vk_free(&device->vk.alloc, device);
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue