2
votes

My system has the following specs:

GPUs:

  • AMD Radeon(TM) Graphics
  • NVIDIA GeForce RTX 2060 with Max-Q Design

CPU:

  • AMD Ryzen 9 4900HS with Radeon Graphics

When I run vkEnumeratePhysicalDevices() it only returns 1 device, my integrated graphics (AMD Radeon(TM) Graphics). But I figured out that I can force it to use my discrete graphics card if I use the graphics settings in Windows settings (Settings > System > Display > Graphics Settings, then browse to find the build .exe for the Vulkan project and set options to High Performance). However, when I run the Vulkan project now, it still only shows 1 gpu on the system, just it switched to only showing the RTX 2060.

This is obviously not something that one could expect a player of a game to do who has no experience with code (if I was to ever finish a game with Vulkan). I've reasoned that this might be happening because I'm on a laptop, so I tried disabling all power saving settings but nothing changed.

So I'm wondering if there is a way to find all GPUs on the system outside of Vulkan and have the physical device be set out of that list, since Vulkan seems to be unable to find all GPUs at once?

Edit: I figured out that I can get it to see the dedicated GPU if I turn off the integrated GPU in Device Manager, then turn it back on.

Also I am getting the error: validation layer: setupLoaderTrampPhysDevs: Failed during dispatch call of 'vkEnumeratePhysicalDevices' to lower layers or loader to get count.

If Vulkan can't find the drivers for them, it certainly can't get physical devices for them, since in order to do that, it would have to find the drivers for them. Your question is circular: how can I make Vulkan find the things Vulkan can't find? - Nicol Bolas
@NicolBolas But that's the thing, Vulkan can find both of them. It uses the Integrated Graphics by default, and uses the 2060 when I force it to. It just can't find both at the same time. - Braden Yonano
This may be related to driver or even os implementation. My setup of win10 on gtx1650 and uhd630 can find both of the devices in two device groups (one group for each), and can create device from there (using the lunarg vulkan sdk). Also, if you are using windows, dxgi have the functionality, though somewhat limited in sharing etc, to let you choose adapter. It seems linux limits gpu to x or wayland session, and the only option I know of to switch gpu within login is using bumblebee. - shangjiaxuan
Also, the LUID from dxgi is guaranteed to be the same as the enumerated vulkan physical device's LUID (as long as they are the same device on the system), so that you can reliably work on the same device in both api. From The error you are getting, it is very likely that there's driver problem or broken sdk installation on your system. Checking vkconfig from the vulkan sdk tools may be a good start. - shangjiaxuan
@shangjiaxuan I've updated all of my drivers, and I've reinstalled the SDK but the same issue persists. The weirdest part again is that once I disable my integrated graphics card in Device Manager, it manages to find the dedicated GPU. It's like my laptop is hiding my dedicated GPU when the integrated GPU is available. EDIT: In vkconfig it doesn't show anything anomalous except for only finding my integrated GPU. - Braden Yonano