Commit Graph

174 Commits

Author SHA1 Message Date
Frizi
bff8b18a01 [glsl-in] lower swizzle store to per-component stores 2021-06-17 15:21:47 -04:00
Igor Shaposhnik
54af830855 Fix nightly clippy suggestions 2021-06-09 10:17:20 -04:00
Jim Blandy
a2a35f2eb3 Permit dynamic indexing of arrays and matrices only behind a pointer. (#949)
This makes Naga IR validation impose the restrictions added to WGSL in
gpuweb/gpuweb#1801.

Remove code in the SPIR-V writer to spill arrays to temporary variables in order
to index them dynamically. If such IR is encountered, treat it as a failure of
validation.
2021-06-04 12:57:20 -04:00
Gordon-F
90c2cf6aa6 Add ability to generate named expressions 2021-06-03 10:40:59 -04:00
Jim Blandy
398d3545b3 Include the type arena in ResolveContext, since it's always needed. 2021-05-26 10:35:59 -04:00
Jim Blandy
50de6ae9ac Improve error messages for missing I/O bindings.
The `apply_common_default_interpolation` helper function would panic if bindings
were missing, but missing bindings should be something that front ends can count
on validation to detect, so the helper should just return silently.

The validator returned `InvalidType` errors for missing bindings, apparently
because variables without bindings must be structs that do have bindings. But
this is unhelpful when you've just forgotten to label an argument. So this patch
adds a new, more specific, `VaryingError` variant.
2021-05-21 23:04:27 -04:00
Jim Blandy
a7100b14eb Flesh out the Naga module-level documentation. 2021-05-19 23:31:19 -04:00
Dzmitry Malyshau
b191c982ec Remove alignment from struct IR 2021-05-17 09:32:52 -04:00
Jim Blandy
9c5f324de2 TypeInner::span: Tolerate bad array length constants for now. 2021-05-13 22:09:22 -04:00
Dzmitry Malyshau
59d1dcab5b Support width changes in As expression 2021-05-08 21:20:23 -04:00
Dzmitry Malyshau
990fd2d3a3 Allow matrix indexing behind a pointer 2021-05-05 09:34:12 -04:00
Dzmitry Malyshau
9fe75ed7f1 Barriers 2021-05-04 22:16:24 -04:00
Gordon-F
dbfc11a196 [glsl-out] Fix writing identifiers starting with gl_ 2021-05-03 21:47:16 -04:00
Ashley Ruglys
33003d8ea2 Add MathFunction::Refract 2021-04-26 14:14:30 -04:00
Dzmitry Malyshau
e8c5242cc7 Fix relational expression type width 2021-04-25 12:57:59 -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
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
Dzmitry Malyshau
d3b39d9e58 Splat expression in the IR 2021-04-14 19:26:20 -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
Dzmitry Malyshau
5673603bab [spv-out] flip position Y 2021-04-03 11:27:21 -04:00
Dzmitry Malyshau
4389a86787 Fix layout roundup 2021-04-03 00:41:32 -04:00
Dzmitry Malyshau
8ff27187d1 Fix matrix multiplication types 2021-04-01 15:49:37 -04:00
Dzmitry Malyshau
8712020115 Move Layouter into ModuleInfo 2021-03-23 10:11:50 -04:00
Dzmitry Malyshau
6086f13bf0 Move the growable typifier into frontend helpers 2021-03-22 15:17:00 -04:00
Dzmitry Malyshau
970b77abaf Make type a part of ExpressionInfo 2021-03-22 15:17:00 -04:00
Dzmitry Malyshau
efcfa37634 Implement Index for Layouter 2021-03-20 22:25:49 -04:00
Dzmitry Malyshau
c992e638fe Move all the validation into a separate meta-module 2021-03-20 22:25:49 -04:00
Dzmitry Malyshau
caee860b70 Make uniformity analysis optional 2021-03-20 22:25:49 -04:00
Dzmitry Malyshau
d5fbb193c3 Validate Select and Relational expressions 2021-03-19 10:39:54 -04:00
Dzmitry Malyshau
c2f70aaf80 Validate binary expressions 2021-03-19 10:39:54 -04:00
Dzmitry Malyshau
daab319dc0 Validate Expression::Compose 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
67ca0e7e7f First bits of expression validation 2021-03-18 11:43:00 -04:00
Dzmitry Malyshau
72ede02888 Reduce the typifier error sizes 2021-03-18 10:26:26 -04:00
Dzmitry Malyshau
6e71366bd3 Test typifier error sizes 2021-03-18 10:26:26 -04:00
Dzmitry Malyshau
a17ae022c6 Make analysis errors carry the function handle 2021-03-17 01:03:00 -04:00
Dzmitry Malyshau
259a56761f Consider dynamic arrays to have at least 1 element for the layout 2021-03-16 22:08:06 -04:00
Dzmitry Malyshau
2b888e4c09 Detect the forward function calls 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
Dzmitry Malyshau
7d47a1b585 [spv-in] re-order the functions for the IR 2021-03-15 09:35:13 -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
7ebd96b597 Fix uniformity requirements of emitted expressions 2021-03-12 16:21:08 -05:00
Dzmitry Malyshau
dd273e254a Distinguish between expression uniformity and function uniformity 2021-03-11 10:14:47 -05:00
Dzmitry Malyshau
f5ee791912 More error information for uniformity analysis 2021-03-09 22:54:03 -05:00
Dzmitry Malyshau
d433ee81e6 Relax array and block structure validation 2021-03-09 09:55:17 -05:00
Dzmitry Malyshau
13d7a353e0 Switch entry points from map to a vec 2021-03-07 12:11:49 -05:00