Commit Graph

19 Commits

Author SHA1 Message Date
Jim Blandy
8b267218a4 Implement module compaction.
Add a new Naga feature, `"compact"`, which adds a new function
`naga::compact::compact`, which removes unused expressions, types, and
constants from a `Module`.
2023-09-20 18:46:33 +02:00
Frederik Magnus Johansen Vestre
0491d39232 Support dual source blending (#2427)
Co-authored-by: teoxoy <28601907+teoxoy@users.noreply.github.com>
2023-08-30 21:00:35 +02:00
teoxoy
d348d843e1 implement const-expressions (phase 1) 2023-07-17 16:26:08 -07:00
daxpedda
b7f4006e46 Bump bitflags to v2 (#2358) 2023-06-01 15:40:47 +02:00
Ashley
ce48588d74 [front/spir-v] Obey the is_depth field of OpTypeImage (#2341)
* [front/spir-v] Obey the is_depth field of OpTypeImage

* Add changed tests
2023-05-22 09:35:58 -07:00
Erich Gubler
99a7773e65 fix(hlsl-out): use Interlocked<op> intrinsic for atomic integers (#2294)
We currently assume that we are using raw `RWByteAddressBuffer` methods for all atomic operations (`<pointer>.Interlocked<op>(<raw_byte_offset>, …)`), which is only true when we use `var<storage, read_write>` globals. For `var<workgroup>` globals, we need `Interlocked<op>(<pointer>, …)`, using the original expression as the first argument.

Fix this by branching on the `pointer`'s address space in `Atomic` statements, and implementing the workgroup address space case with intrinsics.

Remove atomic ops from `access`, add new `atomicOps` test.

Fixes #2284
2023-04-05 19:37:22 -07:00
Leah
58105a06e2 [glsl/hlsl-out] Write sizes of arrays behind pointers in function arguments (#2250)
arrays can be put behind pointers in inout and out parameters in GLSL and HLSL,
whose dimensions must be specified to let array access
compile. so, we specify their dimensions.

fixes #2248
2023-02-17 00:40:21 +00:00
teoxoy
3ace8b81cb fix array being flagged as constructible when its base isn't 2023-01-25 18:07:48 +01:00
teoxoy
85e3b0844f add type_flags to ModuleInfo 2023-01-25 18:07:48 +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
Dzmitry Malyshau
76d30e5055 Add ValidationFlags::BINDINGS 2022-12-13 12:59:28 -05:00
Dzmitry Malyshau
2ddc8d1929 Rename StorageClass to AddressSpace 2022-01-31 16:25:06 -05:00
Jim Blandy
944a693ae5 Use UniqueArena for types.
Ensure that each distinct type occurs only once in `Module::types`, so that we
can use `Eq` on `Type` or `TypeInner` for type equivalence, without being
confused by differing `Handle<Type>` values that point to identical types.

This removes a number of duplicate types from the ir snapshots.

Fixes #1385.
2021-09-27 15:17:41 -04:00
Dzmitry Malyshau
27e4ba59e4 Validate that SampleLevel::Exact isn't used for comparisons 2021-08-13 01:45:43 -04:00
Dzmitry Malyshau
7c3cc904a0 [spv-in] fix storage buffer access decorations 2021-08-05 12:59:19 -04:00
pyrotechnick
2f516c0932 [wgsl] Storage buffer/texture access (#1142)
* Resurrect texture_storage_* tests
* Test parsing of `var<storage,write>`
* Default storage textures to READ
* Restore default features
* Fix glsl/hlsl/msl/spv front and back ends
* Add missing test outputs
* All-around fixes for the storage access

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-07-28 01:47:18 -04:00
João Capucho
4da665d3ba Address comments 2021-07-01 11:19:28 -04:00
João Capucho
7df4a52af9 [valid] Handle texture/sampler function argument 2021-07-01 11:19:28 -04:00
Gordon-F
6cdd332cef Reorganize test snapshot folder 2021-06-19 10:19:04 -04:00