Commit Graph
252 Commits
Author SHA1 Message Date
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
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