Replace u32 with NonZeroU32 in TextureView#865
Merged
bors[bot] merged 1 commit intogfx-rs:masterfrom Aug 5, 2020
Merged
Conversation
Contributor
Author
|
r?@kvark |
kvark
requested changes
Aug 5, 2020
3074630 to
3fdf784
Compare
kvark
reviewed
Aug 5, 2020
kvark
reviewed
Aug 5, 2020
3fdf784 to
aa44969
Compare
Contributor
Author
|
Tested on wgpu-rs examples, works fine! |
kvark
approved these changes
Aug 5, 2020
|
|
||
| pub fn level_count(&mut self, level_count: u32) -> &mut Self { | ||
| self.level_count = Some(level_count); | ||
| self.level_count = Some(NonZeroU32::new(level_count).unwrap()); |
Member
There was a problem hiding this comment.
now that I see it, I wonder if we should just do level_count = NonZero::U32(...)
Contributor
Author
There was a problem hiding this comment.
We wouldn't be checking for 0 then. Or should we add a separate if for that?
Member
There was a problem hiding this comment.
yeah, I mean, it's a builder, and passing 0 explicitly is a weird case
anyhow, we can keep that in mind, no need to do these changes, and there isn't an agreement on it yet :)
Contributor
bors bot
added a commit
to gfx-rs/wgpu-rs
that referenced
this pull request
Aug 5, 2020
496: Replace u32 with NonZeroU32 in TextureView r=kvark a=kunalmohan Includes gfx-rs/wgpu#865 Co-authored-by: Kunal Mohan <kunalmohan99@gmail.com>
kvark
pushed a commit
to kvark/wgpu
that referenced
this pull request
Jun 3, 2021
496: Replace u32 with NonZeroU32 in TextureView r=kvark a=kunalmohan Includes gfx-rs#865 Co-authored-by: Kunal Mohan <kunalmohan99@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Connections
Link to the issues addressed by this PR, or dependent PRs in other repositories
Description
Describe what problem this is solving, and how it's solved.
We now expose separate methods under
Globalto register error/invalid resources. So the check formip_level_count = 0andarray_layer_count = 0can be made on the client-side in Servo, and directly register an error resource instead of trying to create a real one.Testing
Explain how this change is tested.
Not yet tested. Will be done wgpu-rs examples.