[WebGPU, Dawn]: Upgrade Dawn and new features for WebGPU #727
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.
To build for the web, an update to Emscripten 4.0.20 is required (the WebGPU integration method changed starting from 4.0.10).
Previously, Tint had two paths to translate SPIR-V to WGSL. Unfortunately, the one we were using has been removed, and we also had to apply a few changes in order to make everything work through
ReadIR(unfortunately, not everything works yet — more on that later).The new Tint version cannot automatically infer the access mode for StorageTexture (it defaults to
read_write), so we had to patch the SPIR-V code using additional metadata embedded into HLSL (the same logic we use for the texture format).We also ran into an issue where Tint merges structure types in WGSL when converting
cbuffer, which made it impossible to reliably recover the resource binding group by name from the WGSL output. It took quite some effort to convince the Tint team to acknowledge this problem(https://dawn-review.googlesource.com/c/dawn/+/278115).However, there is still another issue: the new converter version appends a
_ [1–9]suffix to types for uniform buffers according to some unclear logic. As a result, if the user explicitly adds a suffix like_1,_2, etc. to acbuffername in HLSL (e.g.Buffer_1,Buffer_2), it becomes impossible to resolve the name unambiguously — we cannot tell whether the suffix originally came from the user or was generated by Tint.