Commit Graph
96 Commits
Author SHA1 Message Date
Igor Shaposhnik 02c74b5002 [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-24 18:17:02 -04:00
Dzmitry Malyshau 79d899fe4c Support num_workgroups builtin 2021-08-17 22:22:22 -04:00
Dzmitry Malyshau 5415d8c7c4 Fix atomics in workgroup storage 2021-08-13 23:01:25 -04:00
Jim Blandy 47b9f4a2e5 [spv-out] Writer::write_texture_coordinates: Fix result type. (#1188)
Some SPIR-V texture access instructions take coordinates as integers, others as
floats. The types of coordinates in Naga expressions generally match those in
SPIR-V, but Naga indices for arrayed textures are always integers, whereas
SPIR-V combines coordinates and array indices into a single vector, so indices
need to be cast to match the coordinate component type.

This commit makes `write_texture_coordinates` properly cast array indices to
match the coordinates' component type before combining them all into a single
result vector.

Fixes #1186.
2021-08-11 14:55:54 -07:00
Dzmitry Malyshau 88c1c9037d Add atomic exchange function 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 1aaf77489b [glsl-in] Improve error api and make more errors deferred 2021-08-09 10:51:15 -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
Gordon-F 4080bfe502 Add vec select to operators snapshot 2021-08-05 09:43:47 -04:00
Dzmitry Malyshau 6f21004369 Allow mixing on a scalar selector 2021-08-04 12:09:05 -04:00
João Capucho 057dc3100d [glsl-in] Remove support for multiple entry points 2021-08-04 11:06:57 -04:00
pyrotechnickandDzmitry Malyshau 2f516c0932 [wgsl] Storage buffer/texture access (#1142)
* Resurrect texture_storage_* tests
* Test parsing of `var<storage,write>`
* Default storage textures to READ
* Restore default features
* Fix glsl/hlsl/msl/spv front and back ends
* Add missing test outputs
* All-around fixes for the storage access

Co-authored-by: Dzmitry Malyshau <kvarkus@gmail.com>
2021-07-28 01:47:18 -04:00
João Capucho 677e040462 [glsl-in] Long form matrix support 2021-07-27 11:35:47 -04:00
Dzmitry Malyshau a7ac13a61d hlsl: special constants for base vertex/index 2021-07-27 01:49:03 -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
Dzmitry Malyshau 20c4d2c3d1 Add MSAA depth texture type 2021-07-22 10:39:24 -04:00
Jim Blandy f3c7537609 Add tests for sampling mipmapped and multisampled images.
Prior to this change, nothing in the test suite exercised the SPIR-V backend
code for generating LOD or Sample arguments to OpImageFetch instructions.
2021-07-20 01:01:55 -04:00
Dzmitry Malyshau 16206f2eb2 hlsl-out: unlock globals.wgsl test, override skybox bindings 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 8f71a368ef Validate the exact MSL version (#1101) 2021-07-16 23:56:15 -04:00
Dzmitry Malyshau e76824aba3 glsl-out: fix emission of location/binding attributes (#1100) 2021-07-16 23:04:55 -04:00
initial-algebra 602368d9f0 Support builtin(primitive_index) (#1097)
* Hack in support for PrimitiveID on Vulkan

* Rename to PrimitiveIndex and add preliminary support for GLSL, HLSL and MSL

* Implement as an extra WGSL built-in

* Update extra.wgsl outputs

* Run rustfmt; fix WGSL writer

* Add rustfmt changes I forgot

* Update extra.wgsl test output for WGSL fix

* Bump macOS version to 10.15 in validate-msl to support primitive_index
2021-07-16 22:18:20 -04:00
pyrotechnick 1d1aea243f Improve WGSL interpolation attributes (#1083)
* [wgsl-in] Map interpolate(..., center) to Sampling::Center

* [wgsl-out] Improve interpolation attributes

* [wgsl] Fix tests/in/interpolate.wgsl typo/format

* [wgsl] Snapshot WGSL artefacts

* [wgsl-out] Stack-only writing of interpolation
2021-07-13 21:57:52 -04:00
João Capucho 105a2ae5e1 [glsl-in] Check type dimensions in function calls 2021-07-07 12:59:20 -04:00
João Capucho 2b475ecc96 [spv-out] Support object-wise select 2021-07-06 10:12:24 -04:00
Dzmitry Malyshau c69736210a Snapshot test local variable inference 2021-07-06 01:26:03 -04:00
João Capucho c7b98f5ab9 [spv-out] accept texture trough function argument 2021-07-05 02:23:00 -04:00
Jasper St. Pierre 78e1304d42 [glsl-in] Convert bool -> scalar cast to Select 2021-07-02 01:34:34 -04:00
Jasper St. Pierre cb8e9f2cad [glsl-in] Implicitly splat the inputs of clamp() 2021-07-01 18:32:33 +01:00
João Capucho 2bb15eb0a8 [glsl-in] Add support for texture arguments 2021-07-01 11:19:28 -04:00
Gordon-F 925c92d12f Add entry point to operators wgsl test 2021-06-29 09:49:00 -04:00
Dzmitry Malyshau cfbe83e384 glsl-out: adjust coordinate space 2021-06-28 15:01:39 -04:00
Dzmitry Malyshau 57b3256020 [glsl-out] binding location mapping 2021-06-27 01:09:53 -04:00
Gordon-F a8119f005e Add extra fragment entry point to wgsl quad snapshot 2021-06-24 10:47:17 -04:00
Gordon-F e28344edbb [hlsl-out] Return entry points name to users 2021-06-24 10:47:17 -04:00
João Capucho 4bc4c60663 [glsl-in] Implicit casts for function calls 2021-06-19 13:58:21 -04:00
Gordon-F 6cdd332cef Reorganize test snapshot folder 2021-06-19 10:19:04 -04:00
Jim Blandy c16f2097ad [spv-out]: Ensure array subscripts are in bounds. 2021-06-18 20:44:07 -04:00
Jim Blandy fd3b2a93d4 access.wgsl: Make array mutable, and assign to an element. 2021-06-18 20:44:07 -04:00
Jim Blandy b8724eb1fd Tweak access.wgsl to avoid #913 and make SPIR-V more distinctive. 2021-06-18 20:44:07 -04:00
Frizi efd416d964 [glsl-in] parse all math functions 2021-06-17 16:08:34 -04:00
Frizi 20c6fd1862 add license headers to the bevy pbr shaders 2021-06-17 15:21:47 -04:00
Frizi 96980727cb [glsl-in] support nested swizzles and prevent l-value repeated components 2021-06-17 15:21:47 -04:00
Frizi b261dde77f [glsl-in] revert test case change 2021-06-17 15:21:47 -04:00
Frizi 378ea9d396 add more glsl snapshot tests 2021-06-17 15:21:47 -04:00
João Capucho 06c8588fcd [glsl-in] Add collatz shader and test quad shader 2021-06-09 12:54:58 -04:00
Dzmitry Malyshau 38f6a79917 [spv-out] fix image sampling ops, add more tests 2021-06-08 17:38:42 -04:00
Igor Shaposhnik be6a4172c5 Fix Expression::Load generating (#925)
* [glsl-out] Fix writing named expressions with array types

* [wgsl-out] Remove unsupported builtin from baked expression

* [glsl-out] Add a newline between globals for readability

* Set bake_ref_count to 1 for Expression::Load

* Update snapshot data
2021-06-08 10:15:26 -04:00
Jim Blandy a2a35f2eb3 Permit dynamic indexing of arrays and matrices only behind a pointer. (#949)
This makes Naga IR validation impose the restrictions added to WGSL in
gpuweb/gpuweb#1801.

Remove code in the SPIR-V writer to spill arrays to temporary variables in order
to index them dynamically. If such IR is encountered, treat it as a failure of
validation.
2021-06-04 12:57:20 -04:00