@@ -9,8 +9,8 @@ use anyhow::Result;
99use ash:: prelude:: VkResult ;
1010use ash:: vk;
1111
12- use crate :: pool:: Poolable ;
1312use crate :: Device ;
13+ use crate :: pool:: Poolable ;
1414
1515struct CleanupFnLink < ' f > {
1616 pub f : Box < dyn FnOnce ( ) + ' f > ,
@@ -32,9 +32,9 @@ pub trait FenceValue<T> {
3232/// ```
3333/// use phobos::prelude::*;
3434///
35- /// let exec = ExecutionManager::new(device, &physical_device)?;
35+ /// let exec = ExecutionManager::new(device, &physical_device, pool )?;
3636/// // Obtain some command buffer
37- /// let cmd = exec.on_domain::<domain::All, _>(None, None )?.finish()?;
37+ /// let cmd = exec.on_domain::<domain::All>( )?.finish()?;
3838/// let fence = exec.submit(cmd)?;
3939/// // We can now await this fence, or attach a resulting value to it to make the future
4040/// // a little more useful
@@ -66,7 +66,7 @@ pub trait FenceValue<T> {
6666/// staging_view.mapped_slice()?.copy_from_slice(src);
6767/// // Create a command buffer to copy the buffers
6868/// let cmd =
69- /// exec.on_domain::<domain::Transfer>(None, None )?
69+ /// exec.on_domain::<domain::Transfer>()?
7070/// .copy_buffer(&staging_view, &view)?
7171/// .finish()?;
7272/// // Submit our command buffer and obtain a fence
@@ -89,16 +89,19 @@ pub trait FenceValue<T> {
8989/// async fn upload_buffer<T: Copy>(device: Device, mut allocator: DefaultAllocator, exec: ExecutionManager, src: &[T]) -> Result<Buffer> {
9090/// // ... snip
9191/// // Submit our command buffer and obtain a fence
92- /// let fence = exec.submit(cmd)?;
92+ /// let mut fence = exec.submit(cmd)?;
9393/// // Attach our resulting buffer and await the fence.
94+ /// // To do this we have to use fence.replace() to replace the value inside the pooled object.
9495/// fence
95- /// // Add a cleanup function which will take ownership of any data that needs to be freed
96- /// // after the fence completes.
97- /// // The future will call these functions when the fence is ready.
98- /// .with_cleanup(move || {
99- /// drop(staging);
100- /// })
101- /// .attach_value(Ok(buffer)).await
96+ /// .replace(|fence| {
97+ /// // Add a cleanup function which will take ownership of any data that needs to be freed
98+ /// // after the fence completes.
99+ /// // The future will call these functions when the fence is ready.
100+ /// fence.with_cleanup(move || {
101+ /// drop(staging);
102+ /// })
103+ /// }).await?;
104+ /// Ok(buffer)
102105/// }
103106/// ```
104107///
0 commit comments