-
Notifications
You must be signed in to change notification settings - Fork 966
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
Add AddressMode::ClampToBorder behind a feature #891
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an autogenerated code review.
Checker summary (by rust_clippy):
The tool has found 0 warnings, 1 errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Some changes/questions
wgpu-types/src/lib.rs
Outdated
/// Supported platforms: | ||
/// - DX12 | ||
/// - Vulkan | ||
/// - Metal (macOS 10.12+ only) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If 10.12 is required, as of right now the check only checks !iOS
, so this will report being available on the older versions of mac. Not sure if you classify that as an issue @kvark.
80d9974
to
02beefe
Compare
Setting the border_color to an arbitrary color (like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thank you for tackling this issue so quickly!
Just a few minor things to correct, and we are good to go
wgpu-core/src/resource.rs
Outdated
@@ -397,6 +400,8 @@ pub enum CreateSamplerError { | |||
InvalidClamp(u8), | |||
#[error("cannot create any more samplers")] | |||
TooManyObjects, | |||
#[error("AddressMode::ClampToBorder requires feature ADDRESS_MODE_CLAMP_TO_BORDER")] | |||
MissingSamplerFeature, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to make this consistent with the other variants. So this should be MissingFeature(wgt::Feature)
, and the doc comment should talk specifically about the clamp-to-border, so that we can use this for other features later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. Let me know if the current message + doc comment is acceptable.
Oh that's fun! I think we should just make the extension to support only a limited set of colors that Metal supports, then. |
02beefe
to
19eeee2
Compare
I introduced a new enum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you!
bors r+
3347: Refactor border color, add feature for comparison mutable samplers r=kvark a=kvark Contributes towards #3346 PR checklist: - [x] `make` succeeds (on *nix) - [x] `make reftests` succeeds - [ ] tested examples with the following backends: cc @jshrake (related to gfx-rs/wgpu#891) Co-authored-by: Dzmitry Malyshau <[email protected]>
526: Add optional border_color to SamplerDescriptor r=kvark a=jshrake Depends on gfx-rs/wgpu#891 Co-authored-by: Justin Shrake <[email protected]>
1391: Simplify features r=cwfitzgerald a=kvark **Connections** Fixes #1390 Makes vertex writable storage optional (native-only for now) Fixes the follow-up to #891 **Description** Refactors the code so that adding new features and maintaining current ones is much easier. Refactors the way missing features are checked and reported, DRY way. **Testing** Not really tested Co-authored-by: Dzmitry Malyshau <[email protected]>
526: Add optional border_color to SamplerDescriptor r=kvark a=jshrake Depends on gfx-rs#891 Co-authored-by: Justin Shrake <[email protected]>
Connections
Closes #890
Linked to gfx-rs/wgpu-rs#526
Description
Testing
Tested against the Metal (MacOS 10.15) and Vulkan (Ubuntu 18.04) backends.
Ran the wgpu-rs/cube example and switched the address modes to AddressMode::ClampToBorder, without enabling the feature, and confirmed I received an error message. Ran the same example with the new feature specified in the optional_features return and confirmed that the example ran and looks reasonable.