Repository navigation
Conversation
Co-authored-by: Kai Ninomiya <[email protected]>
kvark
left a comment
There was a problem hiding this comment.
I think this is a right direction. The only concern is how we are going to specify (in the near future) which formats the user can request in this list.
| : <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. | ||
|
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
|
Closing this PR as we decided to go with a single flag for now. We might reopen this later if we decide it is worth adding an explicit list of view compatible formats. |
* shader/execution/builtin: Add `cos()` test * shader/execution/builtin: Untitle scalar constructors The CTS has a convention of untitled function names, and this matches the WGSL syntax better anyway.
This is an addition that would allow using different view formats than the texture's main format.
On Metal it would translate to looking at whether the format can be reinterpreted without the
MTLTextureUsagePixelFormatViewusage flag. I believe it is possible for example betweenrgba8-unorm,rgba8-unorm-srgbandrgba8-uint. On the other hand, conversion betweenrgba8-unormandr32-uintwouldn't be free like that.On Vulkan it would translate to using
VK_IMAGE_CREATE_MUTABLE_FORMAT_BITif any format is set. That flag is a bit pessimistic so when available we'd use VK_KHR_image_format_list instead.On D3D12, well I'm not sure because I wasn't not able to find the relevant documentation again. But something similar would happen (like we'd use a typeless format only if we need to).
Preview | Diff