Skip to content

Commit

Permalink
Document Queue::write_buffer's allocation on native APIs (#7114)
Browse files Browse the repository at this point in the history
Co-authored-by: Connor Fitzgerald <[email protected]>
  • Loading branch information
DJMcNab and cwfitzgerald authored Feb 12, 2025
1 parent 5af9e30 commit 9770409
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions wgpu/src/api/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ impl Queue {
/// If possible, consider using [`Queue::write_buffer_with`] instead. That
/// method avoids an intermediate copy and is often able to transfer data
/// more efficiently than this one.
///
/// Currently on native platforms, for both of these methods the staging
/// memory will be a new allocation. This will then be released after the
/// next submission finishes. To entirely avoid short-lived allocations, you might
/// be able to use [`StagingBelt`](crate::util::StagingBelt).
pub fn write_buffer(&self, buffer: &Buffer, offset: BufferAddress, data: &[u8]) {
self.inner.write_buffer(&buffer.inner, offset, data);
}
Expand Down Expand Up @@ -141,6 +146,10 @@ impl Queue {
/// ```
///
/// This method fails if `size` is greater than the size of `buffer` starting at `offset`.
///
/// Currently on native platforms, the staging memory will be a new allocation, which will
/// then be released after the next submission finishes. To entirely avoid short-lived
/// allocations, you might be able to use [`StagingBelt`](crate::util::StagingBelt).
#[must_use]
pub fn write_buffer_with<'a>(
&'a self,
Expand Down

0 comments on commit 9770409

Please sign in to comment.