Better errors for Unexpected, BadInteger, BadFloat, BadTexture, BadTypeCast, UnknownScalarType, UnknownStorageClass, UnknownAttribute, UnknownBuiltin, UnknownShaderStage, UnknownStorageFormat and UnknownConservativeDepth, ZeroStride, ZeroSizeOrAlign and UnknownType.
Also adds lexer::capture_span.
Also fixes some validation for texture sample types and and issue that cauld cause e.g. the type `f33` to be parsed as `f32`.
Previously the types where changed in a later phase now they are changed
right when the argument is added, this makes the implementation slightly
less spec compliant because the following code will compile whilst it shouldn't
```glsl
void test(float a) {}
void test(out float b) {}
```
Matrix and vector constructors expected a vector (in the case of the
matrix) or a scalar (in both cases). Now they handle resizing such that
the following code now works
```glsl
mat3 a;
mat4(a); // This would return a validation error because it emitted a cast
```
WGSL requires that runtime-sized arrays appear only as the last member of a
structure in in the `storage` storage class. It seems to me that Naga should
enforce this restriction on its own IR as well.
The `apply_common_default_interpolation` helper function would panic if bindings
were missing, but missing bindings should be something that front ends can count
on validation to detect, so the helper should just return silently.
The validator returned `InvalidType` errors for missing bindings, apparently
because variables without bindings must be structs that do have bindings. But
this is unhelpful when you've just forgotten to label an argument. So this patch
adds a new, more specific, `VaryingError` variant.
Previously we passed a struct with the input bindings and just ignored
the outputs. Now we handle them the same way we do with builtins, by
creating function local globals that are read and written in a wrapper
entry point.