Commit Graph

1899 Commits

Author SHA1 Message Date
Evan Mark Hopkins
74e5b4a07e [wgsl] Update inverse hyperbolic built-ins 2023-01-23 11:50:50 +01:00
Evan Mark Hopkins
9f182ade30 [wgsl] Add refract built-in 2023-01-23 11:50:50 +01:00
Jonathan Behrens
1be8024bda Support 16-bit unorm/snorm formats (#2210)
* Support 16-bit unorm/snorm formats

* Add Capabilities::STORAGE_TEXTURE_16BIT_NORM_FORMATS

* Add 16-bit normalized formats to spv frontend
2023-01-18 19:03:24 +01:00
Jonathan Behrens
1cffd236a7 Remove overly restrictive array stride check (#2215) 2023-01-18 16:28:38 +01:00
Jim Blandy
cdcfad277a Let the uniformity analysis trust the handle validation pass.
Undo some changes from #1668, now that #2090 has been merged.
2023-01-14 19:25:31 -08:00
Jim Blandy
f0a8ff6b3a Fix docs for Emit statements. (#2208) 2023-01-15 00:00:15 +01:00
SparkyPotato
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
Timo de Kort
7effd12596 Update setup-dxc to v1.1.0 (#2204) 2023-01-11 18:23:42 +01:00
Jim Blandy
86a88de396 Revert "Error if the uniformity requirements for a barrier aren't met" (#2203)
This reverts commit e6e94d65ab.
2023-01-11 16:35:03 +01:00
Daniel McNab
e6e94d65ab Error if the uniformity requirements for a barrier aren't met 2023-01-09 16:39:33 -08:00
teoxoy
5b4e94630b [glsl-out] use fma polyfill for versions below gles 320 2023-01-06 17:20:27 -08:00
Rainb0w :3
e98bd9264c [glsl-out] emit reflection info for non-struct uniforms (#2189) 2023-01-04 20:26:52 +01:00
Erich Gubler
224ff3897d build(cli): use conventional bin path for naga-cli 2022-12-27 10:38:37 -08:00
PENGUINLIONG
24316fd4bc Allow u32 coordinates for textureStore/textureLoad (#2172) 2022-12-22 18:59:22 +01:00
Dzmitry Malyshau
02280a7357 msl: handle the case of missing binding (#2175) 2022-12-22 11:21:21 +01:00
Zhixing Zhang
8e1b0529e6 Supporting gl_PointCoord (#2180) 2022-12-21 13:05:15 +01:00
Jim Blandy
37be4df2b8 Fix warnings when building tests without validation. 2022-12-20 22:24:24 -08:00
Erich Gubler
461fdda425 Add handle validation pass to Validator (#2090)
Before proceeding with any other validation, check that all Handles are valid for their arenas, and refer only to older handles than themselves. This allows subsequent stages to simply use indexing without panics, assuming validation has passed.
2022-12-17 00:26:43 +00:00
Erich Gubler
420c9845f8 refactor: resolve clippy::manual_clamp 2022-12-15 11:20:47 -08:00
Erich Gubler
3c26ffb07a fix(docs): fix invalid <...> URLs with code spans 2022-12-15 11:20:47 -08:00
Dzmitry Malyshau
76d30e5055 Add ValidationFlags::BINDINGS 2022-12-13 12:59:28 -05:00
Avi Weinstock
5d8fc3fdcf [wgsl-in/spv-out] Add support for WGSL's atomicCompareExchangeWeak (#2165)
* Add support for WGSL's `atomicCompareExchangeWeak` with the `__atomic_compare_exchange_result` struct, and add SPIR-V codegen for it.

Partially addresses https://github.com/gpuweb/gpuweb/pull/2113, #1755.

* Add tests for `atomicCompareExchangeWeak`, and support both u32 and i32 atomics with it.

* More thorough typechecking of the struct returned by `atomicCompareExchangeWeak`.
2022-12-13 10:47:28 +01:00
teoxoy
8f1d82f0d2 [wgsl] update reserved keywords 2022-12-12 16:54:21 -08:00
Teodor Tanasoaia
9a00937b50 fix-fmt 2022-12-12 09:46:38 -08:00
Teodor Tanasoaia
300ffcafbf update error note 2022-12-12 09:46:38 -08:00
Teodor Tanasoaia
ee5c343038 fix tests 2022-12-12 09:46:38 -08:00
Teodor Tanasoaia
36bae0760d remove non-32bit integers 2022-12-12 09:46:38 -08:00
Teodor Tanasoaia
4748721857 remove comment 2022-12-12 09:33:24 -08:00
Teodor Tanasoaia
bf71b015a1 [wgsl-out] remove workgroup_size builtin 2022-12-12 09:33:24 -08:00
Teodor Tanasoaia
e671d6b49c [wgsl-in] remove workgroup_size builtin 2022-12-12 09:33:24 -08:00
robtfm
2dcb6963fa add Range::new_from_bounds 2022-12-12 11:57:23 +01:00
Jim Blandy
0197246365 Ignore unused_imports in tests/snapshots.rs.
This is for the same reason that we ignore `dead_code`:

    // A lot of the code can be unused based on configuration flags,
    // the corresponding warnings aren't helpful.
2022-12-12 11:14:17 +01:00
Jonathan Behrens
4f77cbafb7 [wgsl-out] Write correct scalar kind when width != 4 (#1514)
* [wgsl-out] Write correct scalar kind when width != 4

* slight refactoring

* Also handle matrix scalar widths

* Fix formatting
2022-12-12 10:56:28 +01:00
teoxoy
5a1f43d12d [doc] add more switch docs 2022-12-09 10:21:58 -08:00
teoxoy
63e85b4b15 [doc] explain how case clauses with multiple selectors are supported 2022-12-09 10:21:58 -08:00
teoxoy
f36adeefaa [glsl-out] introduce a new block for switch cases 2022-12-09 10:21:58 -08:00
teoxoy
eccdc0aeb1 [spv-out] omit extra switch case blocks where possible 2022-12-09 10:21:58 -08:00
teoxoy
be70a2ec03 [spv-out] fix switch cases after default not being output 2022-12-09 10:21:58 -08:00
teoxoy
3455147496 [hlsl-out] omit extra switch case blocks where possible 2022-12-09 10:21:58 -08:00
teoxoy
db63877c8c [msl-out] omit extra switch case blocks where possible 2022-12-09 10:21:58 -08:00
teoxoy
e05706bc48 [wgsl] remove fallthrough statement
also add support for default to be used with other case selectors
2022-12-09 10:21:58 -08:00
teoxoy
8405e387d8 [wgsl-in] use parse_block in more places 2022-12-09 10:21:58 -08:00
JMS55
bf4e62b1ac Fix textureGather on texture_2d<u32/i32> (#2138)
* Fix textureGather on texture_2d<u32/i32>

* Add textureGather u32/i32 tests

* Update src/valid/expression.rs

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>

* Fix formatting

* undo analyzer change

Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
2022-12-05 10:03:11 +00:00
João Capucho
d1c29534c8 glsl-in: Fix position propagation in lowering (#2079)
When lowering `Select` expressions the position could be wrongfully
updated from `AccessBase { constant_index: false }` to
`AccessBase { constant_index: true }` this caused dynamic indexing
in an array behind a structure to fail if it was stored in a constant.

Furthermore the position could also be updated from `Rhs` to
`AccessBase`, this could cause issues because `AccessBase` doesn't
load variables (which `Rhs` does), so accessing a member from a
structure behind a pointer would return the wrong result.
2022-12-02 10:48:20 +01:00
Marco Buono
4976494709 Document EarlyDepthTest and ConservativeDepth syntax in WGSL (#2132) 2022-11-20 10:45:45 +01:00
Teodor Tanasoaia
5b79cca384 bump MSRV to 1.63 (#2129) 2022-11-18 16:29:49 +00:00
Erich Gubler
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
Teodor Tanasoaia
e056805784 [msl-out] use back::COMPONENTS (#2124) 2022-11-16 11:12:45 -08:00
Erich Gubler
1650581fe7 refactor(cli): simplify output_paths w/ <&[T]>::get and Option::unwrap (#2114) 2022-11-04 16:20:47 +01:00
Teodor Tanasoaia
01fbdea21f fix 1.65 clippy lints (#2112) 2022-11-03 18:32:20 +01:00