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

Align the validation of Device::create_texture with the WebGPU spec #2759

Merged
merged 1 commit into from
Jun 10, 2022

Conversation

nical
Copy link
Contributor

@nical nical commented Jun 10, 2022

Connections

The WebGPU specification for createTexture.

Description

This PR aligns the validation of create_texture with the steps described in the aforementioned specification. I tried to make sure the validation is at least as strict as the specification, but didn't attempt to remove any existing validation that isn't described in the specification.

There is a tiny bit of reordering so that the validation in the code goes in roughly the same order as the specification (for ease of comparison).

I also found in the process that the method is probably missing a view_formats parameter but if so, it will come in a followup.

Testing

None.

@nical nical force-pushed the create-texture-validation branch from 51761cf to 5ce49af Compare June 10, 2022 16:41
@nical
Copy link
Contributor Author

nical commented Jun 10, 2022

Note I didn't quite get the difference between:

descriptor.[usage](https://www.w3.org/TR/webgpu/#dom-gputexturedescriptor-usage) must contain only bits present in this’s [allowed texture usages](https://www.w3.org/TR/webgpu/#allowed-texture-usages).

and

descriptor.[usage](https://www.w3.org/TR/webgpu/#dom-gputexturedescriptor-usage) must be a combination of [GPUTextureUsage](https://www.w3.org/TR/webgpu/#namespacedef-gputextureusage) values.

The latter I think is enforced by the type itself, but I'm not sure whether the former is provisioning for a future with more usages, some of which are not supported by all devices.

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.

This is great, thank you! Those two things feel redundant.

@cwfitzgerald cwfitzgerald merged commit 629ccaf into gfx-rs:master Jun 10, 2022
@nical nical deleted the create-texture-validation branch June 11, 2022 21:23
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.

2 participants