rust-gpu
rust-gpu copied to clipboard
Add `ScalarOrVector<S>` trait
This PR adds the ScalarOrVector<S> trait which represents types that can be either a scalar or a vector!
Motivation:
I am currently adding support for subgroup operations, and for example OpGroupNonUniformIAdds result type must be scalar or vector of integer type, so it would be useful to have this trait.
I like the general idea but if rust-gpu doesn't use it internally I'm not really seeing why it should add these things, rather than putting them in a separate crate for people to use?
@oisyn Yea the thing is, my plan is to add support for subgroup operations after this PR has been merged, and there are some ops like OpGroupNonUniformIAdds for which this trait can be really useful.
Right! I would suggest adding this trait as part of that work.