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

Update TextureView validation #3410

Merged
merged 4 commits into from
Jan 24, 2023

Conversation

teoxoy
Copy link
Member

@teoxoy teoxoy commented Jan 20, 2023

Checklist

  • Run cargo clippy.
  • Run RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Connections

Description
Update TextureView validation according to the WebGPU spec.
I have a follow-up PR to allow creation of depth-only and stencil-only views (according to the spec).

Testing

@teoxoy
Copy link
Member Author

teoxoy commented Jan 20, 2023

I'd also like some opinions on changing the type of mip_level_count and array_layer_count from Option<NonZeroU32> to Option<u32> (members of ImageSubresourceRange) since the spec does allow you to pass a 0 but validation will fail.

I imagine most people use NonZeroU32::new to create the value for those members, the issue being that the new fn will return None if you pass it 0; effectively changing the meaning of 0 (None means "use the rest" whereas 0 should just fail validation).

It would also be nice to have a resolved and validated version of ImageSubresourceRange that we use internally with the type of those members being a NonZeroU32.

@teoxoy teoxoy added this to the WebGPU Specification V1 milestone Jan 20, 2023
@nical
Copy link
Contributor

nical commented Jan 23, 2023

I'd also like some opinions on changing the type of mip_level_count and array_layer_count from Option<NonZeroU32> to Option<u32> (members of ImageSubresourceRange) since the spec does allow you to pass a 0 but validation will fail.

I agree, let's match the spec.

@cwfitzgerald
Copy link
Member

NonZero values are also insanely annoying to deal with as a user, so I support this.

@teoxoy teoxoy merged commit 964c94a into gfx-rs:master Jan 24, 2023
@teoxoy teoxoy deleted the update-TextureView-validation branch January 24, 2023 11:02
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.

3 participants