Commit Graph
19 Commits
Author SHA1 Message Date
Fredrik Fornwall a0eb1f5462 [wgsl-in] Allow sign() to take int argument (#2463) 2023-09-06 09:29:35 -07:00
Fredrik Fornwall 5329aa2bd5 [wgsl-in] Handle modf and frexp (#2454) 2023-09-02 08:55:35 +02:00
Fredrik Fornwall f49314dbbd Fix validation and glsl parsing of ldexp (#2449)
Fixes #1908.
2023-09-01 18:44:48 +02:00
Evan Mark Hopkins f7de1942c1 [spv-out] Cache OpConstantNull (#2414) 2023-08-02 18:05:16 +02:00
Jim Blandy 412d5aa62e [wgsl-in] Generate Expression::Literal. 2023-05-11 07:09:53 -07:00
Teodor Tanasoaia 4d87401fac Use Expression::ZeroValue in SPIR-V and WGSL front ends. 2023-05-10 19:30:03 -07:00
Evan Mark Hopkins 9befaed7e9 [hlsl-out] Fix return type for firstbitlow/high (#2315) 2023-04-25 14:49:26 +02:00
teoxoy b9c5cb5a78 validate vertex stage returns the position built-in 2023-04-12 10:48:18 -07:00
PyryM 52043be004 [spv-out] Fix invalid spirv being generated from integer dot products (#2291)
* Fix invalid spirv generation in int dotprod

constants cannot be declared inside of a function block, so instead use `write_constant_null` to produce a correctly-declared constant 0.

* autogenerated test snapshots
2023-03-30 16:02:54 +02:00
Teodor Tanasoaia cde457cedd [spv-out] fix countLeadingZeros impl (#2258) 2023-02-20 20:40:26 +00:00
Mauro GentileandTeodor Tanasoaia 810e9d26fc Add countTrailingZeros (#2243)
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2023-02-20 20:40:59 +01:00
Evan Mark Hopkins 60c0fc0284 [spv-out] Cache constant composites (#2257) 2023-02-20 15:24:20 +01:00
Evan Mark Hopkinsandteoxoy 6be394dac3 Add countLeadingZeros (#2226)
* Add countLeadingZeros

* [glsl-out] Bake countLeadingZeros

* [hlsl-out] Bake countLeadingZeros

* [hlsl-out] Update Baked expressions

* Remove unnecessary bake for sints

* [glsl-out] CountLeadingZeros without findMSB

* Don't check negatives when uint

* Perform the type conv after mix

* use log2

* fix clippy lints

---------

Co-authored-by: teoxoy <28601907+teoxoy@users.noreply.github.com>
2023-01-31 21:31:05 +01:00
Evan Mark Hopkins 9f182ade30 [wgsl] Add refract built-in 2023-01-23 11:50:50 +01:00
6035b07b78 [wgsl-in] Implement module-level scoping.
Fixes #1745: Support out-of-order module scope declarations in WGSL
Fixes #1044: Forbid local variable shadowing in WGSL
Fixes #2076: [wgsl-in] no error for duplicated type definition
Fixes #2071: Global item does not support 'const'
Fixes #2105: [wgsl-in] Type aliases for a vecN<T> doesn't work when constructing vec from a single argument
Fixes #1775: Referencing a function without a return type yields an unknown identifier error.
Fixes #2089: Error span reported on the declaration of a variable instead of its use
Fixes #1996: [wgsl-in] Confusing error: "expected unsigned/signed integer literal, found '1'"

Separate parsing from lowering by generating an AST, which desugars as
much as possible down to something like Naga IR. The AST is then used
to resolve identifiers while lowering to Naga IR.

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
Co-authored-by: Jim Blandy <jimb@red-bean.com>
2023-01-12 09:37:08 -08:00
Evan Mark Hopkins a80967f860 Add support for the saturate function (#2025)
uses clamp in place of saturate in spv and glsl
2022-08-16 10:43:41 +00:00
João Capucho ae58fbf4d0 Add tests 2022-06-14 16:04:08 -07:00
João Capucho c7e6769001 Add tests 2022-06-14 13:14:43 -07:00
Luke Street 0d1fc2131f [wgsl-in] Support radians/degrees builtin functions (#1627) 2021-12-27 00:29:33 +00:00