Jim Blandy
49f6730624
[wgsl-in] Consolidate array and struct cases in construction.
2023-10-23 10:33:09 -07:00
teoxoy
f081f06f54
fix expected min arg count of textureLoad
2023-10-23 10:26:46 -07:00
Jim Blandy
528bca75f7
Give front::wgsl::Error::InitializationTypeMismatch named fields.
2023-10-23 15:01:39 +02:00
Jim Blandy
946745d38f
[wgsl-in] Turn Error::Other
into Error::Internal
, to help devs.
...
Provide a textual message with `front::wgsl::Error::Internal`, so that
a developer who sees one of these errors can at least search the
source tree to find out where it came from.
2023-10-23 14:57:25 +02:00
Jim Blandy
dd8f814344
[wgsl-in] Clean up swizzle/component access type.
...
Rename `front::wgsl::lower::Composition` to `Components`. It doesn't
represent a composition, it represents either a single component being
selected from a vector or a swizzle.
Clean up code and helper function names.
2023-10-23 14:56:14 +02:00
Jim Blandy
d038506a8c
[wgsl-in] Delete {ExpressionContext,RuntimeContext}::reborrow.
...
Remove `front::wgsl::lower::ExpressionContext::reborrow` and
`front::wgsl::lower::RuntimeExpressionContext::reborrow` in favor of
Rust's automatic reborrowing of `&mut` references.
2023-10-23 14:52:29 +02:00
Jim Blandy
a647c64432
[wgsl-in] Delete front::wgsl::lower::StatementContext::reborrow.
...
Remove `StatementContext::reborrow` in favor of Rust's automatic
reborrowing of `&mut` references.
2023-10-23 14:52:29 +02:00
Jim Blandy
0285bf9388
[wgsl-in] Delete front::wgsl::lower::GlobalContext::reborrow.
...
Remove `GlobalContext::reborrow` in favor of Rust's automatic
reborrowing of `&mut` references.
2023-10-23 14:52:29 +02:00
Jim Blandy
6d4807fc6d
[wgsl-in] Delete front::wgsl::parse::ExpressionContext::reborrow.
...
Remove `ExpressionContext::reborrow` in favor of Rust's automatic
reborrowing of `&mut` references.
Use lifetime elision in more places.
2023-10-23 14:52:29 +02:00
Jim Blandy
509ea4c857
[wgsl-in] Generate no code for trivial vector/matrix construction. ( #2576 )
...
Do not emit an `Expression::As` conversion for WGSL like `vec3(v)`
where `v` is already a `vec3`, or `mat2x3(m)` where `m` is already a
2x3 matrix. This doesn't fix any bugs, but it makes it clearer to the
reader of `Lowerer::construct` that no conversion can actually take
place in this case.
Some snapshots are affected because `As` expressions whose `width` is
`None` are bitcast expressions, which the constant evaluator does not
yet support. When this commit removes those `As` expressions, the
constant evaluator can reduce the expression to a `Literal` or
`ZeroValue`, which is then concealed by #2539 .
2023-10-23 14:48:18 +02:00
exrook
17dfdb9365
fix clippy lints introduced in 1.72 and 1.73 ( #2581 )
...
fixes:
- [non_canonical_clone_impl](https://rust-lang.github.io/rust-clippy/master/index.html#non_canonical_clone_impl )
- [non_canonical_partial_ord_impl](https://rust-lang.github.io/rust-clippy/master/index.html#non_canonical_partial_ord_impl )
- [redundant_guards](https://rust-lang.github.io/rust-clippy/master/index.html#redundant_guards )
2023-10-22 12:25:29 -07:00
Teodor Tanasoaia
19209b67d2
[wgsl-in] consolidate type resolution logic in a few macros ( #2571 )
...
* [wgsl-in] consolidate type resolution logic in a few macros
* rename + docs
* reorder macros (avoids doc linking not working)
2023-10-19 13:20:02 -07:00
teoxoy
29ca53148d
fix OOB typifier indexing
2023-10-19 09:15:28 -07:00
Jim Blandy
af26d77ce4
[wgsl-in] Abstract out ExpressionContext::as_const_evaluator.
2023-10-19 17:56:51 +02:00
Jim Blandy
334f745366
Make validation reject 64-bit floating-point literals.
...
Make expression validation and constant expression validation reject
`Literal` expressions containing `F64` literals unless the `FLOAT64`
capability is enabled.
2023-10-19 17:55:04 +02:00
Jim Blandy
1bb84aef0b
rename validate_literal to check_literal_value
2023-10-19 17:55:04 +02:00
Jim Blandy
860c200469
Give Validator::check_width its own error type, WidthError
.
...
Later changes will use `check_width` in new functions. Separating out
`WidthError` will make it easier to incorporate `check_width`'s
results into its new callers'.
2023-10-19 17:55:04 +02:00
teoxoy
5b65f11e3c
[refactor] make use of resolve_type
wherever possible
2023-10-18 12:25:36 -07:00
Teodor Tanasoaia
e25280df93
[glsl/spv-out] Cull functions that should not be available for a given stage ( #2531 )
2023-10-18 12:50:52 +00:00
teoxoy
cf113bdb53
[spv-in] translate ModfStruct & FrexpStruct to their IR equivalents
2023-10-17 21:53:26 -07:00
teoxoy
4b7a555e9f
[glsl-in] disable modf & frexp
2023-10-17 21:53:26 -07:00
teoxoy
5a0fb630da
[valid] add Capabilities::CUBE_ARRAY_TEXTURES
2023-10-17 21:51:54 -07:00
Teodor Tanasoaia
de9913f476
[spv-in] remove spirv::Capability::ImageMSArray
...
as we don't support multisampled storage textures at all
2023-10-17 21:50:32 -07:00
teoxoy
2f6a32f5f9
[spv-in] remove spirv::Capability::InterpolationFunction
...
as we don't support the `InterpolateAtCentroid`, `InterpolateAtSample`, or `InterpolateAtOffset` `GLSL.std.450` extended instructions
2023-10-17 21:50:32 -07:00
teoxoy
7ee474b4a5
[spv-in] remove duplicated capabilities
2023-10-17 21:50:32 -07:00
teoxoy
6854b0ab4f
disallow ptr to workgroup fn arguments
2023-10-16 19:03:14 -07:00
teoxoy
ea83f62a94
[msl-out] add min version check for ray tracing
2023-10-16 19:02:58 -07:00
teoxoy
89ab5902b2
[msl-out] add min version check for primitive_id
2023-10-16 19:02:58 -07:00
teoxoy
46c472731f
[msl-out] add min version checks for binding arrays
2023-10-16 19:02:58 -07:00
teoxoy
f4a43b1bf0
[msl-out] add min version check for read-write storage textures
2023-10-16 19:02:58 -07:00
teoxoy
0c63be8904
[msl-out] add min version check for reverse_bits
, extract_bits
& insert_bits
2023-10-16 19:02:58 -07:00
teoxoy
a7146b07a1
[msl-out] add min version check for base_instance
& instance_id
2023-10-16 19:02:58 -07:00
teoxoy
0340c2e685
[msl] add undocumented checks
2023-10-16 19:02:58 -07:00
teoxoy
0cfd2213cc
[msl-out] remove min version check on storage address space
2023-10-16 19:02:58 -07:00
Jim Blandy
68ce1ebfa2
[glsl-in, glsl-out] Fix warnings about redundant doc link targets.
2023-10-16 17:28:56 -07:00
teoxoy
d71f2541a3
remove IsFinite
& IsNormal
completely
2023-10-16 16:24:52 -07:00
teoxoy
04562dea26
Split UnaryOperator::Not
into UnaryOperator::LogicalNot
& UnaryOperator::BitwiseNot
...
since it should not be valid to use the logical and bitwise not operators interchangeably
also, don't allow `UnaryOperator::Negate` to operate on booleans (no frontend/backend supports this)
2023-10-16 16:22:06 -07:00
teoxoy
841d360f06
[valid] avoid OOM with large sparse resource bindings
2023-10-16 14:23:05 -07:00
Jim Blandy
9eb3a1dc8a
[wgsl-out] Generate correct code for bit complement on integers.
...
Remove incorrect special case for `UnaryOperator::Not` on vectors.
2023-10-12 13:18:19 +02:00
Jim Blandy
1b485ea925
[wgsl-in] Don't double-initialize variables local to loops.
2023-10-12 13:13:26 +02:00
teoxoy
f7e15bf391
[valid] check local variable initializer is const
2023-10-12 13:13:26 +02:00
Jim Blandy
a3ba3259fe
Some documentation for ConstantEvaluator.
2023-10-12 13:13:26 +02:00
Jim Blandy
504b33d8cd
[wgsl-in] Document necessity of force_non_const
.
2023-10-12 13:13:26 +02:00
teoxoy
4f453b4041
avoid const-evaluating the operators.wgsl
snapshot
2023-10-12 13:13:26 +02:00
teoxoy
a77f6ff51c
[const-eval] error on NaN and infinite floats
2023-10-12 13:13:26 +02:00
teoxoy
d8ceeae3b2
Avoid FXC's error X3694: race condition writing to shared resource detected
2023-10-12 13:13:26 +02:00
Jim Blandy
ca2e810492
Properly recognize Literal
expressions as non-dynamic indices. ( #2537 )
...
Restore `negative_index` test in `tests/wgsl-errors.rs`, as part of
the `invalid_arrays` test function.
2023-10-12 13:13:26 +02:00
teoxoy
c5b2afaf78
[const-eval] error on invalid binary operations
2023-10-12 13:13:26 +02:00
teoxoy
13a0ed4eae
[const-eval] evaluate BinaryOperator::Modulo
correctly (use the truncated version instead of floored)
2023-10-12 13:13:26 +02:00
teoxoy
a9c28d47c3
[const-eval] allow bitcast, select and relational functions for GLSL since they should be supported
2023-10-12 13:13:26 +02:00