vulkano-rs / vulkano

Safe and rich Rust wrapper around the Vulkan API
Apache License 2.0
4.48k stars 433 forks source link

[Question] How do I send dynamically sized array? #2461

Closed tmvkrpxl0 closed 7 months ago

tmvkrpxl0 commented 7 months ago

Issue

Noob question, I have Subbuffer<[T]> that I created with Buffer::new_unsized. This is for sharing dynamically sized array. How do I send it to GPU? Both BufferWriteGuard and RecordingCommandBuffer::update_buffer takes in owned data. and I don't think it's possible to turn Vec<T> to [T]

tmvkrpxl0 commented 7 months ago

oh SafeDeref can also be reference as well, my bad

marc0246 commented 7 months ago

We have examples that show reading/writing of subbuffers containing unsized data. It's no different from reading/writing sized data. Not sure what you mean by BufferWriteGuard taking in owned data. update_buffer needs to be passed in an owned smart pointer because of temporary limitations.