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

Split up features. #6905

Draft
wants to merge 34 commits into
base: trunk
Choose a base branch
from
Draft

Split up features. #6905

wants to merge 34 commits into from

Conversation

Vecvec
Copy link
Contributor

@Vecvec Vecvec commented Jan 13, 2025

Connections
I guess would fix #5247 as it should be extendable and uses `#[repr(C)] and so should support cbindgen.

Description
Creates an extendable way to use sets of bitflags together. This then splits up features into two subpart: FeaturesWGPU and FeaturesWebGPU. These can be further extended or split if that is needed (e.g shader features vs other features). This is ready for review, tell me if this is the wrong path. I'm quite new to macros (this is probably my second), so tell me if I've missed a helpful feature.

Implementation
Internally this uses a struct as that was the easiest to interact with extendable macros (though externally this interacts with arrays). I think it wouldn't be too hard to switch everything to arrays, but I think it might be slightly messier.

Testing
All existing tests should cover this

Implemented const Functions

  • empty
  • all
  • bits
  • from_bits
  • from_bits_truncate
  • from_bits_retain
  • from_name
  • is_empty
  • is_all
  • intersects
  • contains
  • intersection
  • union
  • difference
  • symmetric_difference
  • complement
  • iter
  • iter_names

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy (Though docs - in CI is grouped together - doesn't like this). If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@Vecvec
Copy link
Contributor Author

Vecvec commented Jan 13, 2025

The diff that the entire thing has made is slightly confusing, I would recommend reading it separately (or at least Basic before Split up Features.).

Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a look for a pre-review; looks nice and not as bad, especially if we add some more docs.

wgpu-types/src/lib.rs Outdated Show resolved Hide resolved
@cwfitzgerald
Copy link
Member

Would be interesting to run cargo-semver-checks against this change, might catch any subtleties missed

@Vecvec
Copy link
Contributor Author

Vecvec commented Jan 16, 2025

Would be interesting to run cargo-semver-checks against this change, might catch any subtleties missed

Is that to catch changes to functions? If so it's probably better than my manual check.

Edit: you would have to ignore all the things about bit changes as their size (and type) has changed.

@cwfitzgerald
Copy link
Member

Edit: you would have to ignore all the things about bit changes as their size (and type) has changed.

Yeah, just as a point of information, not a "blocker" kind of thing

@Vecvec
Copy link
Contributor Author

Vecvec commented Jan 16, 2025

If you have it then could you run it? Otherwise, I'm fine to install it and see what it tells me.

@Vecvec
Copy link
Contributor Author

Vecvec commented Jan 17, 2025

Semver-checks seems to think everything is fine. I also removed one of the functions out of the macro and it noticed so it's not just missed it.

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.

Plan for When Features overflows u64
2 participants