jakobhellermann / bevy-inspector-egui

Inspector plugin for the bevy game engine
Apache License 2.0
1.12k stars 166 forks source link

Panics on Nvidia + Wayland #145

Open dag-h opened 12 months ago

dag-h commented 12 months ago

When enabling the plugin on a system running Wayland with Nvidia graphics, the application panics:

thread '<unnamed>' panicked at 'wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `<CommandBuffer-(0, 2, Vulkan)>`
    In a set_pipeline command
      note: render pipeline = `egui render pipeline`
    Render pipeline targets are incompatible with render pass
    Incompatible color attachments at indices [0]: the RenderPass uses textures with formats [Some(Bgra8UnormSrgb)] but the RenderPipeline uses attachments with formats [Some(Bgra8Unorm)]

', /home/dag/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.3/src/backend/direct.rs:3019:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in exclusive system `bevy_render::renderer::render_system`!
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', /home/dag/.cargo/registry/src/index.crates.io-6f17d22bba15001f/bevy_render-0.11.0/src/pipelined_rendering.rs:135:45

AdapterInfo { name: "NVIDIA GeForce GTX 970", vendor: 4318, device: 5058, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "535.54.03", backend: Vulkan }

I'm assuming it has to do with this particular system configuration. Related:

rbrauer commented 11 months ago

I have the same issue and I had the issue with my own code as well. I fixed it by changing texture format:

            texture_descriptor: TextureDescriptor {
                label: None,
                size: ext,
                dimension: TextureDimension::D2,
                // 0.11.0
                // format: TextureFormat::Rgba8Unorm,
                format: TextureFormat::Rgba8UnormSrgb,
                mip_level_count: 1,
                sample_count: 1,
                usage:
                    TextureUsages::TEXTURE_BINDING |
                    TextureUsages::COPY_DST |
                    TextureUsages::RENDER_ATTACHMENT,
                view_formats: &[]
            },
enaut commented 10 months ago

I fixed it by changing texture format

could you elaborate what you changed and where? Do I need to change the bevy-inspector-egui source? Or ist the texture_descriptor somewhere in my source code (in some default or something).

rbrauer commented 10 months ago

This looks like the issue https://github.com/mvlabat/bevy_egui/issues/192 I was able to fix it with that one line change in my own simple code, but not sure precisely what the fix would be with bevy_egui or if it is possible to make it work without changing the source code.