* ConstantEvaluator::swizzle: Handle vector concatenation, indexing.
* Handle vector Compose expressions nested two deep.
* Move `flatten_compose` to `proc`, and make it a free function.
* [spv-out] Ensure that we flatten Compose for OpConstantCompose.
Instead of letting the user supply an arbitrary closure for appending
expressions, instead give `ConstantEvaluator` an `Option` that holds
an `Emitter` to interrupt, and a `block` to add any new `Emit`
statements to.
With the addition of the constant evaluator to the `proc` module, it
is now concerned with constructing expressions. Any code that
constructs expressions will generally also need to deal with `Emit`
statements, which are handled by the `Emitter` type. However,
`Emitter` is private to the `front` module. This patch moves it to
`proc` and makes it accessible to both the constant evaluator and the
front ends.
Change the validator to enforce WGSL's requirement that all variables
in the `function` and `private` address spaces must have constructible
types.
Mark the `RayQuery` type as `CONSTRUCTIBLE`, since it is intended to
be used for local variables.
Add a regression test.
If an `Emit` statement covers an `Expression` that is not otherwise
used by any `Statement`, remove it from the `Arena` anyway. An `Emit`
statement controls when `Expression`s are evaluated, but it doesn't
have any side effects, so unless an expression is used by some other
statement, it's not necessary to the program.
Change printlns in the backend functions to say "generating" instead
of "writing" before calling the Naga backends. "Writing" suggests
writing output to a file; "generating" seems more accurate for calling
a backend.
Add a new type, `Input`, representing a particular Naga input file,
with methods to generate related paths - output files with a
particular extension, parameter files, and the input file itself.
Use this throughout `snapshots.rs` to generate paths.
Give `Input` utility methods for reading and writing files.
Rather than adding a `-glsl` suffix to the name, just rely on
`check_targets`' standard naming behavior, treating
`tests/in/variations.glsl` like any other snapshot input.
Remove the call to `Validator::validate` in `convert_spv`, since it
directly follows the call to `check_targets`, which also called
`Validator::validate`.
The only difference between the two is whether `Parameters::god_mode`
is respected, but this difference doesn't seem to have been
deliberate: at the time the call to `check_targets` was added to
`convert_spv` (5f21cf360, 2021-02-17), the two calls were exactly the
same.
Use `FastIndexSet`, rather than `FastHashSet`, for tracking global
declarations' dependencies, so that the order in which functions are
inserted into the `Module` is not dependent on the hash function.