Skip to content

Commit

Permalink
vulkano-rs#2030 doc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rua committed Oct 9, 2022
1 parent 2ccf985 commit 0360acc
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
29 changes: 16 additions & 13 deletions vulkano/src/buffer/device_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,12 @@ where
{
/// Builds a `DeviceLocalBuffer` that copies its data from another buffer.
///
/// This function returns two objects: the newly-created buffer, and a future representing
/// the initial upload operation. In order to be allowed to use the `DeviceLocalBuffer`, you
/// must either submit your operation after this future, or execute this future and wait for it
/// to be finished before submitting your own operation.
/// This is a convenience function, equivalent to calling [`new`](DeviceLocalBuffer::new) with
/// the queue family index of `command_buffer_builder`, then recording a `copy_buffer` command
/// to `command_buffer_builder`.
///
/// `command_buffer_builder` can then be used to record other commands, built, and executed as
/// normal. If it is not executed, the buffer contents will be left undefined.
///
/// # Panics
///
Expand Down Expand Up @@ -226,16 +228,11 @@ impl<T> DeviceLocalBuffer<T>
where
T: BufferContents,
{
/// Builds an `DeviceLocalBuffer` from some data.
///
/// This function builds a memory-mapped intermediate buffer, writes the data to it, builds a
/// command buffer that copies from this intermediate buffer to the final buffer, and finally
/// submits the command buffer as a future.
/// Builds a `DeviceLocalBuffer` from some data.
///
/// This function returns two objects: the newly-created buffer, and a future representing
/// the initial upload operation. In order to be allowed to use the `DeviceLocalBuffer`, you
/// must either submit your operation after this future, or execute this future and wait for it
/// to be finished before submitting your own operation.
/// This is a convenience function, equivalent to creating a `CpuAccessibleBuffer`, writing
/// `data` to it, then calling [`from_buffer`](DeviceLocalBuffer::from_buffer) to copy the data
/// over.
///
/// # Panics
///
Expand Down Expand Up @@ -267,6 +264,12 @@ impl<T> DeviceLocalBuffer<[T]>
where
[T]: BufferContents,
{
/// Builds a `DeviceLocalBuffer` from an iterator of data.
///
/// This is a convenience function, equivalent to creating a `CpuAccessibleBuffer`, writing
/// `iter` to it, then calling [`from_buffer`](DeviceLocalBuffer::from_buffer) to copy the data
/// over.
///
/// # Panics
///
/// - Panics if `T` has zero size.
Expand Down
12 changes: 12 additions & 0 deletions vulkano/src/image/immutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ impl ImmutableImage {
}

/// Construct an ImmutableImage from the contents of `iter`.
///
/// This is a convenience function, equivalent to creating a `CpuAccessibleBuffer`, writing
/// `iter` to it, then calling [`from_buffer`](ImmutableImage::from_buffer) to copy the data
/// over.
pub fn from_iter<Px, I, L, A>(
iter: I,
dimensions: ImageDimensions,
Expand Down Expand Up @@ -208,6 +212,14 @@ impl ImmutableImage {
}

/// Construct an ImmutableImage containing a copy of the data in `source`.
///
/// This is a convenience function, equivalent to calling
/// [`uninitialized`](ImmutableImage::uninitialized) with the queue family index of
/// `command_buffer_builder`, then recording a `copy_buffer_to_image` command to
/// `command_buffer_builder`.
///
/// `command_buffer_builder` can then be used to record other commands, built, and executed as
/// normal. If it is not executed, the image contents will be left undefined.
pub fn from_buffer<L, A>(
source: Arc<dyn BufferAccess>,
dimensions: ImageDimensions,
Expand Down

0 comments on commit 0360acc

Please sign in to comment.