Skip to content
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

Upgrade to latest webgpu headers #445

Open
wants to merge 31 commits into
base: trunk
Choose a base branch
from

Conversation

eliemichel
Copy link
Contributor

This builds on top of #441 (which upgrades wgpu-core to v23.0.0), as well as the commits added to #427 after it was forked.

  • Only minor compatibility changes were needed to upgrade to latest webgpu.h (@PJB3005 did all the heavy work, thanks!).
  • The list in unimplemented.rs needs to be double checked.
  • I've upgraded the examples, but did not intensively tested it in other contexts.

PJB3005 and others added 30 commits September 19, 2024 17:53
This goes up to webgpu-native/webgpu-headers@2b59747

Things I *didn't* do:

* I didn't update the library to make sure "instance dropped" callback
  error codes are guaranteed to happen, like they seem to be in Dawn.

List of changes (roughly in order of header commits):

Various enum and struct renames

Updated callbacks to use the new *CallbackInfo structs and 2-userdata system. Also updated functions to return WGPUFuture, though the WGPUFuture thing is just stubbed out at the moment as I don't think wgpu-core has the necessary functionality for it. wgpuInstanceWaitAny is unimplemented!()

DepthClipControl merged into PrimitiveState, related code simplified.

Updated depthWriteEnabled to use an optional bool, mostly matters due to added validation.

Add TODOs for missing features (sliced 3D compressed textures)

*Reference() became *AddRef()

Added unorm10-10-10-2 vertex format

Usage field in TextureViewDescriptor, just used for validation as wgpu-core doesn't allow specifying it anyways.

Removed maxInterStageShaderComponents

Added clang_macro_fallback to bindgen config, since the headers switched to using UINT32_MAX etc. UINT64_MAX still doesn't work so I had to manually define those.

Renamed flags enums. Added a conversion helper function to convert them from u64 -> u32 for mapping. (means added direct dependency on bitflags crate)

Removed device argument from (unimplemented) wgpuGetProcAddress

Suboptimal surface texture acquisition moved to enum return value, was easy since wgpu-core already returns it like that.

"Undefined" present mode added, it just selects FIFO.
This enum was replaced with WGPUMapAsyncStatus, but I didn't quite notice. The error codes map different.
Replaces *EnumerateFeatures with *GetFeatures.

Also fixes CI due to fix in headers.
Upstream removed the "Flags" suffix from flags types and moved them to no longer be C enums. This matches that change. WGPUInstanceFlag still has "Flag" in the name because, well, there'd be nothing left to distinguish it from WGPUInstance, and it makes sense for it.
Also updates wgpu.h to use WGPUStringView everywhere.
All stubs, since we don't have WaitAny at the moment.
Update to webgpu-native/webgpu-headers@f1cdc3f

Also went through a bunch of existing enum conversions and fixed up some seemingly spec-incorrect cases of undefined enums not being handled properly.

As part of this, I made a new helper map_enum_with_undefined!() which distinguishes undefined and unknown enum values. Previously, much code relied on undefined being caught in the same net as an unknown value. This is no longer the case.
This updates the headers to webgpu-native/webgpu-headers@af63d34

These changes are exclusively in the header enum values, so no Rust code needs changing. Making this a separate commit for easier review.
Update headers to webgpu-native/webgpu-headers@b7656d0

Adds dual source blending. Other two features (float32 blendable and clip distances feature in wgsl) are not supported by wgpu.

Also made map_blend_factor use the shorter macro form, as all the enum names match (they didn't 3 years ago when this code was originally written, according to Git history).
Oops that's not how these chained structs work.
Updates headers to webgpu-native/webgpu-headers@6f549cc

Also made matching changes to wgpu.h
@eliemichel
Copy link
Contributor Author

Build available in this release: v23.0.0-beta @ eliemichel/wgpu-native

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants