Open SuperSamus opened 1 year ago
Hmm... I tried on the Bottles flatpak on my AMD laptop, but there doesn't seem to be anything interesting in vulkaninfo
:
VK_LAYER_VKBASALT_post_processing (a post processing layer) Vulkan version 1.3.223, layer version 1:
Layer Extensions: count = 0
Devices: count = 2
GPU id = 0 (AMD Radeon Graphics (RADV RENOIR))
Layer-Device Extensions: count = 0
GPU id = 1 (llvmpipe (LLVM 14.0.6, 256 bits))
Layer-Device Extensions: count = 0
I don't like the current approach, so I'm definitely open to suggestions.
This extension is only there if vkBasalt is available, so grepping the result could be a good way to see if it's available or not
Good point. I wonder how we could detect the location automatically.
It seems that there is a vkBasalt.json in /usr/share/vulkan/implicit_layer.d
, like MangoHud. Maybe this path is standard, or there's a way to get the path of this folder with a vulkan command?
It seems that there is a vkBasalt.json in
/usr/share/vulkan/implicit_layer.d
, like MangoHud. Maybe this path is standard, or there's a way to get the path of this folder with a vulkan command?
After two days of researching, no. If we use the vulkan
library, then the process is complicated.
What @SuperSamus suggested seems to be the easiest and most maintainable approach, thanks! I don't think we will need to find paths, as vulkaninfo
provides necessary information for layers:
$ vulkaninfo
...
VK_LAYER_MANGOAPP_overlay (Mangoapp Layer) Vulkan version 1.3.0, layer version 1:
Layer Extensions: count = 0
Devices: count = 2
GPU id = 0 (AMD Radeon Graphics (RADV RENOIR))
Layer-Device Extensions: count = 0
GPU id = 1 (llvmpipe (LLVM 15.0.7, 256 bits))
Layer-Device Extensions: count = 0
VK_LAYER_MANGOHUD_overlay (Vulkan Hud Overlay) Vulkan version 1.3.0, layer version 1:
Layer Extensions: count = 0
Devices: count = 2
GPU id = 0 (AMD Radeon Graphics (RADV RENOIR))
Layer-Device Extensions: count = 0
GPU id = 1 (llvmpipe (LLVM 15.0.7, 256 bits))
Layer-Device Extensions: count = 0
...
VK_LAYER_VKBASALT_post_processing (a post processing layer) Vulkan version 1.3.223, layer version 1:
Layer Extensions: count = 0
Devices: count = 2
GPU id = 0 (AMD Radeon Graphics (RADV RENOIR))
Layer-Device Extensions: count = 0
GPU id = 1 (llvmpipe (LLVM 15.0.7, 256 bits))
Layer-Device Extensions: count = 0
The cool part about vulkaninfo
is that we can use it to check if Vulkan exists too. If it fails, the error looks like this:
❯ vulkaninfo
ERROR: [Loader Message] Code 0 : vkCreateInstance: Found no drivers!
Cannot create Vulkan instance.
This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan.
ERROR at /build/vulkan-tools/src/Vulkan-Tools-1.3.235/vulkaninfo/vulkaninfo.h:674:vkCreateInstance failed with ERROR_INCOMPATIBLE_DRIVER
Also, for the course I'm taking, I am developing overlay, which is a vkBasalt and MangoHud manager. Once I'm done with this, I'll use that as a library for Bottles.
Currently, Bottles checks whether vkBasalt is installed or not by checking some paths, and returning True if at least one of them exists. https://github.com/bottlesdevs/Bottles/blob/bfa8d25e8a336aecaf694722ea954d1f4142b8b0/bottles/backend/globals.py#L45-L54 However, just because vkBasalt is in one of these paths, it doesn't mean it is enabled. (The opposite might also apply: vkBasalt might be enabled without being in any of the paths.) These situations might happen for example in distros that don't respect FHS, like NixOS. I'm not a Vulkan expert, so I'm not really sure on what is the best alternative. An idea could be executing
vulkaninfo
andgrep
pingVK_LAYER_VKBASALT_post_processing
.