feat(types): Add conversions to/from feature name strings#9163
feat(types): Add conversions to/from feature name strings#9163andyleiserson merged 3 commits intogfx-rs:trunkfrom
Conversation
| } | ||
|
|
||
| #[test] | ||
| fn check_features_bits() { |
There was a problem hiding this comment.
Before moving my new stuff to a separate test, I was modifying this test, and noticed that it repeated the same code 3x. I assume that was a mistake and the intent was to do the same checks for each of Features, FeaturesWebGPU, and FeaturesWGPU, so I changed it to do that.
c6b3540 to
d49003b
Compare
d49003b to
6a7ad97
Compare
cwfitzgerald
left a comment
There was a problem hiding this comment.
Looks good. It would be really nice if there could b a single macro that defines both lists, so we don't have desync issues (or even better if it could be the original Features list so we don't forget any (though that will be covered by the test case).
Approving, feel free to do this now, boot this to another PR or not at all.
| desc = { requiredFeatures: ['external-texture'] }; | ||
| desc = { requiredFeatures: ['wgpu-external-texture'] }; | ||
| } else if (!desc.requiredFeatures) { | ||
| desc.requiredFeatures = ['external-texture']; | ||
| desc.requiredFeatures = ['wgpu-external-texture']; | ||
| } else { | ||
| desc.requiredFeatures.push('external-texture'); | ||
| desc.requiredFeatures.push('wgpu-external-texture'); | ||
| } |
There was a problem hiding this comment.
nitpick: This change seems unnecessary since external-texture is still accepted, and is ultimately the feature name we want for cts_runner as a strictly WebGPU environment. Was there a reason you wanted to migrate this?
There was a problem hiding this comment.
External texture (originally I wrote "external feature" here 🫠) is part of the WebGPU core feature set. The notion of it as an optional feature is a wgpu-ism. So I prefixed it on the rationale that any name that is not defined by WebGPU, should have the wgpu- prefix.
There was a problem hiding this comment.
Ah, I think that's fair. 👍🏻 No objection, then!
+1! |
Update some comments
97e9038 to
391a21d
Compare
Moves feature name logic from deno to wgpu-types so we can use it in other clients, and so that it will stay up-to-date as features are added.
Adds the
wgpu-prefix to all the native features, but for the ones that were previously accepted without it, continues to do so. Exceptions:subgroupsandprimitive-indexare currently grouped with the wgpu features, but are standard-track features, so they use the standard-defined feature name. There is also a special backcompat case to acceptshader-primitive-indexas an alias forprimitive-index. I'm not sure how necessary all the backcompat handling is.Testing
Adds a unit test.
Squash or Rebase? Squash
Checklist
cargo fmt.taplo format.cargo clippy --tests. If applicable, add:--target wasm32-unknown-unknowncargo xtask testto run tests.CHANGELOG.mdentry, although really it's the Deno changelog that matters.