Commit Graph
648 Commits
Author SHA1 Message Date
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
Dzmitry Malyshau 62c2cf7332 Validate composite constants (#729) 2021-04-18 23:19:09 -04:00
Lachlan SneffandDzmitry 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
Dzmitry Malyshau d3b39d9e58 Splat expression in the IR 2021-04-14 19:26:20 -04:00
Dzmitry Malyshau 2923cfb3aa [spv-in] claim Vulkan Memory Model support 2021-04-13 01:31:57 -04:00
Mehmet Oguz Derin 142038c85b WGSL: const to let 2021-04-11 01:24:19 -04:00
Matúš Talčík 44a6c02cda spv-in: special-case a loop with true/false node == merge node
beautify

beautify #2
2021-04-09 17:17:02 -04:00
Dzmitry Malyshau 67e3e0a697 [spv-in] work around row-major matrices 2021-04-09 11:22:13 -04:00
Dzmitry Malyshau 0cc22c8c65 [spv-in] move the matrix decoration handling to structure parsing 2021-04-09 11:22:13 -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
LaughingMan d0d9e09cdb [spv-in] Copy less bytes in parse_function
The initial intention was to make the code a little more elegant and match on
the Vec itself instead of its length, however there's also a - probably
minuscule - performance advantage:

`Vec::remove` internally copies the removed element onto the stack. In this case
that's a `StructMember` weighting 48 bytes. The `Binding` we are actually
interested in is only 8 bytes tough.

Cloning just the `Binding` saves us from copying 40 bytes for nothing.
2021-04-08 13:10:56 -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 ead052b773 [spv-in] add a flag to adjust the coordinate space 2021-04-03 11:27:21 -04:00
Dzmitry Malyshau ab54f683be [spv-in] flip Y axis 2021-04-03 11:27:21 -04:00
Dzmitry Malyshau 427d8dc1eb [spv-in] pre-emit constant expressions 2021-03-31 23:17:19 -04:00
Dzmitry Malyshau c41f050312 [wgsl-in] ability to take a pointer to something 2021-03-30 01:01:28 -04:00
Dzmitry Malyshau 057fa336a8 [spv-in] derivative ops 2021-03-29 11:07:33 -04:00
Dzmitry Malyshau f06583ca7d [spv-in] change const indexes to signed int 2021-03-29 11:07:33 -04:00
Dzmitry Malyshau ca6876b7a0 Validate math functions 2021-03-29 11:06:41 -04:00
Dzmitry Malyshau e47ff2dc26 [spv-in] support output interface block 2021-03-27 10:52:00 -04:00
Dzmitry Malyshau c55bdf57bf [wgsl] don't clone statements 2021-03-27 00:31:21 -04:00
Dzmitry Malyshau 372b2d314e Adjust lints for Rust clippy 1.51 2021-03-25 12:34:25 -04:00
Dzmitry Malyshau 7d042337e2 Align the block decoration with SPIR-V, require storage buffers 2021-03-25 12:34:25 -04:00
Dzmitry Malyshau 4fb4133298 [spv-in] fix image array index type to be signed 2021-03-25 09:21:58 -04:00
Dzmitry Malyshau 26f629ccb4 [spv-in] fix image operand iteration, add support for constant offsets 2021-03-25 09:21:58 -04:00
Dzmitry Malyshau c8bac4b618 [spv-in] convert the shift to unsigned 2021-03-25 09:21:58 -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 f18728ed92 Enable more SPIR-V capabilities in the frontend 2021-03-17 16:33:21 -04:00
Dzmitry Malyshau a17ae022c6 Make analysis errors carry the function handle 2021-03-17 01:03:00 -04:00
Dzmitry Malyshau e3818bb236 [spv-in] fix treating OpPhi variables as pointers 2021-03-17 01:03:00 -04:00
Dzmitry Malyshau 9846a85174 [spv-in] patch calls from the entry points 2021-03-16 22:08:06 -04:00
Dzmitry Malyshau 08eaad89db Implement default layout in the IR and WGSL 2021-03-15 22:27:35 -04:00
Matúš Talčík 889e487b62 spv-in: fix classification of back edges
fix clippy

another fix
2021-03-15 11:09:53 -04:00
Dzmitry Malyshau 7d47a1b585 [spv-in] re-order the functions for the IR 2021-03-15 09:35:13 -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 e7c1415ca4 [spv-in] really consider variables as pointers 2021-03-09 10:10:10 -05:00
Dzmitry Malyshau 7c26320cce [spv-in] defer function call patching to the end of the module 2021-03-09 10:10:10 -05:00
Dzmitry Malyshau 13d7a353e0 Switch entry points from map to a vec 2021-03-07 12:11:49 -05:00
Dzmitry Malyshau e92b35725c [spv-in] work around integer built-ins for compute 2021-03-06 23:11:14 -05:00
Dzmitry Malyshau 2045a4a7be Use BOOL_WIDTH everywhere 2021-03-06 11:01:14 -05:00