Add wgpu graphics server - #927
Draft
nice0hack wants to merge 36 commits into
Draft
Conversation
mrDIMAS
reviewed
Jul 30, 2026
| /// Each entry is a `(location, format, &'static [VertexAttribute])` triple. The | ||
| /// attribute arrays are `const` statics so they have `'static` lifetime without | ||
| /// needing `Box::leak`, avoiding per-draw-call memory leaks. | ||
| const EXTRA_VERTEX_LAYOUTS: &[(u32, &[wgpu::VertexAttribute])] = &[ |
Member
There was a problem hiding this comment.
This looks like a hack, because it adds info about vertex layout in frame buffer itself. It is not necessarily a bad thing for a prototype, but looks like something that needs to be addressed later.
nice0hack
marked this pull request as draft
July 31, 2026 09:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces the initial draft implementation of the
wgpubackend for the Fyrox Engine.A critical aspect of this PR is that backward compatibility with the existing OpenGL backend is fully preserved. The new
wgpuintegration is wrapped as an optional Cargo feature, meaning it does not affect the current default engine behavior.To test the engine with the new backend, you need to run it using the following flags:
cargo run --package fyroxed --profile=editor-standalone --no-default-features --features backend_wgpuOne of the greatest advantages of
wgpuintroduced in this PR is its smart backend selection. It dynamically evaluates the most relevant graphics APIs available on the user's OS (e.g., DirectX 12, Vulkan, Metal) and automatically selects the most performant one. For example, on my Windows 10 machine with an older GPU, it seamlessly fell back to Vulkan to ensure optimal compatibility and performance.Related Issue(s)
#721
Review Guidance
Testing Environment:
So far, this implementation has only been tested on Windows 10 and Fedora Linux 43. Feedback from macOS or other environments would be highly appreciated.
Known Bugs & Limitations (To-Do):
I have encountered a few complex bugs that I haven't been able to resolve yet. Fixing them might require a significant amount of time and deep debugging:
Discussion: MSAA & Deferred Rendering:
Currently, MSAA (Multisample Anti-Aliasing) support is not implemented for the
wgpubackend. Integrating MSAA withwgpuin our Deferred Rendering pipeline would cause a massive drop in performance and heavily inflate VRAM usage. We should discuss whether it's worth implementing MSAA at all, or if we should rely on post-processing anti-aliasing solutions (like FXAA or SMAA), which fit the deferred pipeline much better.Final Thoughts & Proposal for Merging:
Integrating
wgpuis a massive and fundamental shift for the engine's architecture. Since my changes are entirely isolated behind a feature flag (backend_wgpu) and do not break or affect the stable OpenGL backend, I highly recommend merging this PR in its current state.Having this foundational codebase in the
masterbranch will allow the community to test it, try out thewgpubackend, and contribute. We can then split the remaining bugs listed above into separate, manageable issues and gradually polish thewgputransition together rather than keeping this giant update stuck in a single PR.Checklist