Commit Graph

145 Commits

Author SHA1 Message Date
Jim Blandy
6a5b33fa24
Move BoundsCheckPolicy/Policies into proc, from back. (#1537) 2021-11-17 19:15:59 -08:00
Igor Shaposhnik
30a0a37af0 Update dependencies 2021-11-16 23:46:54 -05:00
Jim Blandy
c1b378842e
Make tests properly exercise Some("") global names. (#1503)
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.
2021-11-01 14:07:11 -04:00
Jim Blandy
0e3fbc8166
Replace pointer-access.spv snapshot test with WGSL source. (#1450)
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.
2021-10-06 16:30:36 -04:00
Connor Fitzgerald
2f5a41cce9
Add insert/extractBits and pack/unpack functions (#1449) 2021-10-05 20:32:57 -04:00
João Capucho
71a75d727d
[glsl-out] Es: convert 1D images to 2D (#1436) 2021-10-03 23:01:44 -04:00
João Capucho
f01eb72378
[Snapshots] Allow a blacklist of entrypoints for glsl-out (#1444) 2021-10-02 23:22:49 -04:00
Jim Blandy
2e73e48657
When writing snapshots, reliably identify which writer has failed. (#1427) 2021-09-28 13:42:26 -04:00
Dzmitry Malyshau
004a12e21d
[spv-out] option to clamp frag_depth (#1431) 2021-09-27 23:00:10 +00:00
Dzmitry Malyshau
21324b8fea
Update WGSL grammar for pointer access. (#1312)
* 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.
2021-09-27 18:49:28 -04:00
Jim Blandy
8122598fe7 [wgsl-out] Correct handling of named pointer expressions.
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.
2021-09-27 16:01:43 -04:00
João Capucho
6a57559070 [glsl-out] Improve handling of samplerCubeArrayShadow
Adds checks that it isn't used in an unsupported function and emits the
depth_ref as a separate argument.
2021-09-21 16:54:05 -04:00
Dzmitry Malyshau
52d74e91a4 spv-out: option to emit PointSize 2021-09-15 18:48:18 -04:00
Jim Blandy
4abf22c4d1 snapshot tests: Always write IR when requested, even if validation fails. 2021-09-15 10:37:12 -04:00
Dzmitry Malyshau
db80ed4fa9 Fix warnings in snapshots and spv-in 2021-09-14 09:46:25 -04:00
João Capucho
3049f63cad
[spv-in] new block parser (#1294)
* [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>
2021-09-10 08:51:05 -07:00
Dzmitry Malyshau
e226cf3f1d spv-out: option to skip OpName for varyings 2021-09-08 16:52:10 -04:00
Dzmitry Malyshau
7138876625 [spv-out]: ability to separate entry points 2021-09-07 14:22:39 -04:00
Jim Blandy
cb0ad2504c [spv-out] Handle break and continue in switch statements.
Fixes #1030.
Fixes #1017.
2021-08-27 16:39:59 -07:00
Jim Blandy
28547e3d3b Gather index, buffer, and texture bounds check policies into a single struct. 2021-08-26 19:08:06 -04:00
Jim Blandy
1b95e023e7 [spv-out] Support a separate bounds check policy for buffers. 2021-08-26 19:08:06 -04:00
Jim Blandy
140e3223e2 snapshot tests: Parse bounds checks policy properly. 2021-08-26 19:08:06 -04:00
Jim Blandy
bdf774aa8b Rename BoundsCheckPolicy::UndefinedBehavior to Unchecked.
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.
2021-08-26 19:08:06 -04:00
Jim Blandy
901e2c0694 [spv-out] Implement BoundsCheckPolicy for image access 2021-08-22 23:41:27 -04:00
Jim Blandy
de114e479b Rename IndexBoundsCheckPolicy to BoundsCheckPolicy. 2021-08-22 23:41:27 -04:00
Jim Blandy
63e58f2022
[wgsl-in] Print errors nicely in convert_wgsl snapshot tests. (#1274) 2021-08-22 22:31:11 -04:00
Igor Shaposhnik
464788dc8d
[hlsl-out] Implement switch statement (#1265)
* [hlsl-out] Implement switch statement

* [hlsl-out] Implement switch statement

* Add switch tests to control-flow snapshot
2021-08-22 22:30:22 -04:00
João Capucho
778049f97a Apply comments 2021-08-20 16:57:18 -04:00
João Capucho
bbf3e465f3 Add support for inverse hyperbolic trignometric functions
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))`
2021-08-20 16:57:18 -04:00
sigaloid
9050108a95 Fix some clippy suggestions 2021-08-20 16:42:47 -04:00
Dzmitry Malyshau
78f225a37a Implemented atomics in HLSL-out 2021-08-10 21:48:02 -04:00
Dzmitry Malyshau
8c371e8063 Atomic expressions, support in backends except HLSL and the validator. 2021-08-10 21:48:02 -04:00
João Capucho
a8a316da15 [glsl-in] API revamp
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.
2021-08-09 10:51:15 -04:00
João Capucho
057dc3100d [glsl-in] Remove support for multiple entry points 2021-08-04 11:06:57 -04:00
Gordon-F
d3243bd774 [glsl-out] Enable access snapshot testing 2021-07-26 13:53:48 -04:00
Dzmitry Malyshau
284cfcce47 hlsl: storage writes 2021-07-26 01:29:42 -04:00
Dzmitry Malyshau
4b6846d5da hlsl: storage reads support, array length 2021-07-26 01:29:42 -04:00
Gordon-F
3c98cc5ae1 [hlsl-out] Validate all entry points in Makefile 2021-07-20 01:03:58 -04:00
Dzmitry Malyshau
16206f2eb2 hlsl-out: unlock globals.wgsl test, override skybox bindings 2021-07-18 02:21:01 -04:00
Dzmitry Malyshau
0d94b76d1e hlsl-out: rewrite texture coordinate construction 2021-07-18 02:21:01 -04:00
Dzmitry Malyshau
51fb9bb77a hlsl-out: remap bindings 2021-07-18 02:21:01 -04:00
Dzmitry Malyshau
2a253ab838 hlsl-out: derive register based on storage class 2021-07-18 02:21:01 -04:00
Jim Blandy
337e40a2be
Enable logging in WGSL and SPIR-V tests. (#1098)
Use env_logger::try_init to avoid complaints about repeated initialization. This
function is thread-safe.
2021-07-16 23:09:48 -04:00
Gordon-F
4ef754bb9d [hlsl-out] Enable image snapshot 2021-07-16 10:31:01 -04:00
Gordon-F
2716d368a1 [hlsl-out] Implement barrier statement 2021-07-16 10:31:01 -04:00
Jasper St. Pierre
0995c7161e [glsl-in] Keep around extra linkage variables
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.
2021-07-14 17:48:54 -04:00
Jasper St. Pierre
0b69aa8b8a Init env_logger in snapshots tests
For debugging. Maybe there's a way to do it for all tests,
not sure...
2021-07-14 17:48:54 -04:00
Dzmitry Malyshau
458db0b522 [hlsl-out] expose profile string conversions 2021-07-11 23:14:07 -04:00
Gordon-F
9e61390626 [hlsl-out] Zero initialize variables. Write interpolation and sampling qualifier 2021-07-07 10:57:28 -04:00
Gordon-F
65fbbf1101 [hlsl-out] Return only real names on entry point in ReflectionInfo 2021-07-05 18:54:42 -04:00