Commit 2459e14
committed
[WGSL] Field access should support pointers
https://bugs.webkit.org/show_bug.cgi?id=272838
rdar://126621076
Reviewed by Mike Wyrzykowski.
The WGSL spec was updated to support struct field access on pointers (e.g. (&x).y),
and while the type checker was updated to support it, there were a couple other
changes necessary:
- the renamer/mangler did not correctly rename the field when accessing a pointer
- the global rewriter asserted that the base should be either a reference or a struct
- the code generator was not emitting the correct code (i.e. x->y instead of x.y)
* Source/WebGPU/WGSL/GlobalVariableRewriter.cpp:
(WGSL::RewriteGlobalVariables::getPacking):
* Source/WebGPU/WGSL/MangleNames.cpp:
(WGSL::NameManglerVisitor::visit):
* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::visit):
* Source/WebGPU/WGSL/tests/valid/access-expression.wgsl:
Canonical link: https://commits.webkit.org/277665@main1 parent 9b709d7 commit 2459e14
File tree
4 files changed
+15
-1
lines changed- Source/WebGPU/WGSL
- Metal
- tests/valid
4 files changed
+15
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
| 477 | + | |
| 478 | + | |
477 | 479 | | |
478 | 480 | | |
479 | 481 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
166 | 168 | | |
167 | 169 | | |
168 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2080 | 2080 | | |
2081 | 2081 | | |
2082 | 2082 | | |
2083 | | - | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
2084 | 2089 | | |
2085 | 2090 | | |
2086 | 2091 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
230 | 235 | | |
0 commit comments