Linux OpenGL: when context creation fails, bgfx silently falls back to the Noop renderer
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- cpp, linux
调研方向
Start in DeviceImpl.cpp, where bgfx::init is called and the renderer type is never checked, and look at the deviceStillLost path you must leave alone. Compare init.type with bgfx::getRendererType() after init, then make the device throw "bgfx could not initialize the OpenGL renderer" when a non-Noop request comes back as Noop. ShaderProvider.cpp and TestUtils.getFrameBufferData show the symptoms but are not the fix. Done means a failed EGL display setup stops the device with that error instead of running on as Noop.
由索引模型根据 Issue 内容生成。
描述
Describe the bug
When bgfx can't create the OpenGL context, bgfx::init still succeeds: it falls back to RendererType::Noop. DeviceImpl doesn't check for this. Babylon Native keeps running and the render loop spins, but nothing is drawn:
- every effect fails to compile with "Shader compiler assumptions are not met" (
ShaderProvider.cpp), because the Noop renderer's caps don't match OpenGL's; TestUtils.getFrameBufferDatanever calls back.
The real cause (here, eglGetDisplay failing) appears only in a BX_CONFIG_DEBUG trace ("Init error: Failed to get display").
To Reproduce
- Build the X11 Playground with
GRAPHICS_API=OpenGLon master (ea62d5b). - Run it on an NVIDIA GPU with NVIDIA's EGL. On a hybrid laptop:
__NV_PRIME_RENDER_OFFLOAD=1 __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/10_nvidia.json. - Every scene fails to compile its shaders and nothing is drawn. The underlying failure is fixed by #2086.
Expected behavior
If a real renderer was requested (init.type != Noop) and bgfx::getRendererType() comes back as Noop after bgfx::init, without a device loss in progress, the device should fail loudly, for example by throwing "bgfx could not initialize the OpenGL renderer". It should not run on as Noop. The device-lost path (deviceStillLost in DeviceImpl.cpp) may need to keep its current behavior.
Other
- Platform: Linux (X11), OpenGL. Seen on NVIDIA GTX 1660 Ti, driver 620.70.06, Fedora 44.
- 主要语言
- C++
- 星标
- 931
- 派生
- 169
- 平均合并
- 2 天 17 小时
- 30 天内合并 PR
- 66
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
BabylonJS/BabylonNative 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
BabylonJS/BabylonNative#2138 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
BabylonJS/BabylonNative#2042 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
BabylonJS/BabylonNative#2052 ·
维护者通常 1 天内回复
-
testing
难度 4/5 3-5 天 新手友好度 45/100
BabylonJS/BabylonNative#2136 ·
维护者通常 1 天内回复
-
Support useNDCHalfZRange (half-range NDC depth) so Babylon.js half-range depth visual tests can run未关闭
难度 4/5 3-5 天 新手友好度 48/100
BabylonJS/BabylonNative#2134 ·
维护者通常 1 天内回复
查看 BabylonJS/BabylonNative 的全部 Issue