* Support buffer resource arrays in IR, wgsl-in, and spv-out
* spv-out: refactor non-uniform indexing semantics to support buffers
* Update the doc comment on BindingArray type
* Improve TypeInfo restrictions on binding arrays
* Strip DATA out of binding arrays
* Include suggested documentation, more binding array tests, enforce structs
[Since Rust 1.58], Rust format strings have been able to "capture
arguments simply by writing {ident} in the string." Clippy 1.67 made
the corresponding warning, `uninlined_format_args`, warn-by-default.
Inlined arguments seem more readable, so Naga should adopt them.
[Since Rust 1.58]: https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1580-2022-01-13
Fixes#1745: Support out-of-order module scope declarations in WGSL
Fixes#1044: Forbid local variable shadowing in WGSL
Fixes#2076: [wgsl-in] no error for duplicated type definition
Fixes#2071: Global item does not support 'const'
Fixes#2105: [wgsl-in] Type aliases for a vecN<T> doesn't work when constructing vec from a single argument
Fixes#1775: Referencing a function without a return type yields an unknown identifier error.
Fixes#2089: Error span reported on the declaration of a variable instead of its use
Fixes#1996: [wgsl-in] Confusing error: "expected unsigned/signed integer literal, found '1'"
Separate parsing from lowering by generating an AST, which desugars as
much as possible down to something like Naga IR. The AST is then used
to resolve identifiers while lowering to Naga IR.
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
Co-authored-by: Jim Blandy <jimb@red-bean.com>
Introduce a new `TypeFlags::CONSTRUCTIBLE` flag, corresponding to
WGSL's "constructible types". Set this on the appropriate types.
Check for this flag on function return types.
The new `check_one_validation` macro permits the source code to be a
computed expression, not just a string literal. This also cleans up
some of the handling of the optional guard expression.
* add support for zero value constructors and constructors that infer their type from their parameters
* address comments
* extract constructor machinery into new module
* fix doc link
* Rewrite front/back doc summaries
- Use line comments instead of block comments
- Standardize language for each front/backend
- Add reference link for each format
- Minor punctuation changes
* Add documentation for keywords module
* Clarify contents of keywords module in summary
* Refer to modules by their type name
* Add basic summary for valid module
* Adjust EarlyDepthTest and ConservativeDepth docs
* Remove "in" from list
* Adjust wording
* Standardize format of docstrings
* Adjust module links to be consistent with other links
* Add summary for reserved keywords list
* Remove extraneous doc spaces with `cargo fmt`
* Correct spelling of whether and rewrite some lines
* Fill out GLSL backend docs
* Remove unnecessary link targets
* Fill out DOT backend docs
* Change module line comments to block comments
* Remove unnecessary spaces
* Fix mistake during rebasing
Pointers should not be `DATA`: they can never be stored in anything. (Function
arguments are not storage; they're like `let` bindings.)
Un-`SIZED` values may only live in the `Storage` storage class, so creating
pointers to them in other storage classes is meaningless.
The `ARGUMENT` flag should be set only on pointers in those storage classes that
are permitted to be passed to functions.
See comments in code for details.
Fixes#1513.
* Proof-of-concept for adding spans to validation errors.
Still missing: actually printing the damn stuff.
* Emit errors from analyzer in the CLI.
TODO: tests, I guess!
* Simplification refactoring: avoid avoiding allocations so vehemently.
* Mask helper traits with `as _`.
* Fix block iterator throwing up when span feature is disabled.
* Nest use statements.
* Add basic docs.
* Axe AddSpanResult.
WGSL says:
> - The last member of the structure type defining the store type for a variable
> ... may be a runtime-sized array.
>
> - A runtime-sized array must not be used as the store type or contained within
> a store type in any other cases.
Thus, a struct whose final member is a struct whose final member is a
runtime-sized array is verboten.
* Update WGSL grammar for pointer access.
Comes with a small test, which revealed a number of issues in the backends.
* Validate pointer arguments to functions to only have function/private/workgroup classes.
Comes with a small test. Also, "pointer-access.spv" test is temporarily disabled.
Treat `TypeInner::ValuePointer` and `TypeInner::Pointer` as equivalent by
converting them to a canonical form before comparison.
Support `ValuePointer` in WGSL type output.
Fixes#1318.
Fixes#1356.
Output for the test case in that issue is now:
error: the value indexed by a `[]` subscripting expression must not be a pointer
┌─ wgsl:5:14
│
5 │ let a = *pv[3]; // Problematic line
│ ^^ expression is a pointer
Could not parse WGSL
* Implement lexing for all WGSL number literal types
* Move number literal test cases
* Adjust tests to match WGSL spec on number literals
Suffixes are not type names and currently only a plain `u` is supported
for uints. More specifically, `i` and `f` suffixes or suffixes with
widths in bits like `u32` are not supported at the moment.
* Add more tests for invalid number literal suffixes
* Replace code too new for Rust 1.43
* Implement parsing for hexadecimal integers
* Switch to enum number types, and Bytes for width
* Check for negative and leading zeros in int literals
* Implement parsing of hex floats with hexf-parse
* Update error message tests
* Update snapshot test output files
* Clean up lexer state machine code
* Clean up unexpected token error code
* Move number literal parsing to own submodule