Both a `var` binding and a `let` binding of a pointer to a variable create
entries in the `lookup_ident` tables whose expression is a `LocalVariable`.
However, the `let` should be a pointer, whereas the `var` should be a reference.
This patch changes the tables to hold `TypedExpression` values, thus preserving
the distinction.
The old filenames were probably based on the shader stage, not the shader
function name, which the PR changed to do in response to a review suggestion.
`tests/out/glsl/operators.main.Fragment.glsl` is no longer generated because the
function in question changed to a Compute entry point.
`tests/out/wgsl/multiple_entry_points-glsl.wgsl` is no longer generated because
the input test was removed in 057dc310.
Make the parser code more closely follow the spec's grammar around
`unary_expression`, `postfix_expression`, and `singular_expression`.
Change the handling of postfix expressions (indexing, member/component access,
and swizzling) to apply the indirection at the appropriate time, resulting in
code improvements on all output formats. For example, where we used to generate
the following MSL:
metal::float4 _e13 = bar.matrix[3];
float b = _e13.x;
we now generate, simply:
float b = bar.matrix[3].x;
Propagate WGSL reference types correctly, so that parenthesizing expressions no
longer causes the Load Rule to be applied.
Together with #1332 (already landed), this is a replacement for #1312, and
unblocks #1352.
Fixes#1351.
Regression from ce676cf130.
We need to output (*d).mx rather than *d.mx, at least according to Tint.
wgsl-in seems to handle *d.mx just fine, which is likely a separate bug.
* [spv-in] New two pass parser based
* [spv-in] Allow expressions defined in dominant block in different scopes
* Make the patch non breaking
* [spv-in] Allow scope transfers in phi instructions
* [spv-in] Remove unused stuff
* [spv-in] Handle switch merges as breaks
* Remove no longer needed stuff
* Revert some changes to prepare to merge
* Remove dead code
* Don't spill into local if in scope
* [spv-in] Documentation, comments, some renaming for clarity.
* Address comments
Co-authored-by: Jim Blandy <jimb@red-bean.com>
* Fix GLSL output for non-fallthrough switch cases
Partially reverts 02c74b5002 and
fixes#1309.
* Fix indentation of control-flow WGSL code
* Clean up glsl-out switch case fallthrough handling
Only insert a break if needed
and if a case is fallthrough, insert a comment indicating this.
* Implement fuzzing for the GLSL parser
* Remove arbitrary dependency from naga
Derive `Arbitrary` for proxy objects in `fuzz/fuzz_targets/glsl_parser.rs`
instead.
Fixes#1305.
Ensure that two `back::spv::LocalType::Image` values are sure to be equal (and
hash equal) whenever they would generate the same `OpTypeImage` instruction, so
that the usual duplicate removal via `Writer::lookup_type` works. Accomplish
this by changing the contents of `LocalType::Image` to more closely match the
operands of `OpTypeImage` instructions.
Previously, `LocalType::Image` included a `ImageClass::Storage::access` value,
which did not affect the `OpTypeImage` instruction generated. If two
`LocalType::Image` values differered only in their `access`, then they would get
separate entries in `Writer::lookup_type`, two identical `OpTypeImage`
instructions would be generated, and SPIR-V validation would fail.
Change `write_type_declaration_local` to handle any type that can be represented
as a `LocalType`. This means that Image and Sampler types are handled there now.
Change `write_type_declaration_arena` to defer to `write_type_declaration_local`
to handle any type that can be represented as a `LocalType`. This makes the code
for those types in `write_type_declaration_arena` redundant, so remove it.
However, continue to request SPIR-V capabilities for image types from
`write_type_declaration_arena`, since that function is fallible, while
`write_type_declaration_local` is not.
When we are leaning on robust buffer access to do the job for us, there's no
undefined behavior going on. So `UndefinedBehavior` suggests people are doing
something reckless even if they're not. The policy just says what Naga is doing,
and it shouldn't pretend to say what the rest of the system is doing.