Make Features fit in 64 bits again #5268
Merged
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
u128
is not safe to pass in ffi, this causes issues in Gecko's ffi glue and blocks Firefox from updating to a newer wgpu-core revision.There's #5247 on file about using the
enumset
crate but the latter also seems to use u128 when the number of bits required is between 64 and 128 so in the interest of unblocking gecko, this PR packs the used bits intou64
, which is a simple transformation since we still have a fair amount of unused bits.The PR also reorders the standard features so that they appear in the same order as in the spec.
To get more bits in the future I think that we should split webgpu and native features into separate types. That will give us a fair amount of extra bits on each side and if some day the native-only bits are full again we can consider having them use something that isn't ffi-safe (if that doesn't cause issues with wgpu-native). without causing as much trouble on the gecko side. At this rate it is going to take a very long time for the webgpu flags to overflow 64 bits if it ever happens and gecko needs them to be ffi-safe.
Checklist
cargo fmt
.cargo clippy
.cargo xtask test
to run tests.