KhronosGroup / KhronosGroup/Vulkan-Tools

vkcube with VK_KHR_display fails when acquirable displays are on not-the-first physical devices

Open
#308 6 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
491
Forks
202
Avg merge
1h 37m
Merged PRs (30d)
4

Description

The way that vkcube's support for `VK_KHR_display` is implemented, vkcube fails when no direct-to-display `VkDisplayKHR` can be acquired on the `vkPhysicalDevice` that is sorted first in the list of physical devices, even when additional physical devices do have displays that can be acquired.

This is an app bug. It prevents using vkcube to test some multi-GPU scenarios.

This bug happens because vkcube is "lazy" in how it selects a physical device. It always selects the first physical device, even if this physical device does not have any displays that can be acquired.

``` if (gpu_count > 0) {
VkPhysicalDevice *physical_devices = malloc(sizeof(VkPhysicalDevice) * gpu_count);
err = vkEnumeratePhysicalDevices(demo->inst, &gpu_count, physical_devices);
assert(!err);
/* For cube demo we just grab the first physical device */
demo->gpu = physical_devices[0];
```

`demo->gpu` is hard-coded to the first physical device without regard to the presence of an acquirable display on the physical device.

Contributor guide

Open the contributing guide

Research direction

Locate vkcube's physical-device enumeration and selection entry point, starting from the shown vkEnumeratePhysicalDevices call and demo->gpu assignment. Verify the behavior with multiple physical devices where only a later device has an acquirable display; done means vkcube selects a usable device instead of always using the first one.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.