Skip to content

Commit 9770409

Browse files
Document Queue::write_buffer's allocation on native APIs (#7114)
Co-authored-by: Connor Fitzgerald <[email protected]>
1 parent 5af9e30 commit 9770409

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

wgpu/src/api/queue.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ impl Queue {
109109
/// If possible, consider using [`Queue::write_buffer_with`] instead. That
110110
/// method avoids an intermediate copy and is often able to transfer data
111111
/// more efficiently than this one.
112+
///
113+
/// Currently on native platforms, for both of these methods the staging
114+
/// memory will be a new allocation. This will then be released after the
115+
/// next submission finishes. To entirely avoid short-lived allocations, you might
116+
/// be able to use [`StagingBelt`](crate::util::StagingBelt).
112117
pub fn write_buffer(&self, buffer: &Buffer, offset: BufferAddress, data: &[u8]) {
113118
self.inner.write_buffer(&buffer.inner, offset, data);
114119
}
@@ -141,6 +146,10 @@ impl Queue {
141146
/// ```
142147
///
143148
/// This method fails if `size` is greater than the size of `buffer` starting at `offset`.
149+
///
150+
/// Currently on native platforms, the staging memory will be a new allocation, which will
151+
/// then be released after the next submission finishes. To entirely avoid short-lived
152+
/// allocations, you might be able to use [`StagingBelt`](crate::util::StagingBelt).
144153
#[must_use]
145154
pub fn write_buffer_with<'a>(
146155
&'a self,

0 commit comments

Comments
 (0)