bevy_render: Pass RawDisplayHandle to wgpu for compositor-aware Instance creation - #25647
AlexanderStein wants to merge 1 commit into
Conversation
023dfe7 to
eb8ace8
Compare
|
I believe the OpenGL support is very fragile. None of the places that use |
| app.insert_resource( | ||
| RawDisplayHandleWrapper::new(&event_loop) | ||
| .expect("Failed to get the display handle from the event loop"), | ||
| ); | ||
| app.init_resource::<WinitMonitors>() |
There was a problem hiding this comment.
| app.insert_resource( | |
| RawDisplayHandleWrapper::new(&event_loop) | |
| .expect("Failed to get the display handle from the event loop"), | |
| ); | |
| app.init_resource::<WinitMonitors>() | |
| app.insert_resource( | |
| RawDisplayHandleWrapper::new(&event_loop) | |
| .expect("Failed to get the display handle from the event loop"), | |
| ) | |
| .init_resource::<WinitMonitors>() |
|
The opengl backend is officially not supported with bevy's full renderer. With that said, we can still accept non-invasive changes that make it possible to use bevy_winit/bevy_render with the opengl backend. |
I am aware. That's why I'm trying to fix errors I encounter. Thanks for the acceptance. |
9683494 to
d42d7e5
Compare
…Instance` creation EGL backend requires for the wgpu instance creation that a display handle is already passed through. This is necessary to detect which compositor (X11 or wayland) is used. This is achieved by creating a RawDisplayHandle upfront and store it as a resource inside RawDisplayHandleWrapper.
d42d7e5 to
4d6cb79
Compare
This is an AI-assisted (GPT-5.5) update to #20358
With gfx-rs/wgpu#8782 integrated in wgpu-30 this PR doesn't depend on external changes, but just bevy.
EGL backend requires for the wgpu instance creation that a display handle is already passed through. This is necessary to detect which compositor (X11 or wayland) is used.
This is achieved by creating a RawDisplayHandle upfront and store it as a resource inside RawDisplayHandleWrapper.
Objective
Render creation using EGL on Wayland already requires a display handle upon context creation.
Solution
Create that RawDisplayHandle early, store it as a resource and pass it during render creation.
Testing
Command for test:
Note:
--no-default-featuresis necessary because the3dfeature raises a different GLSL problem in wgpu unrelated to this issue.Before
The line
indicates there is already a problem which causes to create a native-render EGL surface:
After
The important line is
showing that initialization detected a Wayland platform for which a EGL surface can be created: