Top 8 Rust DirectX Projects
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
I know all that shit because I'm the author of Rust's WinSafe library, which is a safer Rust layer over native Win32, so I had to deal with a lot of shit like this.
Project mention: Is it Ok to push a crate that is part of a github repository? | /r/rust | 2023-07-09That is just fine, just keep in mind that crates.io will only see files within the actual crate you are publishing, for example it will not read the repo-level README.md. Here is one of my crates that is in a sub-directory: GitHub crates.io
https://github.com/MaulingMonkey/winresult/
Another project: thindx. Bindings for d3dcompiler + d3d9 + xinput have a lot of enums and flags:
• 50 results in 49 files for flags!: https://github.com/search?q=repo%3AMaulingMonkey%2Fthindx%20...
• 77 results in 69 files for enumish!: https://github.com/search?q=repo%3AMaulingMonkey%2Fthindx+en...
• I still do things by hand somtimes, for reasons that elude my recollection: https://github.com/MaulingMonkey/thindx/blob/127d75f9de91f73...
And these are baby numbers compared to an actual professional gamedev codebase. Attention to detail makes me fairly comfortable with this much hand-generated nonsense in my one man show, but bugs still crop up... and there are people I would dread handing maintainence of such a project over to that I've worked with in a professional capacity, who simply do not care to exercise the same level of care as I do when editing such stuff.
Project mention: Improving Interoperability Between Rust and C++ | news.ycombinator.com | 2024-02-05Vtables are pretty solved as well. I do a lot of Windows COM interop. Using the `windows` crate, vtables for COM interfaces are relegated to an implementation detail - instead you simply implement a (typically safe!) trait:
https://microsoft.github.io/windows-docs-rs/doc/windows/Win3...
Which can then be converted to a refcounted smart pointer:
https://microsoft.github.io/windows-docs-rs/doc/windows/Win3...
All driven by win32 sdk parsing and metadata.
But suppose we want to roll our own, because we tend to prefer `winapi` but it lacks definition. That's not too terrible either:
• https://github.com/MaulingMonkey/thindx-xaudio2/blob/master/...
• https://github.com/MaulingMonkey/thindx-xaudio2/blob/master/...
• https://github.com/MaulingMonkey/thindx-xaudio2/blob/master/...
I could more heavily lean on my macros ala `windows`, but I went the route of manual control for better doc comments, more explicit control of thread safety traits to match the existing C++ codebase, etc.
Is there some pointer casting? Yes. Is it annoying or likely to be what breaks? No. What is annoying?
• Stacked borrows and narrowing spatial provenance ( https://github.com/retep998/winapi-rs/issues/1025 - this can be "solved" by sticking to pointers ala `windows`, or by choosing a different provenance model like rustc might be doing?)
• Guarding against panics unwinding over an FFI boundary. This is at least being worked on, but remains unfinished ( https://rust-lang.github.io/rfcs/2945-c-unwind-abi.html )
• Edge case ABI weirdness specific to C++ methods ( https://devblogs.microsoft.com/oldnewthing/20220113-00/?p=10... , https://github.com/retep998/winapi-rs/issues/523 )
Rust DirectX related posts
Index
What are some of the best open-source DirectX projects in Rust? This list will help you:
Project | Stars | |
---|---|---|
1 | wgpu-mc | 440 |
2 | winsafe | 437 |
3 | spirv_cross | 86 |
4 | winsafe-examples | 57 |
5 | egui-d3d9 | 31 |
6 | thindx | 8 |
7 | spaceform | 6 |
8 | thindx-xaudio2 | 1 |