-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Fix surface validation errors in WSL2 environments during window resizing #18246
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
base: main
Are you sure you want to change the base?
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Are you using llvmpipe or the experimental Dozen mesa d3d12 backend? Or something else? When using llvmpipe, I'll get validation errors but it doesn't crash.
If I use Dozen, everything just works. I don't even get validation errors when resizing. I had to compile mesa from scratch though to get this working.
I have to set the allow noncomplient adapter for Dozen. It doesn't report the API version correctly for me.
Are you using X11 or Wayland? Wayland is super buggy for me in WSL2 (at least when using WGPU/Winit/Bevy) |
Bevy reports llvmpipe and I didn't know Dozen existed. Also Wayland, I prefer to work with that and let X rest.
```
WARNING: dzn is not a conformant Vulkan implementation, testing use only.
2025-03-12T03:00:17.769899Z INFO bevy_render::renderer: AdapterInfo { name: "llvmpipe (LLVM 19.1.7, 256 bits)", vendor: 65541, device: 0, device_type: Cpu, driver: "llvmpipe", driver_info: "Mesa 25.0.1 - kisak-mesa PPA (LLVM 19.1.7)", backend: Vulkan }
2025-03-12T03:00:17.769937Z 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/
```
…On Tue, Mar 11, 2025, 18:55 aloucks ***@***.***> wrote:
Are you using llvmpipe or the experimental Dozen mesa d3d12 backend? Or
something else?
When using llvmpipe, I'll get validation errors but it doesn't crash.
2025-03-11T22:49:08.908121Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux (Ubuntu 22.04)", kernel: "5.15.167.4-microsoft-standard-WSL2", cpu: "Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz", core_count: "8", memory: "15.5 GiB" }
2025-03-11T22:49:12.964722Z INFO bevy_render::renderer: AdapterInfo { name: "llvmpipe (LLVM 15.0.7, 256 bits)", vendor: 65541, device: 0, device_type: Cpu, driver: "llvmpipe", driver_info: "Mesa 23.2.1-1ubuntu3.1~22.04.3 (LLVM 15.0.7)", backend: Vulkan }
If I use Dozen, everything just works. I don't even get validation errors
when resizing. I had to compile mesa from scratch though to get this
working.
2025-03-11T22:51:33.064508Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux (Ubuntu 22.04)", kernel: "5.15.167.4-microsoft-standard-WSL2", cpu: "Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz", core_count: "8", memory: "15.5 GiB" }
2025-03-11T22:51:33.072363Z WARN winit::platform_impl::linux::x11::xdisplay: error setting XSETTINGS; Xft options won't reload automatically
WARNING: dzn is not a conformant Vulkan implementation, testing use only.
WARNING: dzn is not a conformant Vulkan implementation, testing use only.
2025-03-11T22:51:36.078912Z INFO bevy_render::renderer: AdapterInfo { name: "Microsoft Direct3D12 (NVIDIA GeForce RTX 2060)", vendor: 4318, device: 7944, device_type: DiscreteGpu, driver: "Dozen", driver_info: "Mesa 25.1.0-devel (git-551770ccf8)", backend: Vulkan }
I have to set the allow noncomplient adapter for Dozen. It doesn't report
the API version correctly for me.
.add_plugins(DefaultPlugins.set(RenderPlugin {
render_creation: RenderCreation::Automatic(WgpuSettings {
instance_flags: InstanceFlags::ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER,
..default()
}),
..default()
}))
—
Reply to this email directly, view it on GitHub
<#18246 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA7UPAZI5EH57MICRGVCXP32T5SX7AVCNFSM6AAAAABYXOI5JWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMJVHA4DCOBVHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
[image: aloucks]*aloucks* left a comment (bevyengine/bevy#18246)
<#18246 (comment)>
Are you using llvmpipe or the experimental Dozen mesa d3d12 backend? Or
something else?
When using llvmpipe, I'll get validation errors but it doesn't crash.
2025-03-11T22:49:08.908121Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux (Ubuntu 22.04)", kernel: "5.15.167.4-microsoft-standard-WSL2", cpu: "Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz", core_count: "8", memory: "15.5 GiB" }
2025-03-11T22:49:12.964722Z INFO bevy_render::renderer: AdapterInfo { name: "llvmpipe (LLVM 15.0.7, 256 bits)", vendor: 65541, device: 0, device_type: Cpu, driver: "llvmpipe", driver_info: "Mesa 23.2.1-1ubuntu3.1~22.04.3 (LLVM 15.0.7)", backend: Vulkan }
If I use Dozen, everything just works. I don't even get validation errors
when resizing. I had to compile mesa from scratch though to get this
working.
2025-03-11T22:51:33.064508Z INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Linux (Ubuntu 22.04)", kernel: "5.15.167.4-microsoft-standard-WSL2", cpu: "Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz", core_count: "8", memory: "15.5 GiB" }
2025-03-11T22:51:33.072363Z WARN winit::platform_impl::linux::x11::xdisplay: error setting XSETTINGS; Xft options won't reload automatically
WARNING: dzn is not a conformant Vulkan implementation, testing use only.
WARNING: dzn is not a conformant Vulkan implementation, testing use only.
2025-03-11T22:51:36.078912Z INFO bevy_render::renderer: AdapterInfo { name: "Microsoft Direct3D12 (NVIDIA GeForce RTX 2060)", vendor: 4318, device: 7944, device_type: DiscreteGpu, driver: "Dozen", driver_info: "Mesa 25.1.0-devel (git-551770ccf8)", backend: Vulkan }
I have to set the allow noncomplient adapter for Dozen. It doesn't report
the API version correctly for me.
.add_plugins(DefaultPlugins.set(RenderPlugin {
render_creation: RenderCreation::Automatic(WgpuSettings {
instance_flags: InstanceFlags::ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER,
..default()
}),
..default()
}))
—
Reply to this email directly, view it on GitHub
<#18246 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA7UPAZI5EH57MICRGVCXP32T5SX7AVCNFSM6AAAAABYXOI5JWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMJVHA4DCOBVHE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@@ -193,6 +196,61 @@ impl WindowSurfaces { | |||
} | |||
} | |||
|
|||
/// Determines if the application is running in a Windows Subsystem for Linux (WSL) environment | |||
#[cfg(target_os = "linux")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: you may want to put this behind a feature flag which is disabled by default for non dev environments. Seems like a small amount of stuff that may not be necessary in production builds, unless someone very specifically wants to compile their binary in a way to be run inside a wsl environment?
This is a known issue with Vulkan surface compatibility in WSL2 environments during window resizing operations.
Solution
I've implemented a solution that gracefully handles these WSL2-specific surface errors:
/proc/sys/kernel/osrelease
.The implementation is non-intrusive and only activates the special error handling in WSL environments, with no impact on other platforms.
Testing
I've tested these changes by:
I need to test:
2. Testing window resizing in a WSL2 environment that previously crashed
3. Verifying that there's no impact on non-WSL environments
This PR doesn't introduce any breaking changes and only adds graceful error handling to improve the user experience in WSL2 environments.
Showcase
Before this change, attempting to resize a window in WSL2 would cause the entire application to crash with the error message shown above. After this change, the application continues running with a warning message, and while there may be temporary visual glitches during resizing, the application remains stable and functional.
This is particularly helpful for developers who use WSL2 for their Bevy development workflow.