The GLSL empty-global-name.frag test doesn't suffice because the GLSL front end
doesn't produce the same IR as the SPIR-V included in the bug report. As far as
I know, only a genuine SPIR-V input test can produce a global whose name is
`Some("")`.
Include the SPIR-V assembly source.
The original pointer access test used SPIR-V for its input because WGSL didn't
have a working pointer indirection operator at the time. Now that it does, we
can just write this test in WGSL directly.
Fixes#1432.
* 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 expressions in `Function::named_expressions` like WGSL `let` declarations,
assuming that the Load Rule was applied to the rhs of the declaration, meaning
that their values are always `Indirection::Ordinary`.
Split `write_expr_plain_form` out from `write_expr_with_indirection`, to clean
up the parenthesis generation: no more `opened_paren` variable, just function
calls. This makes the early return for named expressions neater.
Fixes#1382.
* [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>
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.
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))`
The new api allows for reuse while keeping some allocations and to
please the borrow checker in future work, it also splits the parser into
logical modules to make it easier to work on.
WGSL will require this. Note that this still might
cause some issues with multi-entry-point GLSL
that I didn't know how to handle. That is, we will
handle unused builtin inputs but not unused
builtin outputs correctly right now. This is an existing
issue though, not a regression.
This is also provided as an option, but I feel like
the more correct approach is to never strip linkage
variables. We'll see though.