Closed MaikKlein closed 6 years ago
Might be easier than expected if we can use the mir::transoform::Inline
to always inline functions that return a reference.
Almost fully implemented. Currently requires #[inline(always)]
on top of functions that return a reference. Those functions are then inlined manually and removed.
SPIR-V only allowes to return values by copy.
#[inline(always)]
in Rust doesn't seem to force inlining.This is a needed feature because a lot of things in Rust like ops::Index and ops::Deref return a reference.
A temporary workaround would be to implement an intrinsic for accessing elements in a storage buffer.
A possible implementation could be to transform functions from
to
Possibly those functions would need to be annotated with something like
Another possibility would be to force inlining, by inserting those functions directly into the mir where they are used.