bevyengine / bevy

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

3D causes wgpu error spam in console when using GLES #13115

Open inodentry opened 7 months ago

inodentry commented 7 months ago

Bevy version

0.13.2; main (9d59e52bb0deb7ae4ea002541bd8cbf2ccb0b4eb)

Relevant system information

SystemInfo { os: "Linux 39 Fedora Linux Asahi Remix", kernel: "6.8.7-402.asahi.fc39.aarch64+16k", cpu: "Icestorm-M1-Pro", core_count: "10", memory: "30.9 GiB" }

AdapterInfo { name: "Apple M1 Pro (G13S C0)", vendor: 65541, device: 0, device_type: IntegratedGpu, driver: "", driver_info: "", backend: Gl }

What you did

Run any Bevy app that does 3D rendering with StandardMaterial. As an easy reproduction, you can try the pbr example, or the 3d_scene example.

WGPU_BACKEND=gl cargo run --features wayland --example pbr

What went wrong

The console/log is filled with messages like:

2024-04-27T09:02:59.687567Z 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-04-27T09:02:59.687599Z 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`

The app runs fine, rendering is working, everything looks correct. But these messages are very annoying. They are output every frame and drown out everything else in the console. I have to set custom log filters to hide them.

Additional information

On Asahi Linux, Bevy seems to default to CPU Vulkan rendering, which, besides being very slow, does not produce the messages above (which come from wgpu's GLES backend). To actually use the GPU, you have to set WGPU_BACKEND=gl. Asahi does not yet have a GPU Vulkan driver.

(this behavior may be related to #13113 ; for some reason Bevy seems to be choosing CPU Vulkan on systems with a perfectly usable GPU GL driver)

Further, when you set the backend to GLES, Bevy does not want to run in XWayland. It fails to initialize the window. That's a separate bug. So to get Bevy to run, you need to enable --features wayland to run natively under Wayland, which works.

valaphee commented 7 months ago

Probably solved by https://github.com/bevyengine/bevy/pull/13132 not because of #13113 but more over the fact that 0.20.0 also prefers OpenGL instead of OpenGL ES

ByteNybbler commented 5 months ago

Probably solved by #13132 not because of #13113 but more over the fact that 0.20.0 also prefers OpenGL instead of OpenGL ES

I tried running the 2D shapes example on v0.14.0-rc.3 which includes wgpu 0.20, but I'm getting the same error spam, so the issue hasn't been fixed yet:

$ cargo run --example 2d_shapes
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.64s
     Running `target\debug\examples\2d_shapes.exe`
2024-06-27T02:26:26.290667Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 10 Home", kernel: "19045", cpu: "Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz", core_count: "4", memory: "15.9 GiB" }
2024-06-27T02:26:26.813769Z  INFO bevy_render::renderer: AdapterInfo { name: "Intel(R) HD Graphics 4600", vendor: 32902, device: 0, device_type: IntegratedGpu, driver: "OpenGL", driver_info: "4.3.0 - Build 20.19.15.4531", backend: Gl }
2024-06-27T02:26:27.932760Z  WARN bevy_pbr::ssao: ScreenSpaceAmbientOcclusionPlugin not loaded. GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING.
2024-06-27T02:26:27.934359Z  INFO bevy_winit::system: Creating new window "App" (Entity { index: 0, generation: 1 })
2024-06-27T02:26:28.619440Z ERROR log: 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-06-27T02:26:28.619515Z ERROR log: 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`

As you can see, I'm running Windows, so this issue actually isn't specific to Linux.

I will test this again after https://github.com/bevyengine/bevy/pull/12849 is merged.

Wuketuke commented 3 months ago

i also have a similar issue on my machine first messages when starting the program:

2024-08-01T07:25:41.816946Z ERROR wgpu_hal::vulkan::instance: GENERAL [../src/amd/vulkan/radv_device.c:741 (0x0)]
    Device '/dev/dri/renderD128' is not using the AMDGPU kernel driver: Invalid argument (VK_ERROR_INCOMPATIBLE_DRIVER)    
2024-08-01T07:25:41.816987Z ERROR wgpu_hal::vulkan::instance:   objects: (type: INSTANCE, hndl: 0x5590ec4d11d0, name: ?)    
2024-08-01T07:25:41.823856Z  INFO bevy_render::renderer: AdapterInfo { name: "KAVERI (, LLVM 15.0.6, DRM 2.50, 6.1.0-23-amd64)", vendor: 4098, device: 0, device_type: Other, driver: "OpenGL", driver_info: "4.5 (Compatibility Profile) Mesa 22.3.6", backend: Gl }
2024-08-01T07:25:41.959318Z  WARN bevy_pbr::ssao: ScreenSpaceAmbientOcclusionPlugin not loaded. GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING.
2024-08-01T07:25:41.959709Z  INFO bevy_winit::system: Creating new window "App" (Entity { index: 0, generation: 1 })
2024-08-01T07:25:41.960020Z  INFO winit::platform_impl::linux::x11::window: Guessed window scale factor: 1.1999918619791667

the error spam:

2024-08-01T07:25:42.123364Z 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`    

literally my whole code:

use bevy::prelude::*;

pub fn tower_defense_main() {
    App::new()
        .insert_resource(ClearColor(Color::srgb(0.2, 0.2, 0.2)))
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, spawn_camera)
        .run();
}

fn spawn_camera(mut commands: Commands) {
    commands.spawn(Camera3dBundle {
        transform: Transform::from_xyz(-2.0, 2.5, 5.0) // fmt
            .looking_at(Vec3::ZERO, Vec3::Y),
        ..default()
    });
}

bevy version = 0.14.0 (taken from Cargo.lock)

Kofoten commented 3 months ago

Does anyone have a solution for this or know what is causing them? I am getting the same kind of errors and it seems to happen no matter if rendering 3D or 2D. The errors are also present in the examples.


2024-08-09T18:59:21.685636Z 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-08-09T18:59:21.685661Z 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`    
ByteNybbler commented 3 months ago

Does anyone have a solution for this or know what is causing them?

It seems to be an error specific to using old OpenGL backends that are missing specific features. If your GPU has support for a different backend, you can switch backends by setting the WGPU_BACKEND environment variable to a different value before running the app. Alternatively, you could probably filter out errors from wgpu_hal::gles by setting RUST_LOG.

My belief is that this issue might get fixed by https://github.com/bevyengine/bevy/pull/12849 but I'm not certain about that.

Ashe commented 3 months ago

If it helps, I'm running bevy on a steamdeck so maybe in my case its a specific unsupported GPU or something? GPU: AMD ATI AMD Custom GPU 0405

tliron commented 3 months ago

I'm seeing similar errors with 2D and OpenGL:

2024-08-22T20:15:34.715525Z  INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon RX 6500 XT (radeonsi, navi24, LLVM 17.0.6, DRM 3.57, 6.10.5-100.fc39.x86_64)", vendor: 4098, device: 0, device_type: Other, driver: "OpenGL", driver_info: "4.6 (Compatibility Profile) Mesa 23.3.6", backend: Gl }
2024-08-22T20:15:34.840799Z  WARN bevy_pbr::ssao: ScreenSpaceAmbientOcclusionPlugin not loaded. GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING.
2024-08-22T20:15:34.911203Z 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-08-22T20:15:34.911263Z ERROR wgpu_hal::gles: wgpu-hal heuristics assumed that the view dimension will be equal to `D2` rather than `D2Array`.
ByteNybbler commented 1 month ago

The error spam seems to be fixed for 2D apps as of v0.14.2, possibly due to the removal of PBR functionality from bevy's 2D rendering. However, the error spam still exists in 3D apps.

xcorat commented 1 week ago

Not sure if this is related, but I had the same error, but changing the backend to vulkan (after installing the drivers and restarting,) worked. I don't understand exactly what the problem is, and would love to..

OS: openSUSE Tumbleweed, CPU: 8 × Intel® Core™ i5-8265U CPU @ 1.60GHz Graphics: Mesa Intel® UHD Graphics 620 Platform: Wayland

Errors: env WGPU_BACKEND=gl RUST_LOG=wgpu=debug cargo run --example 3d_scene Works: env WGPU_BACKEND=vulkan RUST_LOG=wgpu=debug cargo run --example 3d_scene