update_buffer_offset and static ref #104
-
|
Hi, I'm having difficulties in finding a way to use Perhaps I'm trying to use Would it be possible to make Cheers. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
This function takes an owned instance of some data (maybe a However, this is a very special function in Vulkan because:
If you're certain your data is less than 64K, I would recommend just allocating and passing it. This is the easy method. For realistic use-cases, like the updating instance data or something:
The temporary buffer will usually be a better option because you reduce the number of Vulkan API calls and you likely have more than one instance to update, or range of instances. |
Beta Was this translation helpful? Give feedback.
This function takes an owned instance of some data (maybe a
Vec<u8>) and it will be dropped once complete, so there isn't a leak so much as failure to return it once complete, as you point out. It's certainly possible change this to do what you ask, maybe by also passing a callback which receives the data or function which returns it using a handle or ID. In practice this usually isn't a bottleneck and short-lived allocations are fine, but you also might pass a wrapper type which internally implementsAsRef<u8>using a borrow ofArc<..>or something.However, this is a very special function in Vulkan because: