Using 1D images should require either the `Sampled1D` or `Image1D` capability.
Using cube array images should require either the `SampledCubeArray` or
`ImageCubeArray` capability.
Introduce a helper type that manages the details of emitting SPIR-V
conditionals, tracking labels, branches, merge annotations and phi nodes.
Change index bounds checks to use this helper.
For ease of review, there should be no meaningful code changes in this commit.
Match arms are merely moved out into their own functions, whose arguments are
the enum variant's fields, along with any free variables from the function
containing the match.
* [hlsl-out] flatten the entry point inputs
Previously, the logic was re-ordering the inputs according to the binding.
This breaks if one of the inputs is a struct. With this change, the struct
fields are also flattened into the fake entry point struct. We also
construct the original arguments at the beginning of the function.
* hlsl-out: completely separate the flattened IO structs from the original IR structs
Previously, we had heuristics to detect if a particular struct needs the fields
to be re-ordered. We'd re-order interface structs without layout, and the detection
was very fragile and easily wrong.
The new logic is spawning separate struct types if we need any re-ordering to happen.
It's solid, there are no heuristics.
Remove `forbidden_caps`.
Accumulate capabilities actually used separately from the permitted
capabilities, so that the latter can be retained across Writer resets, while the
former is cleared between modules.
Hlsl and wgsl don't support them directly so a polyfill is used taken
from the msl spec.
`asinh` = `log(x + sqrt(x * x + 1.0))`
`acosh` = `log(x + sqrt(x * x - 1.0))`
`atanh` = `0.5 * log((1.0 + x) / (1.0 – x))`
Previously we always set the lhs flag when lowering to generate a
pointer so that dynamic indexing would work, this would produce an error
on constant variables since they can't be in a lhs context.
Now we introduce an enum which distinguishes not only between lhs and
rhs but also in array base, if lowering in a lhs context the base is
also lowered in a lhs context but if lowering in rhs the base is lowered
in a special array base context which bypasses the mutability check.
Fixes#1237
Previously the constructor just used the type of the scalar argument
regardless of whether or not it actually matched the vector splat
constructors target type. This resulted in e.g. `vec2<f32>(0)`
erroneously getting the type of a bi-vector of Sints with width 4.
Now the splat constructor checks that the kind and width of the scalar
argument is the same as that of the target specified in the
constructor's type parameter.