MaikKlein / rlsl

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

Add support for arrays and indexing #46

Closed MaikKlein closed 6 years ago

MaikKlein commented 6 years ago

To which type should OpTypeRuntimeArray map?

We could potentially map it to &[T], which would then be the only type allowed in structs that is a ptr type. This should be the most ergonomic change, but it might be a bit tricky to implement.

Also how does this interact with OpTypeArray, I don't think we can deref an array into a runtime array.

MaikKlein commented 6 years ago

Worst case scenario is that we might have to abstract over arrays with traits

fn foo(arr: impl Array<Item = f32>) {...} 

Where the trait Array is implemented for dynamic arrays (slices) and static arrays of various sizes.