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

Add GPUTextureDescriptor.viewFormats #811

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions spec/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,13 @@ GPUTexture includes GPUObjectBase;
::
The allowed usages for this {{GPUTexture}}.

: <dfn>\[[viewFormats]]</dfn> of type `sequence<{{GPUTextureFormat}}>`.
::
The additional formats that are allowed to be used as {{GPUTextureViewDescriptor}}.{{GPUTextureViewDescriptor/format}}
for views created from this {{GPUTexture}}.

The base texture format {{GPUTextureFormatDescriptor/format}} is always allowed.

Comment on lines +1462 to +1468
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec text you're adding doesn't match the title of the PR. The PR title talks about GPUTextureDescriptor.viewformats but here you're adding the sequence of formats to the GPUTexture object itself.

For D3D12, you need to tell the API that you want a typeless texture at object creation time. So specifying something like viewFormats would be best as part of the descriptor as the title of the PR states.

The best place to look at the mapping for compatible formats for D3D can be found in the format tables for the various feature levels. https://microsoft.github.io/DirectX-Specs/d3d/archive/images/d3d11/D3D11_3_Formats_FL11_1.xls is a link to the one for FL11_1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The section you commented on contains the "internal slots" for the texture. It saves creation arguments so they can be later used by other parts of the spec for validation. The real API change is [1] which adds viewFormats to the GPUTextureDescriptor.

Thanks for the link, [lease help build the compatibility classes for WebGPU in #744

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Corentin. I admit I overlooked the viewFormats section.

I think we should go forward with this PR and amend the spec pending the outcome of #774 about which ones are allowed to go together.

</dl>

### Texture Creation ### {#texture-creation}
Expand All @@ -1471,6 +1478,7 @@ dictionary GPUTextureDescriptor : GPUObjectDescriptorBase {
GPUTextureDimension dimension = "2d";
required GPUTextureFormat format;
required GPUTextureUsageFlags usage;
sequence<GPUTextureFormat> viewFormats;
};
</script>

Expand Down