Skip to content

Commit 8014e3d

Browse files
committed
doc: update most docs to latest version
1 parent 8036bfe commit 8014e3d

3 files changed

Lines changed: 21 additions & 18 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "phobos"
3-
version = "0.8.0"
3+
version = "0.9.0"
44
edition = "2021"
55
license = "Apache-2.0"
66
description = "Fast, powerful Vulkan abstraction library"

src/graph/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
//! // Define a pass that will handle the layout transition to `VK_IMAGE_LAYOUT_PRESENT_SRC_KHR`.
2121
//! // This is required in your main frame graph.
2222
//! let present_pass = PassBuilder::present("present", &swap_resource);
23-
//! // Create the graph. Note that we need to pass the swapchain resource to it as well.
24-
//! let mut graph = PassGraph::<domain::Graphics>::new(Some(&swap_resource));
23+
//! // Create the graph.
24+
//! let mut graph = PassGraph::<domain::Graphics>::new();
2525
//! // Add our pass
2626
//! graph.add_pass(present_pass)?;
2727
//! // Build the graph and obtain a BuiltPassGraph.
@@ -43,10 +43,10 @@
4343
//!
4444
//! // Bind swapchain virtual resource to this frame's swapchain image.
4545
//! let mut bindings = PhysicalResourceBindings::new();
46-
//! bindings.bind_image("swapchain", ifc.swapchain_image.as_ref().unwrap());
47-
//! let cmd = exec.on_domain::<domain::Graphics>(None, None)?;
46+
//! bindings.bind_image("swapchain", &ifc.swapchain_image);
47+
//! let cmd = exec.on_domain::<domain::Graphics>()?;
4848
//! // Debug messenger not required, but recommended together with the `debug-markers` feature.
49-
//! let final_cmd = graph.record(cmd, &bindings, &mut ifc, Some(debug_messenger))?
49+
//! let final_cmd = graph.record(cmd, &bindings, &mut pool, Some(debug_messenger))?
5050
//! .finish();
5151
//! ```
5252

src/sync/fence.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use anyhow::Result;
99
use ash::prelude::VkResult;
1010
use ash::vk;
1111

12-
use crate::pool::Poolable;
1312
use crate::Device;
13+
use crate::pool::Poolable;
1414

1515
struct 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

Comments
 (0)