bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.58k stars 3.52k forks source link

Wgpu error doesn't let my bevy 0.13.0 project that I updated to bevy 0.14.0 work #14213

Open Silver-Sorbet opened 3 months ago

Silver-Sorbet commented 3 months ago

Bevy version

0.14.0

[Optional] Relevant system information

cargo 1.79.0 (ffa9cf99a 2024-06-03)

Arch linux latest stable and wayland (hyprland)

AdapterInfo { name: "Mesa Intel(R) HD Graphics 4000 (IVB GT2)", vendor: 32902, device: 0, device_type: IntegratedGpu, driver: "OpenGL", driver_info: "4.2 (Compatibility Profile) Mesa 24.1.3-arch1.1", backend: Gl }

Using lavapipe because gpu doesn't support vulkan

What you did

I updated my bevy 13.0 project into a bevy 14.0 project. I fixed the code so that the version works, but now it won't run because of wgpu. It worked before updating

Additional information

Here are the errors

2024-07-08T01:00:58.508971Z ERROR wgpu_core::device::global: surface configuration failed: incompatible window kind    
thread 'Compute Task Pool (0)' panicked at /home/bintouali/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.20.1/src/backend/wgpu_core.rs:751:18:
Error in Surface::configure: Validation Error

Caused by:
    Invalid surface

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::view::window::create_surfaces`!
2024-07-08T01:00:58.536984Z ERROR wgpu_hal::gles: wgpu-hal heuristics assumed that the view dimension will be equal to `Cube` rather than `CubeArray`.
`D2` textures with `depth_or_array_layers == 1` are assumed to have view dimension `D2`
`D2` textures with `depth_or_array_layers > 1` are assumed to have view dimension `D2Array`
`D2` textures with `depth_or_array_layers == 6` are assumed to have view dimension `Cube`
`D2` textures with `depth_or_array_layers > 6 && depth_or_array_layers % 6 == 0` are assumed to have view dimension `CubeArray`    
2024-07-08T01:00:58.537009Z ERROR wgpu_hal::gles: wgpu-hal heuristics assumed that the view dimension will be equal to `D2` rather than `D2Array`.
`D2` textures with `depth_or_array_layers == 1` are assumed to have view dimension `D2`
`D2` textures with `depth_or_array_layers > 1` are assumed to have view dimension `D2Array`
`D2` textures with `depth_or_array_layers == 6` are assumed to have view dimension `Cube`
`D2` textures with `depth_or_array_layers > 6 && depth_or_array_layers % 6 == 0` are assumed to have view dimension `CubeArray`    
2024-07-08T01:00:58.552787Z ERROR wgpu::backend::wgpu_core: Shader translation error for stage ShaderStages(COMPUTE): The selected version doesn't support Features(DYNAMIC_ARRAY_SIZE)    
2024-07-08T01:00:58.552835Z ERROR wgpu::backend::wgpu_core: Please report it to https://github.com/gfx-rs/wgpu    
2024-07-08T01:00:58.552861Z ERROR wgpu::backend::wgpu_core: Handling wgpu errors as fatal by default    
thread 'Async Compute Task Pool (0)' panicked at /home/bintouali/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.20.1/src/backend/wgpu_core.rs:2996:5:
wgpu error: Validation Error

Caused by:
    In Device::create_compute_pipeline
      note: label = `mesh preprocessing (GPU culling)`
    Internal error: The selected version doesn't support Features(DYNAMIC_ARRAY_SIZE)

2024-07-08T01:00:58.558921Z ERROR wgpu::backend::wgpu_core: Shader translation error for stage ShaderStages(COMPUTE): The selected version doesn't support Features(DYNAMIC_ARRAY_SIZE)    
2024-07-08T01:00:58.558967Z ERROR wgpu::backend::wgpu_core: Please report it to https://github.com/gfx-rs/wgpu    
2024-07-08T01:00:58.558997Z ERROR wgpu::backend::wgpu_core: Handling wgpu errors as fatal by default    
thread 'Async Compute Task Pool (0)' panicked at /home/bintouali/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.20.1/src/backend/wgpu_core.rs:2996:5:
wgpu error: Validation Error

Caused by:
    In Device::create_compute_pipeline
      note: label = `mesh preprocessing (direct)`
    Internal error: The selected version doesn't support Features(DYNAMIC_ARRAY_SIZE)
dothanhtrung commented 2 months ago

Got similar error on Fedora 40 + KDE Plasma Wayland with bevy 0.14.

MESA-INTEL: warning: Ivy Bridge Vulkan support is incomplete
2024-07-10T03:57:39.157136Z  INFO bevy_render::renderer: AdapterInfo { name: "Mesa Intel(R) HD Graphics 2500 (IVB GT1)", vendor: 32902, device: 0, device_type: IntegratedGpu, driver: "OpenGL", driver_info: "4.2 (Compatibility Profile) Mesa 24.1.2", backend: Gl }
2024-07-10T03:57:39.310162Z  WARN bevy_pbr::ssao: ScreenSpaceAmbientOcclusionPlugin not loaded. GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING.
2024-07-10T03:57:39.310655Z  INFO bevy_winit::system: Creating new window "FINB" (Entity { index: 0, generation: 1 })
2024-07-10T03:57:39.311295Z  INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1
2024-07-10T03:57:39.353125Z ERROR wgpu_core::device::global: surface configuration failed: incompatible window kind    
thread 'Compute Task Pool (1)' panicked at /home/trungdt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.20.1/src/backend/wgpu_core.rs:751:18:
Error in Surface::configure: Validation Error

Caused by:
    Invalid surface

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::view::window::create_surfaces`!
2024-07-10T03:57:39.409557Z ERROR wgpu::backend::wgpu_core: Shader translation error for stage ShaderStages(COMPUTE): The selected version doesn't support Features(DYNAMIC_ARRAY_SIZE)    
2024-07-10T03:57:39.409588Z ERROR wgpu::backend::wgpu_core: Please report it to https://github.com/gfx-rs/wgpu    
2024-07-10T03:57:39.409602Z ERROR wgpu::backend::wgpu_core: Handling wgpu errors as fatal by default    
thread 'Async Compute Task Pool (0)' panicked at /home/trungdt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.20.1/src/backend/wgpu_core.rs:2996:5:
wgpu error: Validation Error

Caused by:
    In Device::create_compute_pipeline
      note: label = `mesh preprocessing (GPU culling)`
    Internal error: The selected version doesn't support Features(DYNAMIC_ARRAY_SIZE)

2024-07-10T03:57:39.454569Z ERROR wgpu::backend::wgpu_core: Shader translation error for stage ShaderStages(COMPUTE): The selected version doesn't support Features(DYNAMIC_ARRAY_SIZE)    
2024-07-10T03:57:39.455163Z ERROR wgpu::backend::wgpu_core: Please report it to https://github.com/gfx-rs/wgpu    
2024-07-10T03:57:39.455186Z ERROR wgpu::backend::wgpu_core: Handling wgpu errors as fatal by default    
thread 'Async Compute Task Pool (0)' panicked at /home/trungdt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.20.1/src/backend/wgpu_core.rs:2996:5:
wgpu error: Validation Error

Caused by:
    In Device::create_compute_pipeline
      note: label = `mesh preprocessing (direct)`
    Internal error: The selected version doesn't support Features(DYNAMIC_ARRAY_SIZE)

To game window can be displayed, I need to manually export WGPU_BACKEND=vulkan, which is not required in bevy 0.13.

deavid commented 2 months ago

I have the same error trying to update my FOSS game Unhaunter from 0.13 to 0.14 - I am trying to run it from a Chromebook on the Linux VM. The Vulkan drivers are bad here, and in 0.13 was slow. But it was working, even with wgsl shaders.

I tried the example from Bevy GitHub, and it also fails here:

deavidsedice@penguin:~/rust/bevy/examples$ cargo run --features x11 --example 2d_shapes
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.23s
     Running `/home/deavidsedice/rust/bevy/target/debug/examples/2d_shapes`
2024-07-14T15:54:33.128211Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux 12 Debian GNU/Linux", kernel: "6.6.30-02725-g3e8c91b46252", cpu: "12th Gen Intel(R) Core(TM) i7-1265U", core_count: "12", memory: "29.5 GiB" }
2024-07-14T15:54:33.138664Z  WARN winit::platform_impl::platform::x11::xdisplay: error setting XSETTINGS; Xft options won't reload automatically
2024-07-14T15:54:33.224264Z  INFO bevy_render::renderer: AdapterInfo { name: "virgl (Mesa Intel(R) Graphics (ADL GT2))", vendor: 65541, device: 0, device_type: IntegratedGpu, driver: "OpenGL", driver_info: "4.3 (Compatibility Profile) Mesa 22.3.6", backend: Gl }
2024-07-14T15:54:33.594229Z  WARN bevy_pbr::ssao: ScreenSpaceAmbientOcclusionPlugin not loaded. GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING.
2024-07-14T15:54:33.595347Z  INFO bevy_winit::system: Creating new window "App" (Entity { index: 0, generation: 1 })
2024-07-14T15:54:33.595669Z  INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1.59375
2024-07-14T15:54:33.703834Z ERROR wgpu_core::device::global: surface configuration failed: incompatible window kind    
thread 'Compute Task Pool (1)' panicked at /home/deavidsedice/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.20.1/src/backend/wgpu_core.rs:751:18:
Error in Surface::configure: Validation Error

Caused by:
    Invalid surface

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::view::window::create_surfaces`!
2024-07-14T15:54:33.726578Z ERROR wgpu_hal::gles: wgpu-hal heuristics assumed that the view dimension will be equal to `Cube` rather than `CubeArray`.
`D2` textures with `depth_or_array_layers == 1` are assumed to have view dimension `D2`
`D2` textures with `depth_or_array_layers > 1` are assumed to have view dimension `D2Array`
`D2` textures with `depth_or_array_layers == 6` are assumed to have view dimension `Cube`
`D2` textures with `depth_or_array_layers > 6 && depth_or_array_layers % 6 == 0` are assumed to have view dimension `CubeArray`    
2024-07-14T15:54:33.726634Z ERROR wgpu_hal::gles: wgpu-hal heuristics assumed that the view dimension will be equal to `D2` rather than `D2Array`.
`D2` textures with `depth_or_array_layers == 1` are assumed to have view dimension `D2`
`D2` textures with `depth_or_array_layers > 1` are assumed to have view dimension `D2Array`
`D2` textures with `depth_or_array_layers == 6` are assumed to have view dimension `Cube`
`D2` textures with `depth_or_array_layers > 6 && depth_or_array_layers % 6 == 0` are assumed to have view dimension `CubeArray`    

This is just a clone of Bevy repo, checkout branch 0.14, and run the command.

mockersf commented 2 months ago

All the logs mention picking up the OpenGL backend. Was it working on the 0.13 with Vulkan? Does it work with the 0.14 if you force it to pick Vulkan?

deavid commented 2 months ago

True, if I do:

export WGPU_BACKEND=vulkan

and then re-run the same command line, it works.

Is there any possibility to at least make the error contain any text that indicates how to potentially workaround this? I spent several hours on this and I feel it is very hard to understand even how to google this.

deavid commented 2 months ago

One question though, why doesn't work with GL? like, at all... I get it that not all features are available, but in a Chromebook, running in GL would actually make sense I think. If it worked.

Vulkan here is so slow that I need to build a WASM version and run it on the browser.

codegod100 commented 3 weeks ago

True, if I do:

export WGPU_BACKEND=vulkan

and then re-run the same command line, it works.

Works for me too, fedora 40