Commit Graph

15 Commits

Author SHA1 Message Date
SparkyPotato
6035b07b78 [wgsl-in] Implement module-level scoping.
Fixes #1745: Support out-of-order module scope declarations in WGSL
Fixes #1044: Forbid local variable shadowing in WGSL
Fixes #2076: [wgsl-in] no error for duplicated type definition
Fixes #2071: Global item does not support 'const'
Fixes #2105: [wgsl-in] Type aliases for a vecN<T> doesn't work when constructing vec from a single argument
Fixes #1775: Referencing a function without a return type yields an unknown identifier error.
Fixes #2089: Error span reported on the declaration of a variable instead of its use
Fixes #1996: [wgsl-in] Confusing error: "expected unsigned/signed integer literal, found '1'"

Separate parsing from lowering by generating an AST, which desugars as
much as possible down to something like Naga IR. The AST is then used
to resolve identifiers while lowering to Naga IR.

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
Co-authored-by: Jim Blandy <jimb@red-bean.com>
2023-01-12 09:37:08 -08:00
Igor Shaposhnik
f76af4e53a [wgsl] Remove buffer, texture, in, out, input, output from reserved keywords 2022-04-29 20:06:09 +02:00
Teodor Tanasoaia
dc075e66e3
[wgsl-in] Update reserved keywords (#1847) 2022-04-17 15:56:54 +02:00
Igor Shaposhnik
1720725014 [wgsl-out] Update entry point stage attributes 2022-04-15 18:02:48 +01:00
Pu Xingyu
b17e6cfe43 wgsl-out: Do not output semicolon after struct decl 2022-03-27 00:22:58 -07:00
Igor Shaposhnik
b5761d9611 [wgsl-out] Uses commas to separate struct members instead of semicolons 2022-03-12 22:07:06 -08:00
Dzmitry Malyshau
4bd1efc34d wgsl: declare attribtues with @ 2022-01-20 19:44:05 -05:00
Dzmitry Malyshau
8ffd6ba929 Remove top_level property of structs 2021-12-15 09:33:33 -05:00
Dzmitry Malyshau
74132ba947 Actually disable explicit types on most WGSL outputs 2021-11-26 11:36:46 -05:00
Dzmitry Malyshau
ddbc1c4b1f WGSL: use underscore prefix like the other backends 2021-11-25 16:23:24 -05:00
Dzmitry Malyshau
8bc3aa824b
Refactor namer scheme, fix trailing digits (#1510) 2021-11-09 09:24:41 -05:00
Jim Blandy
ed4cc8e4d8
Use Cow to reduce allocation in proc::Namer. (#1465)
Minimize allocation in the namer. Heap-allocate string only when needed to
provide an owned key for a hash table, or to hold synthesized text. Try to reuse
allocations.

Many unnecessary trailing `_` characters are removed from test output. These
were all superfluous; separators are still inserted where necessary.
2021-10-16 17:56:59 +00:00
João Capucho
7895e7f036 Don't output identifiers starting with _ 2021-09-19 15:18:17 -04:00
pyrotechnick
1d1aea243f
Improve WGSL interpolation attributes (#1083)
* [wgsl-in] Map interpolate(..., center) to Sampling::Center

* [wgsl-out] Improve interpolation attributes

* [wgsl] Fix tests/in/interpolate.wgsl typo/format

* [wgsl] Snapshot WGSL artefacts

* [wgsl-out] Stack-only writing of interpolation
2021-07-13 21:57:52 -04:00
Gordon-F
6cdd332cef Reorganize test snapshot folder 2021-06-19 10:19:04 -04:00