无法在 WSL 中使用 OpenGL 3.3+ (Windows 11)

Haz*_*laş 5 nvidia opengl drivers windows-subsystem-for-linux

我的 GPU 和 CPU 均支持 OpenGL 4.6,并且我的驱动程序是最新的。但是,我的 WSL 上的 Ubuntu 20.04 仅支持 3.3 。glxinfo 是这样说的:

glxinfo | grep "OpenGL"
OpenGL vendor string: Microsoft Corporation
OpenGL renderer string: D3D12 (NVIDIA GeForce RTX 3080 Laptop GPU)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 21.2.6
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.1 Mesa 21.2.6
OpenGL shading language version string: 1.40
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 21.2.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:
Run Code Online (Sandbox Code Playgroud)

编辑:我的内核版本是:5.10.60.1

Not*_*1ds 0

正如评论中所述,当使用软件渲染 (LLVM) 时,我的结果显示配置文件为 4.5。

更新我的 nVidia 驱动程序后(显然我已经有一段时间没有更新了),我现在看到了和你一样的事情:

OpenGL renderer string: D3D12 (NVIDIA GeForce RTX 2070 SUPER)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 21.2.6
Run Code Online (Sandbox Code Playgroud)

然而,根据Mesa D3D12页面,该驱动程序仅支持3.3,所以我相信这是可以预料的。


完整结果:

~> glxinfo | grep "OpenGL"

OpenGL vendor string: Microsoft Corporation
OpenGL renderer string: D3D12 (NVIDIA GeForce RTX 2070 SUPER)
OpenGL core profile version string: 3.3 (Core Profile) Mesa 21.2.6
OpenGL core profile shading language version string: 3.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.1 Mesa 21.2.6
OpenGL shading language version string: 1.40
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.0 Mesa 21.2.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.00
OpenGL ES profile extensions:

~> LIBGL_ALWAYS_SOFTWARE=1 glxinfo | grep "OpenGL"

OpenGL vendor string: Mesa/X.org
OpenGL renderer string: llvmpipe (LLVM 12.0.0, 256 bits)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 21.2.6
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.1 Mesa 21.2.6
OpenGL shading language version string: 1.40
OpenGL context flags: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 21.2.6
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:
Run Code Online (Sandbox Code Playgroud)