![vkcube 黑色显示屏](https://linux22.com/image/941668/vkcube%20%E9%BB%91%E8%89%B2%E6%98%BE%E7%A4%BA%E5%B1%8F.png)
我正在尝试开始进行一些 Vulkan 编程,但在开发环境方面遇到了困难。在尝试排除故障时,我遇到了一些可能说明我的配置问题的问题。我该如何纠正这些开发环境问题以使 Vkcube 正常工作?
维科立方体
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0
vulkaninfo | head -n 0
ERROR: [Loader Message] Code 0 : /usr/lib/i386-linux-gnu/libvulkan_intel.so: wrong ELF class: ELFCLASS32
ERROR: [Loader Message] Code 0 : /usr/lib/i386-linux-gnu/libvulkan_radeon.so: wrong ELF class: ELFCLASS32
ERROR: [Loader Message] Code 0 : /usr/lib/i386-linux-gnu/libvulkan_lvp.so: wrong ELF class: ELFCLASS32
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
uname -a
Linux ndconv 5.11.0-37-generic #41~20.04.2-Ubuntu SMP Fri Sep 24 09:06:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
nvidia-smi
NVIDIA-SMI 460.91.03 Driver Version: 460.91.03 CUDA Version: 11.2
印西-Gx
Graphics: Device-1: Intel HD Graphics 630 vendor: Lenovo driver: i915 v: kernel bus ID: 00:02.0
Device-2: NVIDIA GP106M [GeForce GTX 1060 Mobile] vendor: Lenovo driver: nvidia
v: 460.91.03 bus ID: 01:00.0
Display: x11 server: X.Org 1.20.11 driver: modesetting,nvidia unloaded: fbdev,nouveau,vesa
tty: N/A
OpenGL: renderer: GeForce GTX 1060 with Max-Q Design/PCIe/SSE2 v: 4.6.0 NVIDIA 460.91.03
direct render: Yes
VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json
cat $VK_ICD_FILENAMES | grep " "
"library_path": "libGLX_nvidia.so.0",
"api_version" : "1.2.155"
hwinfo --gfxcard
...
Device: pci 0x1c20 "GP106M [GeForce GTX 1060 Mobile]"
...
Driver Status: nvidiafb is not active
Driver Status: nouveau is not active
Driver Status: nvidia_drm is active
Driver Status: nvidia is active
显然,vulkaninfo 的 32 位错误只是 vulkan 尝试了所有可用的驱动程序。请参阅:Nvidia 上的 Vulkaninfo 输出错误
尝试警告中的命令没有帮助(如建议的那样:https://www.reddit.com/r/wine_gaming/comments/m7ircp/mesaintel_warning_performance_support_disabled/)。
尝试过https://github.com/SaschaWillems/Vulkan作为健全性测试,看看 Vulkan 是否能工作,而 Vkcube 却不能。屏幕仍然黑着。可能是驱动程序配置错误。
变化很小,尝试下载最新的 vulkan 版本。 https://vulkan.lunarg.com/doc/sdk/1.2.189.0/linux/getting_started.html
Download, extract
source ~/vulkan/1.x.yy.z/setup-env.sh
vkcube works
我将其下载到应用程序文件夹并在那里解压。然后我在 ~/.bashrc 的末尾添加了以下几行。
export VULKAN_SDK=~/applications/1.2.189.0/x86_64
export PATH=$VULKAN_SDK/bin:$PATH
export LD_LIBRARY_PATH=$VULKAN_SDK/lib:$LD_LIBRARY_PATH
export VK_LAYER_PATH=$VULKAN_SDK/etc/vulkan/explicit_layer.d
当我尝试运行示例时,仍然出现错误(或空白屏幕)...
git clone https://github.com/SaschaWillems/Vulkan.git
cd Vulkan
python download_assets.py
cmake CMakeLists.txt
make
cd bin
./triangle
清除 mesa-vulkan-drivers 后一切正常。
sudo apt-get purge --auto-remove mesa-vulkan-drivers
restart, and try ./triangle again (worked)
为了进行健全性检查,我注释掉了之前添加的 ~/.bashrc 行,然后重复了之前的克隆步骤,一切正常。
答案1
对 OP 来说没用,但对于其他 nvidia 系统可以尝试export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json
这来自于月球论坛帖子。