Commit Graph

271 Commits

Author SHA1 Message Date
Gordon-F
a8119f005e Add extra fragment entry point to wgsl quad snapshot 2021-06-24 10:47:17 -04:00
Gordon-F
e28344edbb [hlsl-out] Return entry points name to users 2021-06-24 10:47:17 -04:00
Gordon-F
1c5d538ab4 [glsl-out] Add entry point name to snapshot file name 2021-06-24 10:47:17 -04:00
João Capucho
4bc4c60663 [glsl-in] Implicit casts for function calls 2021-06-19 13:58:21 -04:00
Gordon-F
6cdd332cef Reorganize test snapshot folder 2021-06-19 10:19:04 -04:00
Jim Blandy
c16f2097ad [spv-out]: Ensure array subscripts are in bounds. 2021-06-18 20:44:07 -04:00
Jim Blandy
1d0b3f3a75 Functions can take pointers to unsized structs, but no other unsized types. 2021-06-18 20:44:07 -04:00
Jim Blandy
fd3b2a93d4 access.wgsl: Make array mutable, and assign to an element. 2021-06-18 20:44:07 -04:00
Jim Blandy
b8724eb1fd Tweak access.wgsl to avoid #913 and make SPIR-V more distinctive. 2021-06-18 20:44:07 -04:00
Gordon-F
46be75fb37 [hlsl-out] Implement all parts required by quad-spv snaphost test 2021-06-18 15:23:09 -04:00
Frizi
b89da31cc7 reorder namer assignment order to preserve names for reflection 2021-06-18 13:57:44 -04:00
Frizi
efd416d964 [glsl-in] parse all math functions 2021-06-17 16:08:34 -04:00
João Capucho
a07310536f [glsl-in] Build wgsl shaders for glsl test shaders 2021-06-17 20:57:32 +01:00
João Capucho
b490902112 [glsl-in] Add loads as needed 2021-06-17 20:57:32 +01:00
Frizi
20c6fd1862 add license headers to the bevy pbr shaders 2021-06-17 15:21:47 -04:00
Frizi
96980727cb [glsl-in] support nested swizzles and prevent l-value repeated components 2021-06-17 15:21:47 -04:00
Frizi
b261dde77f [glsl-in] revert test case change 2021-06-17 15:21:47 -04:00
Frizi
378ea9d396 add more glsl snapshot tests 2021-06-17 15:21:47 -04:00
Frizi
c7580f2743 [glsl-in] preserve entrypoint arg names for reflection 2021-06-17 15:21:47 -04:00
Frizi
e6d142f28f [glsl-in] treat const globals as constants allow them in array size exprs 2021-06-17 15:21:47 -04:00
Frizi
337014786c [wgsl-in] use AccessIndex for accesses using constant index 2021-06-17 11:34:58 -04:00
Gordon-F
96b37aff1f [hlsl-out] Reduce heap allocation 2021-06-16 14:03:50 -04:00
Gordon-F
92a11d0978 [hlsl-out] More improvements. Enable quad snapshot testing 2021-06-15 21:08:05 -04:00
Gordon-F
d1f9575ed1 [glsl-out] Write space after if keyword 2021-06-15 21:08:05 -04:00
Gordon-F
54d7d7d2a3 Improve hlsl-out 2021-06-13 11:15:42 -04:00
João Capucho
10422c6b4a Regenerate quad-glsl shader 2021-06-09 13:06:36 -04:00
João Capucho
06c8588fcd [glsl-in] Add collatz shader and test quad shader 2021-06-09 12:54:58 -04:00
João Capucho
be2231f6d9 [wgsl-out] Write global initializers 2021-06-09 10:14:46 -04:00
Dzmitry Malyshau
38f6a79917 [spv-out] fix image sampling ops, add more tests 2021-06-08 17:38:42 -04:00
Igor Shaposhnik
575304a50c [msl-out] Implement named expression generation (#957) 2021-06-08 12:09:46 -04:00
Igor Shaposhnik
be6a4172c5 Fix Expression::Load generating (#925)
* [glsl-out] Fix writing named expressions with array types

* [wgsl-out] Remove unsupported builtin from baked expression

* [glsl-out] Add a newline between globals for readability

* Set bake_ref_count to 1 for Expression::Load

* Update snapshot data
2021-06-08 10:15:26 -04:00
Jim Blandy
bfa2bbe590 Snapshot quad-glsl to WGSL, not SPIR-V and IR.
In tests/out, stop generating the uncommitted files quad-glsl.ron and
quad-glsl.spvasm, and add the snapshot quad-glsl.wgsl.
2021-06-07 17:27:09 +01: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
João Capucho
1c3baf4557 [glsl-in] Allow field selection behind pointers (#948) 2021-06-03 16:09:20 -04:00
João Capucho
87748a2fe3 [glsl-in] Add integration tests to CI (#943)
* [glsl-in] Add glsl snapshots folder

* [glsl-in] Fix incorrect angle brackets parsing

* [glsl-in] Temporarily remove wgsl snapshot output
2021-06-03 15:34:54 -04:00
Gordon-F
90c2cf6aa6 Add ability to generate named expressions 2021-06-03 10:40:59 -04:00
Frizi
2295508f0e Insert attribute glsl location qualifier for opengl ES 3.0 2021-06-02 12:36:04 -04:00
João Capucho
344acc3121 [glsl-in] Reenable snapshot tests 2021-06-01 21:11:50 -04:00
Aron Granberg
37724102a3 Improve wgsl lexer error messages.
Better errors for Unexpected, BadInteger, BadFloat, BadTexture, BadTypeCast, UnknownScalarType, UnknownStorageClass, UnknownAttribute, UnknownBuiltin, UnknownShaderStage, UnknownStorageFormat and UnknownConservativeDepth, ZeroStride, ZeroSizeOrAlign and UnknownType.

Also adds lexer::capture_span.

Also fixes some validation for texture sample types and and issue that cauld cause e.g. the type `f33` to be parsed as `f32`.
2021-05-30 11:01:00 -04:00
Dzmitry Malyshau
4b5ab528ac Comparison sampling tests 2021-05-28 22:43:39 -04:00
Dzmitry Malyshau
d3fbb30d46 [wgsl-out] Improve texture sampling call 2021-05-28 22:43:39 -04:00
Dzmitry Malyshau
8a1d883ba5 [wgsl-in] support textureSampleCompareLevel 2021-05-28 22:43:39 -04:00
Dzmitry Malyshau
1366546645 [glsl-out] improve array types 2021-05-28 22:18:51 -04:00
Dzmitry Malyshau
d1e2ac57fe New snapshot test for global variables 2021-05-28 22:18:51 -04:00
Jim Blandy
48363fcef1 Don't accept unsized types as function arguments. 2021-05-26 12:27:29 -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
João Capucho
ff8f15e034 [glsl-in] Start writting a parser without pomelo 2021-05-19 16:24:26 -04:00
Gordon-F
12e6dc5917 [wgsl-out] Implement all statements and expressions. Enable all wgsl-in tests 2021-05-19 14:11:05 -04:00
Dzmitry Malyshau
6c1832c8ee [spv-out] be smarter about deriving capabilities, auto derive them for tests 2021-05-19 02:01:25 -04:00
Gordon-F
6b3db1f487 [glsl-out] Write vector access as a swizzle 2021-05-19 00:09:12 -04:00