-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Panic in bevy_render when acquiring next swapchain texture #3606
Comments
I have this problem as well with new bevy 0.6
Using arch linux, wayland |
I tested this on my laptop running Arch Linux on Wayland, where it works perfectly on the integrated Intel GPU. @nyvs which GPU are you trying to run this on? My desktop where this is occurring is running an AMD 5700XT. |
Hello @Herbstein |
Got similar specs - Arch Linux 5.15.13-arch1-1, RX 5700XT, X11, Bevy 0.6 and it works for me just fine, tried both Vulcan drivers |
how do you switch between vulcan drivers @k-brk ? |
@nyvs I have removed one and installed another via pacman, something like this(or other way around, depending which you have installed)
|
@nyvs this should find you well: https://wiki.archlinux.org/title/Vulkan#Selecting_Vulkan_driver. Otherwise, make sure you have the Some more points on my own troubles:
|
Thank you both very much, I played around with AMD_VULKAN_ICD and you are correct, when setting it to RADV, it works perfectly. I uninstalled @Herbstein Has changing to RADV solved your problem as well? |
Yup, solved it completely. Looking at a few benchmarks it seems that RADV is faster than AMDVLK in some tasks and matches it in others. That is gaming-wide tasks, not bevy specific. The crash is still a problem, however, since AMDVLK is the default installation for a lot of people, and it takes precedence over RADV. |
The breakout example works fine for me out of the box:
But running the above example results in:
|
@joshuataylor which driver do you use? |
Not sure regarding driver (I think it's radeon?), but forcing RADV seems to work. 2022-01-10T12:51:51.277637Z INFO winit::platform_impl::platform::x11::window: Guessed window scale factor: 1.1666666666666667
|
Your default driver is AMDVLK. When the AdapterInfo doesn't mention RADV you're using AMDVLK. Uninstall the Still, bevy shouldn't crash with what is for many people the default installed AMD driver. |
Can someone running App::new()
.insert_resource(WindowDescriptor {
vsync: false,
..Default::default()
})
.add_plugins(DefaultPlugins) |
Running with |
Thank you setting |
It would help if people who can reproduce the issue could run wgpu's examples and see if it happens there as well. |
I haven't been able to trigger it any of the examples from Change the |
Could it be just some shader taking abnormally long amount of time to execute? Or going into an infinite loop, confusing the driver, etc? Then we'd see the |
Posted to the original issue already but just in case. Since 5.10.91 kernel patch I don't experience this issue. 5.10.88 was last know kernel I had this issue with. I'm using NixOS unstable (don't know what kernel Arch ships). There is a lot of contradicting information so I'm no longer sure about it. But from my testing of multiple combinations of kernels, hw drivers and vulkan drivers I think the problem was with open source driver and that vsync made the issue worse. From my testing the fix was either to switch to proprietary driver or to update kernel (and thus amdgpu). |
Just did another round of testing (vsync enabled) with the same result. corrections: now trying more times I got to the error with AMDVLK. So I think it makes sense to switch to RADV. You can also have both and switch between them using |
I'm running kernel 5.15.12 and still get the problem reliably with AMDVLK still. I'm fully updated. |
Kernel 5.12.17, Mesa 21.3.5. Have the same issue with AMDVLK, down to it not being a problem with any of the WGPU examples I've attempted to run. Even verified by removing AMDVLK and ensuring I was only on RADV, and then it worked without disabling vsync. |
WGPU_BACKEND=gl cargo run |
Reporting a failure also on my machine (Ubuntu 20.04, AMD RX 6000 series, latest AMD drivers (21.50)). Attempts:
|
Same failure, AMD GPU, latest driver and software on Arch linux.
|
Same issue for me. For people wondering about the vsync option: It doesn't exist any more. This is the default, spelled out explicitly:
and crashes with a timeout whereas EDIT: FIFO present mode does work under wayland, but not x11 or xwayland. |
Had this problem as well as detailed in discord thread: https://discord.com/channels/691052431525675048/749690364792668301/983133065834532884 Using I'll remove |
Same issue here, also solved by setting |
I experience the same symptoms as in the original issue (i.e. `Failed to acquire next swap chain texture!: Timeout'), but only under certain circumstances running on Linux with X11 and an AMD card:
Especially for the first case, I wonder whether a hard crash is the right course of action for such a (Setting env-vars such as |
I was about to create a new issue, but adding to this one is better. Here is details on what happens to me When running my game, using the amdgpu-pro drivers (literally just
This doesn't occur with the default Precise steps:
Note that if [profile.dev.package."*"]
opt-level = 2 Environmentbevy: 0.8.1 & 0.9.0-dev (tried Working driver is WorkaroundSetting the .insert_resource(WindowDescriptor {
#[cfg(target_os = "linux")]
present_mode: bevy::window::PresentMode::Immediate,
..default()
}) SolutionThe error seems to be in RelatedA few known issues occur at the same place: |
# Objective - Fix bevyengine#3606 - Fix bevyengine#4579 - Fix bevyengine#3380 ## Solution When running on a Linux machine with some AMD or Intel device, when calling `surface.get_current_texture()`, ignore `wgpu::SurfaceError::Timeout` errors. ## Alternative An alternative solution found in the `wgpu` examples is: ```rust let frame = surface .get_current_texture() .or_else(|_| { render_device.configure_surface(surface, &swap_chain_descriptor); surface.get_current_texture() }) .expect("Error reconfiguring surface"); window.swap_chain_texture = Some(TextureView::from(frame)); ``` See: <https://github.com/gfx-rs/wgpu/blob/94ce76391b560a66e36df1300bd684321e57511a/wgpu/examples/framework.rs#L362-L370> Veloren [handles the Timeout error the way this PR proposes to handle it](gfx-rs/wgpu#1218 (comment)). The reason I went with this PR's solution is that `configure_surface` seems to be quite an expensive operation, and it would run every frame with the wgpu framework solution, despite the fact it works perfectly fine without `configure_surface`. I know this looks super hacky with the linux-specific line and the AMD check, but my understanding is that the `Timeout` occurrence is specific to a quirk of some AMD drivers on linux, and if otherwise met should be considered a bug. Co-authored-by: Carter Anderson <[email protected]>
Bevy version
0.6
Operating system & version
Manjaro Gnome (Wayland)
What you did
Tried to run the button UI example, then tried to run the most basic piece of rendering Bevy code:
What you expected to happen
A blank window with the default clear color.
What actually happened
A panic when acquiring "next swapchain texture". The specific panic message:
Additional information
When running with the default windowing config (X11 through
winit
) the application hangs after closing the window, while it "destroys 2 command encoders" and exists properly when enabling Wayland inbevy_winit
. The log below is withWayland
enabled. Only the last log line is different on X11.The full log at the
INFO
level:If it's any help, I can confirm that
vkcube
works perfectly on the system.The text was updated successfully, but these errors were encountered: