Linux OpenGL: when context creation fails, bgfx silently falls back to the Noop renderer

オープン
#2,087 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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.getFrameBufferData never calls back.

The real cause (here, eglGetDisplay failing) appears only in a BX_CONFIG_DEBUG trace ("Init error: Failed to get display").

To Reproduce

  1. Build the X11 Playground with GRAPHICS_API=OpenGL on master (ea62d5b).
  2. 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.
  3. 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時間
マージ済み PR(30日)
66

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

BabylonJS/BabylonNative のほかの issue

BabylonJS/BabylonNative の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。