Encountered a panic in system `bevy_render::view::window‌::prepare_windows`!

Hi, folks! :victory_hand:t3: I'm trying Bevy now.

Here's the source code:

xolatgames / Vasya go to Home · GitLab

And compilation process ends successfully, but when I tries to run compiled build I gets this error:

./Vasya-go-to-Home 
2025-05-23T12:07:26.904274Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux (Debian GNU/Linux 12)", kernel: "6.1.0-35-amd64", cpu: "Common KVM processor", core_count: "6", memory: "5.8 GiB" }    
libEGL warning: DRI3: Screen seems not DRI3 capable
libEGL warning: DRI2: failed to authenticate
2025-05-23T12:07:27.038311Z  INFO bevy_render::renderer: AdapterInfo { name: "llvmpipe (LLVM 15.0.6, 128 bits)", vendor: 65541, device: 0, device_type: Cpu, driver: "llvmpipe", driver_info: "Mesa 22.3.6 (LLVM 15.0.6)", backend: Vulkan }
2025-05-23T12:07:27.038468Z  WARN bevy_render::renderer: The selected adapter is using a driver that only supports software rendering. This is likely to be very slow. See https://bevyengine.org/learn/errors/b0006/
2025-05-23T12:07:27.683790Z  INFO bevy_render::batching::gpu_preprocessing: GPU preprocessing is fully supported on this device.
2025-05-23T12:07:27.725079Z  INFO bevy_winit::system: Creating new window Vasya go to his home (0v1)
2025-05-23T12:07:27.725966Z  INFO winit::platform_impl::linux::x11::window: Guessed window scale factor: 1
2025-05-23T12:07:27.736434Z ERROR bevy_asset::server: Path not found: /mnt/Projects/GitLab/vasya-go-to-home/target/debug/assets/images/backgrounds/grass.png
2025-05-23T12:07:28.000552Z ERROR winit::platform_impl::linux: X11 error: XError {
    description: "BadMatch (invalid parameter attributes)",
    error_code: 8,
    request_code: 149,
    minor_code: 4,
}
2025-05-23T12:07:28.000777Z ERROR winit::platform_impl::linux: X11 error: XError {
    description: "BadMatch (invalid parameter attributes)",
    error_code: 8,
    request_code: 149,
    minor_code: 4,
}
2025-05-23T12:07:28.000857Z ERROR winit::platform_impl::linux: X11 error: XError {
    description: "BadMatch (invalid parameter attributes)",
    error_code: 8,
    request_code: 149,
    minor_code: 4,
}

thread 'Compute Task Pool (0)' panicked at /home/plyuha/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bevy_render-0.16.0/src/view/window/mod.rs:275:17:
Couldn't get swap chain texture, operation unrecoverable: The swap chain has been lost and needs to be recreated
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy_render::view::window::prepare_windows`!
2025-05-23T12:07:28.022433Z ERROR bevy_winit::state: winit event loop returned an error: os error at /home/plyuha/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/winit-0.30.10/src/platform_impl/linux/x11/mod.rs:404: Xlib error: X error: BadMatch (invalid parameter attributes) (code: 8, request code: 149, minor code: 4)

How can I solve this issue? :thinking:

Looks like you are inside a VM without GPU support. Maybe using opengl software rendering using WGPU_BACKEND=gl will work better than vulkan software rendering? Still software rendering is going to be slow.

Yeap! It's better. Now I can see the window frame and the clear color, but my project still crashes after a few milliseconds:

WGPU_BACKEND=gl ./Vasya-go-to-Home
2025-05-23T12:44:48.776750Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux (Debian GNU/Linux 12)", kernel: "6.1.0-35-amd64", cpu: "Common KVM processor", core_count: "6", memory: "5.8 GiB" }    
libEGL warning: DRI3: Screen seems not DRI3 capable
libEGL warning: DRI2: failed to authenticate
2025-05-23T12:44:48.897608Z  INFO bevy_render::renderer: AdapterInfo { name: "llvmpipe (LLVM 15.0.6, 128 bits)", vendor: 65541, device: 0, device_type: Cpu, driver: "", driver_info: "4.5 (Core Profile) Mesa 22.3.6", backend: Gl }
2025-05-23T12:44:48.897867Z  WARN bevy_render::renderer: The selected adapter is using a driver that only supports software rendering. This is likely to be very slow. See https://bevyengine.org/learn/errors/b0006/
2025-05-23T12:44:49.517518Z  INFO bevy_render::batching::gpu_preprocessing: GPU preprocessing is fully supported on this device.
2025-05-23T12:44:49.540679Z  WARN bevy_pbr::ssao: ScreenSpaceAmbientOcclusionPlugin not loaded. GPU lacks support: TextureFormat::R16Float does not support TextureUsages::STORAGE_BINDING.
2025-05-23T12:44:49.569649Z  INFO bevy_winit::system: Creating new window Vasya go to his home (0v1)
2025-05-23T12:44:49.570244Z  INFO winit::platform_impl::linux::x11::window: Guessed window scale factor: 1
2025-05-23T12:44:50.186790Z ERROR wgpu::backend::wgpu_core: Shader translation error for stage ShaderStages(COMPUTE): WGSL `textureLoad` from depth textures is not supported in GLSL    
2025-05-23T12:44:50.187089Z ERROR wgpu::backend::wgpu_core: Please report it to https://github.com/gfx-rs/wgpu    
2025-05-23T12:44:50.187367Z ERROR wgpu::backend::wgpu_core: Handling wgpu errors as fatal by default    
2025-05-23T12:44:50.187375Z ERROR wgpu::backend::wgpu_core: Shader translation error for stage ShaderStages(COMPUTE): WGSL `textureLoad` from depth textures is not supported in GLSL    
2025-05-23T12:44:50.187403Z ERROR wgpu::backend::wgpu_core: Please report it to https://github.com/gfx-rs/wgpu    

thread 'Async Compute Task Pool (1)' panicked at /home/plyuha/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-24.0.3/src/backend/wgpu_core.rs:1351:26:
wgpu error: Validation Error

Caused by:
  In Device::create_compute_pipeline, label = 'downsample depth first phase pipeline'
    Internal error: WGSL `textureLoad` from depth textures is not supported in GLSL


note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2025-05-23T12:44:50.190800Z ERROR wgpu::backend::wgpu_core: Handling wgpu errors as fatal by default    

thread 'Async Compute Task Pool (0)' panicked at /home/plyuha/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/wgpu-24.0.3/src/backend/wgpu_core.rs:1351:26:
wgpu error: Validation Error

Caused by:
  In Device::create_compute_pipeline, label = 'downsample depth multisample first phase pipeline'
    Internal error: WGSL `textureLoad` from depth textures is not supported in GLSL


Encountered a panic in system `bevy_render::render_resource::pipeline_cache::PipelineCache::process_pipeline_queue_system`!

So, I want to try one thing now...

Yeap, it was be problems with video drivers :sweat_smile:

Sorry about it, I used both QXL + Virtio + 3D acceleration + OpenGL video drivers, and as I got it - they conflicted with each other.

Now I switched just to QXL. It was be an useless experiment :thinking:, but I switched it many times ago, and I don't know then that it affect so on Bevy.

Do you mean that you added both a qxl and a virtio-gpu device? That is likely to cause Bevy and Xorg to select a different virtual graphics card, which may lead to problems. If you want to try getting 3d acceleration to work, you can try using just virtio-gpu without qxl. (something like -vga none -device virtio-gpu,gl=on may work. haven't tested it though as my local qemu version doesn't support 3d acceleration at all)

As for the panic with OpenGL, the error says that something is trying to use a shader feature that isn't supported with OpenGL.

1 Like

Thanks so much! :+1:t3: I will know :wink: