Commit Graph

307 Commits

Author SHA1 Message Date
Dzmitry Malyshau
ef4e8cacf9 [spv] refactor binary operators, add module and addition 2020-12-06 17:43:15 +01:00
Dzmitry Malyshau
5b14e26659 [wgsl] add a test module with units for if/loop/switch statements 2020-12-05 11:29:36 -05:00
Dzmitry Malyshau
f7ca7f2aff Refactor Switch statement, implement on WGSL 2020-12-05 00:22:39 -05:00
Dzmitry Malyshau
5fe9429a63 Terminator processor, used in WGSL and GLSL frontends 2020-12-04 17:23:13 -05:00
Dzmitry Malyshau
f18443a79d Validate builtin types 2020-12-04 16:13:14 -05:00
Dzmitry Malyshau
92de5851d0 [wgsl] update builtin names, have implicit function return type 2020-12-04 16:09:57 -05:00
Dzmitry Malyshau
0d81b1f78c [msl] add TranslationInfo struct 2020-12-04 10:40:13 -05:00
Dzmitry Malyshau
d190c6441f Add spv::write_vec helper. 2020-12-04 10:40:13 -05:00
Capucho
181d8721cc [glsl-out] Refractoring
Used thiserror for the error enum
Moved the contents of the error module to the main module
Made the error an actual enum and not just a string
Splitted the write function on the feature manager into a function for
checking for feature availability
2020-11-26 17:04:26 -05:00
Capucho
3fbc801b80 [glsl-out] Wrote more documentation 2020-11-26 17:04:26 -05:00
Capucho
9d5b66934b [glsl-out] Refractoring
Splitted the backend into two more modules (features, errors)
Added a shorthand type for the backend Result
Reorganized function ordering
Moved from using a struct to write image dimension to a function
Started documenting the backend
2020-11-26 17:04:26 -05:00
Dzmitry Malyshau
96c8073865 [spv-out] always return expression type 2020-11-23 22:27:17 -05:00
Capucho
bc0d876422 [glsl-out] Backend cleanup
Moved the global writing part to it's own function
Merged the texture and the global loop
Applied some suggestions from kvark
Added a topological sorting of the call graph before writing
Removed the struct block loop and now every struct is written
Organized the main backend file a bit
2020-11-22 14:45:12 -05:00
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
Pelle Johnsen
0f98357223 [glsl-in] Skip gl_PerVertex 2020-11-20 09:54:01 +01: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
Dzmitry Malyshau
c19bcbe89c Allow manual strip for clippy, temporarily 2020-11-19 23:19:10 -05:00
Dzmitry Malyshau
4ed91330cf Derive PartialEq for validation errors 2020-11-19 23:19:10 -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
Pelle Johnsen
437b33d536
[glsl-in] use TypeInner::scalar_kind for casts (#279)
* [glsl-in] use TypeInner::scalar_kind for casts

* [glsl-in] Use .ok_or for casts
2020-11-16 11:57:34 -05:00
Pelle Johnsen
9041cd4b10 [glsl-in] Handle simple casts 2020-11-16 12:58:19 +01: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
4d4e1cd4cb [spv] support GLSL's Distance 2020-11-12 12:38:35 -05: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
Pelle Johnsen
249e0bd4ac [glsl-in] Make sure functions ends with return 2020-11-11 08:01:43 -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
Dzmitry Malyshau
b61b100fa3 [ir] LocalVariableError 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
bb5c9567b5 [glsl-in] Add xor, small refactor 2020-11-02 19:34:01 -05:00
Kristoffer Søholm
973cfbc5d3 [glsl-in] Add support for interface blocks 2020-11-02 19:34:01 -05: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
Pelle Johnsen
0101ea7319 [glsl-in] Handle assign ops: +=, *=, etc 2020-11-02 10:06:01 -05:00
Pelle Johnsen
602367c062 [glsl-in] Add initial texture handling 2020-11-01 14:52:11 -05:00
Matúš Talčík
173bb0de42 spv-in: more loop fixes 2020-10-31 10:02:47 -04:00