MaikKlein / rlsl

Rust to SPIR-V compiler
Apache License 2.0
557 stars 14 forks source link

Implementing `mint` Traits to add interoperability #36

Open Kerollmops opened 6 years ago

Kerollmops commented 6 years ago

It could probably be a great idea to implement mint Traits on most of the rlsl types defined in the rlsl-math crate. Many other crates implement it.

MaikKlein commented 6 years ago

rlsl-math is only really for experimentation atm. In the future I intent to port something like cgmath or nalgebra to rlsl.

memoryruins commented 6 years ago

Noticed rlsl's libstd is #![no_std]. nalgebra now supports compiling without the standard library http://nalgebra.org/wasm_and_embedded_programming/ (if that was any concern)

MaikKlein commented 6 years ago

@memoryruins I still support the std, it is just my own version of core and std with a lot of stuff ripped out.

I am not going to lie, porting nalgebra is to rlsl is probably very hard. I still want to try to port a subset of it in the future. I looked a bit through the source code and it looks very reasonable for a 1:1 port in a lot of cases.

I still need to figure out a good way to map types to built in SPIR-V types in a non invasive manner.

At the moment I will focus on my own math library rlsl-math, because it is much easier to develop a math library incrementally with the compiler. But it is not necessary for rlsl.

Anyone can then port their own math library to rlsl by just looking at the reference implementation rlsl-math.

memoryruins commented 6 years ago

Seems like the most sensible choice. First make it work well with SPIR-V types, then trait implementations (nalgebra has a “mint” trait feature flag) and crate support can come later and especially from others :)