-
Notifications
You must be signed in to change notification settings - Fork 969
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
Migrate to Windows-rs from winapi #3207
Comments
It seems like there's still a lot of churn happening: microsoft/windows-rs#2156. We don't really want to end up with a bunch of different versions of windows-rs vendored into the mozilla tree so I think we'll need to wait longer for things to settle more. |
Copying what I said on matrix last night for long term transparency on the reasoning for the switch and why it isn't possible at this time:
|
There's also a standalone PR retep998/winapi-rs#812 that never got merged that we could yank. |
Windows-rs maintainers have stated they're going to slow down their cadence and release new There's also been work on updated directx bindings (microsoft/DirectX-Headers#79 and microsoft/DirectX-Headers#82 for the initial legwork), though I'm not sure what the timeline on that might be, or if those would be released as part of windows-rs, or as a separate crate. |
@Elabajaba fyi I've closed those |
I'm not sure what exact APIs we need, but
|
Another example of using |
@Elabajaba: It seems like If we want No action items here, just noting what's available. |
It is a minimal subset - the hand-written boilerplate if you wish - of the |
Looks like |
@Elabajaba |
@MarijnS95 do you know if there's any interoperability between different crates that generated their own binding? (eg. could we pass a wgpu |
@Elabajaba while they may have the same layout, they are type-incompatible if coming from locally generated bindings vs other crates' bindings and/or windows-rs: that makes this method infeasible for public types. It's similar to having two types from different versions of the same create: they may look the same but the compiler rightfully considers them different. |
That's what I figured :/ |
Note that You may find this example useful, where I do just that: https://github.com/Traverse-Research/amd-ext-d3d-rs/pull/3/files |
In case it matters: Firefox now permits depending on |
Yeah, so it seems like the plan is for us to generate our own bindings using the appropriate binding generator, then wherever we need to expose things, allow POD-type conversions to |
In Traverse-Research/gpu-allocator#181, they said they're cool going with a bindgen-based approach. So maybe we have a way forward here. |
@jimblandy if we're going the @cwfitzgerald yeah, that's the only unfortunate downside. I'm thinking of having an optional |
Some prior art that we had to do for https://github.com/Traverse-Research/gpu-allocator/blob/main/src/d3d12/mod.rs I'm thinking of replacing that with windows-rs or PODs so that it will work with |
Firefox downstream issue for using In case anybody finds it interesting, I've been pragmatically exploring consuming a forked To be clear, Firefox's WebGPU team prefers long-term that Firefox move on to simply allow the usage of the |
@ErichDonGubler for the record, note that |
@MarijnS95: I had dropped getting back to you on this, sorry about that! Firefox actually uses the All we need to do at this point is migrate away from |
@ErichDonGubler that's good news! Fortunately I've been contemplating removing that altogether as I hope less and less people rely on these legacy/unmaintained bindings. Separately we're still thinking about switching to |
Might not be the right place for this discussion, but I would avoid this. Since the windows-sys crate is already used in the winit source tree, I doubt it would have much of a positive effect. |
@notgull |
@MarijnS95: We're already paying the cost of compiling |
Yeah - I remember why I did not want to do this.
I'm quite certain that this was already reported upstream, but can no longer find an open issue about it. It's either closed as "this is a feature", or implemented and will come in a followup release. |
I bumped into this sample, I found it useful to see how the API is used in practice since the docs are not very useful. |
Since I've ported and maintained my fair share of windows-rs based Direct3D12 renderers, I've started picking up this task: a branch is on my fork. Currently in the "second stage" of porting, there are still 350 errors to address :) |
Short update: the branch on my fork now compiles, but there are still a few clippy lints to resolve (mainly thanks to |
It is very late but I just got this over with: #5956 Still draft, feel free to try it out but don't bother giving it a review until I've ±finalized the refactor, thanks! |
Is your feature request related to a problem? Please describe.
winapi-rs should probably be considered dead at this point, and Microsoft seems to have settled on windows-rs as the officially supported Windows api bindings. (and have deprecated all the other ones they were experimenting with).
Describe the solution you'd like
Migrate all the winapi code and dependencies to windows-rs.
Additional context
I believe this was previously blocked on a combination of windows-rs being immature, and Mozilla having to get windows-rs approved internally. Windows-rs seems to have settled down a lot, and I'm not sure whether or not Mozilla has okayed it, or if that's even still considered a blocker these days.
The text was updated successfully, but these errors were encountered: