Commit Graph
125 Commits
Author SHA1 Message Date
Capucho dd5021234d [glsl-out] Reworked the backend
The backend now works in a similar way to the msl backend
Should require less loops, allocations and backtracking
Overall just better to work with it

Added a build script which reads a file with the glsl keywords and
generates a slice to be used in the Namer

Added a way to build a call graph
2020-11-22 14:45:12 -05:00
Dzmitry Malyshau 23b1e4dd76 [spv-out] fix generation of OpConvert 2020-11-20 12:30:02 -05:00
Dzmitry Malyshau 1b8b3845be [mtl] Add 'kernel' and 'using' keywords 2020-11-20 10:57:59 -05:00
Dzmitry Malyshau 7c7702c9d8 [mtl] move writer into a separate module 2020-11-19 23:19:26 -05:00
Dzmitry Malyshau fa36ef194c [mtl] move keywords into a separate file 2020-11-19 23:19:26 -05:00
Dzmitry Malyshau 0f7b6e3e76 [mtl] dont include the std namespace 2020-11-19 23:19:26 -05:00
Dzmitry Malyshau 36bc6b8596 [mtl] populate reserved words more 2020-11-19 23:19:26 -05:00
Dzmitry Malyshau d0f3450564 [msl make backend a folder module 2020-11-19 23:19:26 -05:00
Timo de Kort 929e07ff0c [spv-out] Add support for vector with vector multiplication 2020-11-18 17:37:52 +01:00
Timo de Kort 27ec95a238 [spv-out] Load variables when using CompositeConstruct (#284) 2020-11-16 16:52:51 -05:00
Timo de Kort 820dc51e2f [spv-out] Fix annotations not getting added to output (#281) 2020-11-16 16:49:35 -05:00
Timo de Kort 022b42c44b [spv-out] Reduce BinaryOperator::Multiply indentation 2020-11-15 13:05:21 -05:00
Timo de Kort d0de2faa73 [spv-out] Add and implement bitwise_and 2020-11-14 12:40:02 -05:00
Timo de Kort cbcdcf470f [spv-out] Add and implement i_sub and f_sub 2020-11-14 11:03:07 -05:00
Timo de Kort a1dc8c2d28 [spv-out] Fix duplicate scalar OpType 2020-11-13 19:55:18 +01:00
Dzmitry Malyshau 5e77653c55 [ir] select expression 2020-11-12 17:43:33 +01:00
Dzmitry Malyshau 8b56f3ef96 [ir] support function argument names (#270) 2020-11-11 21:34:37 +01:00
Dzmitry Malyshau a54800afc1 Naming processor, used for [msl] 2020-11-11 12:39:42 -05:00
Dzmitry Malyshau ac5e91b31a Fix and refactor the constant array sizes 2020-11-11 08:02:06 -05:00
Timo de Kort f8876dac73 [spv-out] Add AccessChain and AccessIndex instructions 2020-11-09 15:29:30 -05:00
Dzmitry Malyshau 41b3865e5b Make variable initializers to be const 2020-11-04 16:38:55 -05:00
Pelle Johnsen 6480370a19 [spv-out] Handle ImageSample (#261) 2020-11-03 21:18:30 +01:00
Kristoffer Søholm 8618a8a207 [ir] Make the interface visitor traverse local variable initializers
Otherwise the backends will panic on e.g. `vec4 local = Global;` if the global
isn't used anywere else in the function.
2020-11-02 19:34:01 -05:00
Kristoffer Søholm a89191c234 [glsl-out] Handle initializers for locals
This pretty trivial change unfortunately required a loop to mutably borrow both
builder and manager at the same time, so I had to separate them. Perhaps a
cleaner solution would be to use an object with internal state instead of free
functions.
2020-11-02 18:15:06 -05:00
Dzmitry Malyshau 0893d912be [msl] fix floating point modulo, return value from compute entry point 2020-10-30 23:08:20 -04:00
Dzmitry Malyshau f811b69aa8 [msl] avoid bad identifiers 2020-10-30 23:08:20 -04:00
João Capucho d45d11e4c5 msl-out: Use io::Write instead of fmt::Write (#250)
* msl-out: Use io::Write instead of fmt::Write

* msl-out: merge std use
2020-10-30 16:51:50 -04:00
Dzmitry Malyshau 587dc01a2c [msl] refactor the options, add override stages 2020-10-28 00:30:22 -04:00
Dzmitry Malyshau ce49afa391 Clean up the storage classes (#245) 2020-10-27 09:10:55 -04:00
Dzmitry Malyshau c1830901c7 Simplify bitshift IR (#244) 2020-10-27 09:05:14 -04:00
João Capucho a718992acb Added new external functions to the glsl backend to make it on par with the typifier (#240) 2020-10-19 09:40:30 -04:00
Pelle Johnsen 6fb195cdc8 [clippy] Fix clippy issues after upgrading to 1.47 (#237)
* [clippy] disable match_like_matches_macro for now

* [wgsl-in] Return error instead of panic

* [typifier] Convert panics to return error

Still one panic in clone impl for Resolution,
disabled clippy for that one

* [spv-in] REturn error instead of panic'ing

* [spv-out] Return error instead of panic'ing

* [typifier] Use IncompatibleOperand(s) error

Instead of just Other

* [typifier] Use Expression for op in Error

For IncompatibleOperands

* [typifier] revert last commit
2020-10-13 17:14:40 -04:00
João Capucho b76dff9d9c Added the new method to the msl Writer (#236) 2020-10-12 11:49:53 -04:00
Timo de Kort 4420258001 [ir] Remove Matrix Kind from the IR (#230) 2020-10-06 17:19:29 -04:00
Timo de Kort f67dfd251a [spv-out] Add multiply instructions (#219) 2020-10-06 16:57:30 -04:00
Timo de Kort 99f829b3cc [spv-out] Add check for global variables if name is set 2020-10-05 09:43:59 -04:00
Timo de Kort 90c56aca2f [spv-out] Add scalar conversion support 2020-10-03 19:50:09 -04:00
Timo de Kort 98167103c2 [spv-out] Remove instruction spec tests 2020-10-03 19:49:22 -04:00
Timo de Kort e0f593f35f [spv-out] Add matrix construct support 2020-10-01 15:41:42 -04:00
Timo de Kort b56c2ddbdc [spv-out] Fix write_function returning block id 2020-09-30 16:43:56 -04:00
Dzmitry Malyshau 6de675313b [spv] fix stack overflow in type writing 2020-09-28 23:29:23 -04:00
Dzmitry Malyshau 0651eb8fab Complete expression/statement support in MSL, refactor conversion methods in WGSL, and remove Statement::Empty 2020-09-19 16:16:17 -04:00
Timo de Kort 40f37c5c8c [spv-out] Combined all instruction spec tests to one test (#208) 2020-09-18 17:02:00 -04:00
João Capucho 0aae8ae6f8 glsl-out: More glsl versions (#191)
* Added support for glsl core version up to 400

* Added 330 to the list supported versions

* Added links to all extensions and fixed a extension being wrongfully activated

* Cleanup and check for image formats

* Removed useless extension and location on layout

* Added support for external functions and fixed global names

* Typefier allow Scalars in distance and length

* Addressed comments

* Fixed extension appearing after body

* Fixed entry point not being generated
2020-09-18 17:01:05 -04:00
Dzmitry Malyshau d25ab1b1e8 Refactor image sampling arguments, add textureLoad support to WGSL 2020-09-18 10:53:26 -04:00
Dzmitry Malyshau aa7005fdf3 [ir] Move scalar kind into the Sampled image class variant 2020-09-18 10:01:56 -04:00
Dzmitry Malyshau 7aff39784b [wgsl] texture operations 2020-09-18 10:01:56 -04:00
Dzmitry Malyshau 081b90f117 Consolidate rosetta tests 2020-09-17 10:16:32 -04:00
Dzmitry Malyshau 2ebaadaf0c Refactor entry point IR 2020-09-17 10:08:49 -04:00
Dzmitry Malyshau 74c4a3ce18 Add ArrayLength expression 2020-09-16 09:29:26 -04:00