Device::Initialize picks GPU and queue family without checking presentation support or required extensions #161
Labels
No labels
claude:blocked
claude:done
claude:failed
claude:in-progress
claude:ready
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Catcrafts/Crafter.Graphics#161
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Device::Initializepicks the physical device and the queue family without checking that either can do what the library needs. Both work on the machines tested so far (single-queue-family GPUs, one usable GPU), so this is a robustness issue found by reading the code, not a reproduced failure. Line numbers refer to6aa0338.1. Presentation support is never queried
implementations/Crafter.Graphics-Device.cpp:712-719takes the first queue family withVK_QUEUE_GRAPHICS_BIT. That queue is later used forvkQueuePresentKHR.vkGetPhysicalDeviceSurfaceSupportKHRis not called anywhere in the tree, although the spec requires the surface to be supported by the device and queue family the swapchain is used with.Because the device is created before any
Windowexists, the platform query fits here:vkGetPhysicalDeviceWaylandPresentationSupportKHR/vkGetPhysicalDeviceWin32PresentationSupportKHRper queue family.2. The physical device is chosen by type alone
:616-652scores devices bydeviceTypeonly (discrete 5, integrated 4, virtual 3, CPU 2, other 1) and keeps the first of the best score. It does not look at the API version, the required extensions, or presentation support.On a machine with several GPUs this can pick a device that cannot run the library while another one could. The descriptor-set fallback change (pending) at least makes that fail with the names of the missing extensions instead of a bare
VK_ERROR_EXTENSION_NOT_PRESENT, but the selection itself is unchanged. There is also no way for an application or user to override the choice.Suggested fix