Unable to run examples on old GPU
My GPU does not support vulkan so I was trying to run the "tictactoe" example (0.1.1) with the gl backend by exporting the according environment variable:
export WGPU_BACKEND=gl
Setting the backend does not seem to work in this case:
[2023-03-01T16:36:39Z INFO ambient] Building Tic Tac Toe
[2023-03-01T16:36:40Z INFO ambient] Done building Tic Tac Toe
[2023-03-01T16:36:40Z INFO ambient::server] Creating server
[2023-03-01T16:36:40Z INFO ambient::server] Created server, running at 192.168.178.86:9000
[2023-03-01T16:36:40Z INFO ambient::server] Starting server
/home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/physx-sys-0.8.2/PhysX/physx/source/physx/src/NpScene.cpp (2159) : invalid operation : PxScene::fetchResults: fetchResults() called illegally! It must be called after advance() or simulate()
[2023-03-01T16:36:40Z INFO winit::platform_impl::platform::x11::window] Guessed window scale factor: 1
[2023-03-01T16:36:40Z ERROR wgpu_hal::vulkan::instance] enumerate_adapters: Initialization of an object has failed
[2023-03-01T16:36:40Z ERROR wgpu_hal::vulkan::instance] enumerate_adapters: Initialization of an object has failed
thread 'main' panicked at 'Failed to find an appropiate adapter', /home/runner/work/Ambient/Ambient/crates/gpu/src/gpu.rs:55:14
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'tokio-runtime-worker' panicked at 'A Tokio 1.x context was found, but it is being shutdown.', /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.25.0/src/runtime/time/entry.rs:567:13
Just for comparison I built the bevy breakout example with the same environment variable and it set the backend correctly.
2023-03-01T16:43:06.878129Z INFO bevy_winit::system: Creating new window "Bevy App" (0v0)
2023-03-01T16:43:06.878669Z INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1
2023-03-01T16:43:06.930669Z INFO bevy_render::renderer: AdapterInfo { name: "AMD BARTS (DRM 2.50.0 / 5.15.94-1-MANJARO, LLVM 15.0.7)", vendor: 0, device: 0, device_type: Other, driver: "", driver_info: "", backend: Gl }
2023-03-01T16:43:07.669387Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 22.0.4 Manjaro Linux", kernel: "5.15.94-1-MANJARO", cpu: "Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz", core_count: "2", memory: "7.7 GiB" }
2023-03-01T16:43:09.823850Z INFO bevy_window::system: No windows are open, exiting
2023-03-01T16:43:09.826392Z INFO bevy_winit::system: Closing window 0v0
I am running the "[AMD/ATI] Barts XT [Radeon HD 6870]" on "Manjaro Linux x86_64".
Hm, it looks like we don't include GL for consideration when constructing wgpu: https://github.com/AmbientRun/Ambient/blob/80e0a44793ec86d4ca876bb61055822406fa1eb0/crates/gpu/src/gpu.rs#L41
It looks like GL is unsupported with our version of WGPU, so you may not have success regardless.
That being said, if you'd like to try compiling it yourself, you can pull down Ambient and remove the lines above this: https://github.com/AmbientRun/Ambient/blob/41a6f86c3df12707a02a72b6f4c660fc63cfe6c0/crates/gpu/src/gpu.rs#L48
to allow Ambient to use all backends. That being said, I suspect you'll run into issues with our renderer's use of Multi-Draw Indirect. You can try working around that by using the macOS hack - search for all #[cfg(target_os = "macos")] in crates/gpu and crates/renderer and rearrange the code so that the code gated by the macos feature flags is always on (and remove the non-macOS cases)
If that works for you, we'll consider adding a fallback renderer mode - the reason we haven't done this is because this is much less performant, but I suppose being able to run slowly is better than not being able to run. (cc @FredrikNoren)
#523