Add arch functions for all non-Matrix arithmetic instructions#446
Add arch functions for all non-Matrix arithmetic instructions#446XAMPPRocky merged 1 commit intomainfrom
Conversation
38e58e3 to
69e753d
Compare
|
Do we have a need for the scalar functions here? They're already exposed via the traditional operators, feels a little weird to create intrinsics for things we already support in a very built-in way. (I imagined the arch module is for intrinsics that are specific to SPIR-V and cannot be exposed via traditional language constructs, in the same way that Also want to loop in @Jasper-Bekkers as a loong while back they were against vector ops, I think we've discussed it more recently and might have changed their mind, but I want to make sure. Also, how do you imagine the vector ops being integrated into glam? I don't want to merge this without a path forward of how to use these for the operator overloads. (Kind of skipped the design question of what we're going to use these for and how) |
There are some scalar functions here that don't map to an operator. Such as modulo, as
That's a good question, and I think it will require either tightening the coupling with glam so that's not an extern crate (essentially having it as a submodule in the repo that is linked in as a module in the source), this would allow us to implement operator traits for glam types in rust-gpu. The other option would be decoupling Either option would work I think, tradeoff's are more about who's maintaining the implementation of the link between glam <-> rust-gpu. |
Modulo is exposed as |
Huh, I had forgot about that one, good point. Though seeing it now, I do remember some bike shedding over that name. Regardless, I can't see to be able to use that? I tried it on playground and locally and I can't seem to be able to use http://shader-playground.timjones.io/ec14ba2de19f76c7460e88d7c04bf09a |
One of the trade-offs I had missed at the time was the significantly smaller SPIR-V binaries having vector ops would generate. I think this is a good inclusion. 👍 |
Looks like |
|
I've nudged the PR on |
I think so! If you have a reasonably clear plan of how to implement vector ops for glam op overloads with this, then yeah! |
cf28432 to
d8b48a9
Compare
e45a69d to
0c2c055
Compare
0c2c055 to
381c78e
Compare
|
This should be good to go, but needs #476 to land first. |
381c78e to
b60f98f
Compare
This PR adds every arithmetic instruction in SPIR-V, except anything related to Matrixes, as I wanted to make a separate PR for that.
There's two functions for every instruction (e.g.
i_add/i_add_vector), as I couldn't really find a way to make a function generic over a vector or a scalar, so I just split the implementation into two functions.Depends on #441 for the const generic in vectors.