Commit Graph
40 Commits
Author SHA1 Message Date
teoxoy ee81f569df add constructors test file 2023-07-17 16:26:08 -07:00
teoxoy 08105461ce omit non referenced expressions 2023-06-12 17:49:06 -07:00
Evan Mark Hopkins 7422ace934 [wgsl-in] Add predeclared vector and matrix type aliases (#2251) 2023-02-16 15:49:54 -08: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
Erich GublerandDzmitry Malyshau aa22301b4b Parenthesize unary negations to avoid -- (#2087)
* fix(glsl-out,hlsl-out,msl-out): parenthesize unary negations a la `wgsl` everywhere

Unify parenthesization of unary negations across all backends with what the `wgsl` backend does,
which is `<op>(<expr>)`. This avoids ambiguity with output languages for which `--` is a different
operation; in this case, we've been accidentally emitting prefix decrements.

* build: update `rspirv` 0.11 -> 0.12 (FIXME: use upstream release)

* test: add `operators::negation_avoids_prefix_decrement` test

Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
2022-11-17 11:43:56 +01:00
João Capucho db1321cfb6 wgsl-in: Splat on compound assignments
Compound assignments on wgsl follow the same semantics as their
underlying operation, this includes the splatting behavior when mixing
scalar and vector operands, which was done for binary operations but not
for compound assignments.
2022-09-10 10:17:20 -07:00
teoxoy 6dae3ac7e0 [wgsl-in] support partial vector & matrix identity constructors 2022-05-12 22:15:45 -07:00
teoxoy afb6504b8b add support for identity matrix constructor 2022-05-12 22:15:45 -07:00
teoxoy fea33c682e [wgsl-in] fix incr/decr not matching ValuePointer 2022-05-11 20:01:46 -07:00
teoxoy 062b66ca31 implement phony assignment 2022-04-26 21:40:31 -07:00
Igor Shaposhnik fbb77aa0dc [wgsl-in] Update entry point stage attributes 2022-04-15 18:02:48 +01:00
teoxoy d3b37dcdb1 add tests for remaining vector - scalar ops 2022-04-15 11:21:51 +02:00
teoxoy 2cda40396a comment out problematic negative int 2022-04-15 11:21:51 +02:00
teoxoy 4ea7dc3381 [spv-out] add support for matrix add and sub 2022-04-15 11:21:51 +02:00
teoxoy 4366e65609 add support for unary vector operators 2022-04-15 11:21:51 +02:00
teoxoy e4c017cb7c add more tests for operators 2022-04-15 11:21:51 +02:00
Teodor Tanasoaia cfcf625019 [wgsl-in] Constructor improvements (#1790)
* add support for zero value constructors and constructors that infer their type from their parameters

* address comments

* extract constructor machinery into new module

* fix doc link
2022-03-29 22:51:54 -07:00
teoxoy 9dddfeec37 [wgsl-in] implement increment and decrement 2022-03-27 00:34:53 -07:00
Pu Xingyu 3c313564ac wgsl-in: Make semicolon after struct decl optional 2022-03-27 00:22:58 -07:00
Igor Shaposhnik 816fa347ad [wgsl-in] Uses commas to separate struct members instead of semicolons 2022-03-12 22:07:06 -08:00
Igor Shaposhnik c356b93962 [wgsl-in] Optional parentheses for if and switch 2022-02-15 09:57:07 -05:00
Dzmitry Malyshau 4bd1efc34d wgsl: declare attribtues with @ 2022-01-20 19:44:05 -05:00
Dzmitry Malyshau c0b7ac7f54 WGSL: assignment binary operators 2022-01-11 11:01:24 -05:00
João Capucho e1552fd9d5 wgsl-in: Implement matrix construction from scalar 2021-12-17 10:39:31 -05:00
João Capucho 4334f0e6a9 Support bitwise And on booleans 2021-12-15 23:53:23 -05:00
João Capucho c64d5eff50 Support bitwise Or on booleans 2021-12-15 23:53:23 -05:00
Jay Oster 66c3499df8 [spv-out] Fix scalar-times-matrix operations (#1524) 2021-11-14 19:07:38 -05:00
Dzmitry Malyshau ee450c1ee4 Fix float-bool casts in MSL, SPV, and HLSL backends (#1459) 2021-10-12 11:42:20 -04:00
Igor Shaposhnik 943235cd5e [glsl-out] Convert modulo operator on float to SPIR-V OpFRem equivalent function (#1452) 2021-10-07 16:59:39 -04:00
Dzmitry Malyshau 7681f4a21f msl-out: fix as_type expressions 2021-09-09 21:09:20 -04:00
Dzmitry Malyshau c1eed779fe Infer types of module-scope let declarations 2021-09-08 09:42:36 -04:00
Dzmitry Malyshau a4f19833b5 hlsl: implement struct constructors 2021-09-03 12:43:54 -04:00
Zicklag 897afbd710 [wgsl-in] [wgsl-out] Implement bitcast() 2021-08-20 17:19:23 -04:00
Gordon-F 4080bfe502 Add vec select to operators snapshot 2021-08-05 09:43:47 -04:00
Dzmitry Malyshau 6f21004369 Allow mixing on a scalar selector 2021-08-04 12:09:05 -04:00
João Capucho 2b475ecc96 [spv-out] Support object-wise select 2021-07-06 10:12:24 -04:00
Gordon-F 925c92d12f Add entry point to operators wgsl test 2021-06-29 09:49:00 -04:00
Dzmitry Malyshau 120fc22e9f Support unary not in WGSL 2021-04-27 01:24:21 -04:00
Dzmitry Malyshau bb716f9c10 [spv-out] implement array value indexing (#723) 2021-04-16 17:11:18 -04:00
Dzmitry Malyshau 96f9cb4ce1 [wgsl] Add support for simplified vector construction, add a snapshot test 2021-04-14 19:26:20 -04:00