Replace the `ConcreteConstructor` and `ConcreteConstructorHandle`
types in `front::wgsl::lower::construction` with a single type
`Constructor` with a type parameter that determines how it refers to
Naga types.
Change `StatementContext` and `RuntimeExpressionContext` in
`front::wgsl::lower` to hold a `&mut crate::Function` reference,
rather than separate pointers to individual fields of the `Function`.
This replaces three fields with one, and clarifies their
relationships.
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.
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.
Remove `front::wgsl::lower::ExpressionContext::reborrow` and
`front::wgsl::lower::RuntimeExpressionContext::reborrow` in favor of
Rust's automatic reborrowing of `&mut` references.
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.
Make expression validation and constant expression validation reject
`Literal` expressions containing `F64` literals unless the `FLOAT64`
capability is enabled.
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'.
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)