Commit Graph

241 Commits

Author SHA1 Message Date
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
Jim Blandy
5753f6e107 [wgsl-in] Improve error message for UnknownIdent. 2021-05-19 00:07:39 -04:00
Gordon-F
b4aa966575 [wgsl-out] Create baking expression for texture function 2021-05-18 13:33:25 -04:00
Dzmitry Malyshau
96ec0b61e7 Snapshot for built-ins 2021-05-18 10:01:14 -04:00
Jim Blandy
0985727710 [wgsl-in] Include span information in 'unknown identifier' errors. 2021-05-17 19:46:37 -04:00
Dzmitry Malyshau
b191c982ec Remove alignment from struct IR 2021-05-17 09:32:52 -04:00
Gordon-F
6efe347e90 [wgsl-out] Implement all math functions. Rename entry point function based on stage. Rename entry point output struct. 2021-05-14 18:14:23 -04:00
Gordon-F
5958f98489 [wgsl-out] Enable snapshot testing for wgsl-in image test 2021-05-14 18:12:02 -04:00
Dzmitry Malyshau
418e71281e Derivative tests 2021-05-14 09:53:24 -04:00
Jim Blandy
057d03ad86 [wgsl-in]: Add tests for array and struct validation. 2021-05-13 22:09:22 -04:00
Jim Blandy
f45d812266 [wgsl-in]: Move WGSL front end integration tests into a WGSL-specific file.
This lets us reduce noise by removing a bunch of `#[cfg]` attributes. In the
future, if we have tests for other front ends, we can create an `errors`
subdirectory, but for now, we only have the WGSL tests, so we should keep things
flat.
2021-05-13 22:09:22 -04:00
Dzmitry Malyshau
a8df6a2b34 [msl] make sizes buffer local to each function 2021-05-13 22:02:37 -04:00
Igor Shaposhnik
6a42e4a0f8 [wgsl-out] Enable snapshot testing for spv-in quad shader 2021-05-12 15:15:50 -04:00
Dzmitry Malyshau
ba422f10f8 [msl] fix splat namespace 2021-05-08 22:07:13 -04:00
Dzmitry Malyshau
350ceb383d WGSL support for f64, snapshot test for it 2021-05-08 21:20:23 -04:00
Dzmitry Malyshau
59d1dcab5b Support width changes in As expression 2021-05-08 21:20:23 -04:00
Gordon-F
53fe7a329f [glsl-out] Handle uninitialized global variables 2021-05-08 21:09:11 -04:00
Gordon-F
73b20ffa70 Add CullDistance BuiltIn 2021-05-08 09:51:14 -04:00
Dzmitry Malyshau
09032695b0 Barrier follow-up fixes 2021-05-06 14:48:55 -04:00
Dzmitry Malyshau
63afb9a215 Add Capabilities bitset for validation 2021-05-05 21:39:41 -04:00
Dzmitry Malyshau
990fd2d3a3 Allow matrix indexing behind a pointer 2021-05-05 09:34:12 -04:00
Dzmitry Malyshau
be00a05fa5 [spv-in] default output builtins 2021-05-04 22:54:33 -04:00
Dzmitry Malyshau
9fe75ed7f1 Barriers 2021-05-04 22:16:24 -04:00
Igor Shaposhnik
1476ef84ff [spv-in] Fix empty gl_PerVertex name 2021-05-04 10:45:39 -04:00
Gordon-F
9fbe681316 [spv-in] Give entry point function the same name as entry point itself 2021-05-04 10:45:39 -04:00
Lachlan Sneff
f6da21f8dd Unify back::msl push constants map and sizes buffer (#825)
* Unify back::msl push constants map and sizes buffer

* Fix clippy warning

* Actually remove PushConstantsMap

* Update snapshots
2021-05-03 21:51:44 -04:00
Dzmitry Malyshau
b8649b3848 Fix struct layouts for WGSL and SPIRV 2021-05-03 17:27:12 -04:00
Dzmitry Malyshau
46a244fff0 [wgsl-in] remove lifetime from ParseError 2021-05-02 23:49:34 -04:00
Timo de Kort
05d3608737 HLSL CI (#788)
* Add validation-windows yml for HLSL

Add workgroup size to hlsl-out

* Update Readme with Make target information

* Change runs on to windows-latest

* Remove snapshot file
2021-05-02 11:29:35 -04:00
Lachlan Sneff
232fd65ec7 Add support for retrieving array length in msl backend (#806)
* Add support for arrayLength to the wgsl frontend

* Fix clippy warning

* Add draft support for array length to the msl backend

* Finalize support for array length in msl

* Convert buffer size to array length in msl backend

* Fix clippy warning

* Fix misleading documentation

* Changes based on review of PR

* Use a fake binding for sizes buffer in msl backend if necessary

* Only generate the msl buffer size structure if globals are present that have unsized arrays

* Make sure to generate separators

* Replace uses_unsized_buffers with !self.runtime_sized_buffers.is_empty()

* Clear self.runtime_sized_buffers

* Run snapshot of shadow.msl

* Add Expression::ArrayLength support to the spirv backend

* Remove wgsl target from the access snapshot test

* Update access.msl snapshot

* Update stack size for msl backend

* Update stack size again for msl backend
2021-04-30 22:40:32 -04:00
Dzmitry Malyshau
992bdd83ce Report per-entry point translation errors in the MSL output snapshots (#808) 2021-04-30 13:38:20 -04:00