Lachlan Sneff
960551f952
Add support for arrayLength to the wgsl frontend ( #805 )
...
* Add support for arrayLength to the wgsl frontend
* Fix clippy warning
2021-04-30 00:20:09 -04:00
Dzmitry Malyshau
d9171dbc61
[wgsl-in] fix composition of a single element
2021-04-27 11:11:28 -04:00
Dzmitry Malyshau
120fc22e9f
Support unary not in WGSL
2021-04-27 01:24:21 -04:00
Dzmitry Malyshau
a2e5284f82
WGSL trailing commas ( #743 )
...
* [wgsl-in] typedef Span
* [wgsl-in] trailing comma for case list
* [wgsl-in] trailing comma for constructors
* Review fixes
2021-04-21 22:38:26 -04:00
Dzmitry Malyshau
5d1746b0b4
Swizzle expression ( #734 )
2021-04-20 22:03:54 -04:00
Jim Blandy
4f442ff8cc
Require binding interpolation to be resolved by the front end.
...
When validating IR, verify that all `Binding`s for vertex shader outputs and
fragment shader inputs, whether directly in the argument or result, or applied
to a struct member, has specified an interpolation and sampling, not `None`.
This ensures that front ends explicitly state their policies, rather than
coasting through on back ends' default behavior.
In practice, all our front ends have very similar defaults, so provide a utility
function on `Module` to apply these rules. Use this utility function in the
SPIR-V and WGSL front ends; GLSL seems to already fill in interpolation as
required.
2021-04-19 09:42:00 -04:00
Jim Blandy
0910af2718
[wgsl-in] Implement WGSL interpolate syntax from gpuweb PR #1605 .
...
Fixes : #670
2021-04-19 09:42:00 -04:00
Jim Blandy
99a9e1e78e
Change Binding::Location to a struct-style enum variant.
...
This commit makes no other changes. This is in preparation for adding a third
field, at which point tuple variants start to get obscure.
2021-04-19 09:42:00 -04:00
Lachlan Sneff and Dzmitry Malyshau
4cbef59dd6
Add struct instantiation support to wgsl-in ( #507 )
...
* Add struct instantiation support to wgsl-in
* Readd type matching and move struct test
* rebase onto master and update tests
* Update tests to upstream
* Fix merge errors
* Rebase onto master
* [wgsl-in] delay composite type creation
* Use the new WGSL construction syntax in the tests
Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com >
2021-04-17 01:14:07 -04:00
Dzmitry Malyshau
96f9cb4ce1
[wgsl] Add support for simplified vector construction, add a snapshot test
2021-04-14 19:26:20 -04:00
Dzmitry Malyshau
c8d26a1f47
Splat support for WGSL and SPV in/out, updated snapshots
2021-04-14 19:26:20 -04:00
Mehmet Oguz Derin
142038c85b
WGSL: const to let
2021-04-11 01:24:19 -04:00
Dzmitry Malyshau
604e10e19b
Rewrite IR to have member offsets, full structure span and alignment
2021-04-08 23:15:03 -04:00
Dzmitry Malyshau
7326ba6ddb
New struct layout IR
2021-04-08 23:15:03 -04:00
Jim Blandy
2da7477322
[wgsl-in] Decorations are now called attributes. ( #671 )
...
Renames:
Error::UnknownDecoration => Error::UnknownAttribute
TypeDecoration => TypeAttributes
Scope::Decoration => Scope::Attribute
various argument names, string literals, comments
2021-04-07 22:45:38 -04:00
Dzmitry Malyshau
c41f050312
[wgsl-in] ability to take a pointer to something
2021-03-30 01:01:28 -04:00
Dzmitry Malyshau
ca6876b7a0
Validate math functions
2021-03-29 11:06:41 -04:00
Dzmitry Malyshau
c55bdf57bf
[wgsl] don't clone statements
2021-03-27 00:31:21 -04:00
Dzmitry Malyshau
6086f13bf0
Move the growable typifier into frontend helpers
2021-03-22 15:17:00 -04:00
Dzmitry Malyshau
c2f70aaf80
Validate binary expressions
2021-03-19 10:39:54 -04:00
Dzmitry Malyshau
d58f9bdfde
Merge sample mask in/out builtins
2021-03-18 21:57:48 -04:00
Dzmitry Malyshau
08eaad89db
Implement default layout in the IR and WGSL
2021-03-15 22:27:35 -04:00
Dzmitry Malyshau
20979b4800
[wgsl] type inference for constants
2021-03-15 01:31:57 -04:00
Dzmitry Malyshau
32a11752af
Rename FragCoord builtin into Position
2021-03-13 23:26:19 -05:00
Dzmitry Malyshau
ebcd815250
Update IR to have entry points with inputs/outputs
2021-03-13 23:26:19 -05:00
Dzmitry Malyshau
9e5cc4c9e4
Prevent matching on a reference once and for all
2021-03-12 11:35:09 -05:00
Dzmitry Malyshau
13d7a353e0
Switch entry points from map to a vec
2021-03-07 12:11:49 -05:00
Dzmitry Malyshau
2045a4a7be
Use BOOL_WIDTH everywhere
2021-03-06 11:01:14 -05:00
Dzmitry Malyshau
dd823a4b84
Enforce pointer semantics at the type level.
2021-03-06 11:01:14 -05:00
Joshua Groves
667f01ce17
[wgsl-in] Add descriptions for more errors
2021-03-04 00:10:58 -05:00
Joshua Groves
764bec5322
[wgsl-in] Expose location of parser errors
2021-03-03 10:26:47 -05:00
Dzmitry Malyshau
89e37d6e90
Explicitly emit expressions by Statement::Emit
2021-03-02 21:50:06 -05:00
Dzmitry Malyshau
96527290f3
[wgsl-in] encapsulate logic into parse_statement_restricted
2021-03-01 09:35:29 -05:00
Joshua Groves
bb7105387d
[wgsl-in] Use codespan to report errors
2021-02-28 00:07:37 -05:00
Joshua Groves
9c47a5fe17
[wgsl] Track token span for unexpected errors
2021-02-23 21:08:46 -05:00
Dzmitry Malyshau
0cefc1c46c
Remove mutation from the Call expression
2021-02-22 23:37:26 -05:00
Systemcluster
9f113bdd95
[wgsl] limit allowed for statement initializer statements
2021-02-18 10:55:16 -05:00
Systemcluster
e49910bb0a
[wgsl] allow empty for statement headers
2021-02-18 10:55:16 -05:00
Dzmitry Malyshau
8a0382a89d
Move global use flags into FunctionInfo
2021-02-17 15:37:37 -05:00
Systemcluster
59479f137d
[wgsl] support nested type parameters
2021-02-16 16:57:34 -05:00
Systemcluster
539db1a317
[wgsl] support for statement
2021-02-15 23:51:19 -05:00
Dzmitry Malyshau
e6251a23fe
[wgsl] fix boolean types and bang parsing
2021-02-15 22:59:04 -05:00
Joshua Groves
f42dc0c377
Fix some typos
2021-02-14 22:50:12 -05:00
Dzmitry Malyshau
61d711b58f
Remove the Header from IR
2021-02-14 20:23:31 -05:00
Systemcluster
dcd269782a
[wgsl] restrict type casts to matching container types
2021-02-14 11:56:49 -05:00
Dzmitry Malyshau
de5bd77279
ImageStore statement in IR
2021-02-14 11:55:35 -05:00
Dzmitry Malyshau
94bd97c0fb
[wgsl] early depth test attribute
2021-02-13 12:49:23 -05:00
Joshua Groves
9667a18980
[wgsl] Avoid consuming token twice in some cases
2021-02-13 00:13:23 -05:00
Joshua Groves
9c2a837a53
[wgsl] track number of bytes consumed per token
2021-02-13 00:13:23 -05:00
Anthony Cowley
141d2e7661
[wgsl] ignore offset decorations on struct fields
...
naga does not require offset decorations on struct fields in WGSL
source, and automatically adds them to spv output. The `tint` compiler
does not automatically add them, and requires that they be present in
the WGSL source.
A potential confusion is that an spv binary missing required
`OpMemberDecorate` instructions that set the field's offset will fail
validation when run through `spirv-val`. But since naga automatically
produces these offsets, the same spv binary passed through naga will
be successfully validated.
This change is to ignore these decorations in naga's WGSL front end so
that the same WGSL source can be used with naga and tint to produce
valid spv.
2021-02-12 18:27:02 -05:00