Conversation
The __WINRT__ cfg controls whether wgpu-hal's GLES backend uses EGL (ANGLE, UWP-safe) or WGL (Win32 desktop only). Previously the cfg was only passed via --cfg in .cargo/config.toml rustflags, which could be missed by incremental builds or stale caches — causing wgpu-hal to compile the WGL path even for UWP targets. Now build.rs inspects CARGO_ENCODED_RUSTFLAGS and RUSTFLAGS for __WINRT__ and re-emits it via cargo:rustc-cfg, with rerun-if-env-changed guards. Desktop builds without the flag are completely unaffected. This fixes a FAST_FAIL_FATAL_APP_EXIT crash on Xbox where the WGL path called CreateWindowExA (forbidden in UWP/AppContainer) and loaded the desktop AMD OpenGL ICD.
Add DX12 surface support for RawWindowHandle::WinRt by creating swapchains via CreateSwapChainForCoreWindow. Keep GLES on WinRT/UWP via EGL and fix dx12 once_cell std.
|
I'll handle this for a while but won't assign myself because that messes up stuff at meetings. |
| } | ||
| wgt::Dx12SwapchainKind::DxgiFromVisual => { | ||
| return Err(crate::InstanceError::new( | ||
| "DX12 presentation_system=DxgiFromVisual is not supported for WinRT CoreWindow surfaces" |
There was a problem hiding this comment.
This needs to be documented on the Dx12SwapchainKind variant
inner-daemons
left a comment
There was a problem hiding this comment.
This will also need a changelog entry and probably some testing setup. You can do clippy for another target without necessarily running on said target, see examples in .github/workflows/ci.yml.
I'm also concerned about some of the potentially unrelated changes.
The biggest point of confusion though is that you put all of the work in to switch to EGL on UWP but then also completely disabled OpenGL on UWP if I'm understanding right.
Btw thanks for all this work, its very useful and its exciting to see that wgpu/bevy apps can run on Xbox!
| pub use fence::Fence; | ||
|
|
||
| #[cfg(not(any(windows, webgl)))] | ||
| #[cfg(any(all(windows, target_vendor = "uwp"), not(any(windows, webgl))))] |
There was a problem hiding this comment.
Stuff like this probably belongs in the build.rs which declares some cfg aliases. It will get annoying to copy this everywhere.
| config.extent.width as i32, | ||
| config.extent.height as i32, | ||
| ); | ||
| let window = unsafe { |
There was a problem hiding this comment.
Why are you modifying wayland code?
| let (config, supports_native_window) = choose_config(&egl, display, srgb_kind)?; | ||
|
|
||
| #[cfg(all(windows, target_vendor = "uwp"))] | ||
| let supports_opengl = false; |
There was a problem hiding this comment.
Is OGL not supported on UWP? Then whats the point of all of these GLES changes when you could just disable the backend?
|
Yes UWP is using EGL via angle and I encountered some issues so it was fixed quickly I never thought you guys would actually show interest let alone a PR I'll clean it up further and add the requested changes once I get the time ideally before Monday |
Wumpf
left a comment
There was a problem hiding this comment.
@inner-daemons & @cwfitzgerald already pointed out a bunch of stuff, but to add to that we should also at the very least add uwp as a checked target on CI
Description
this added the xbox support for both GLES and DX12
Testing
testing was done on an xbox and bevy and a few games ran on it
Checklist
cargo fmt.taplo format.cargo clippy --tests. If applicable, add:--target wasm32-unknown-unknowncargo xtask testto run tests.CHANGELOG.mdentry.