Skip to content

Commit

Permalink
doc: update most docs to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAPenguin0 committed Jun 10, 2023
1 parent 8036bfe commit 8014e3d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "phobos"
version = "0.8.0"
version = "0.9.0"
edition = "2021"
license = "Apache-2.0"
description = "Fast, powerful Vulkan abstraction library"
Expand Down
10 changes: 5 additions & 5 deletions src/graph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
//! // Define a pass that will handle the layout transition to `VK_IMAGE_LAYOUT_PRESENT_SRC_KHR`.
//! // This is required in your main frame graph.
//! let present_pass = PassBuilder::present("present", &swap_resource);
//! // Create the graph. Note that we need to pass the swapchain resource to it as well.
//! let mut graph = PassGraph::<domain::Graphics>::new(Some(&swap_resource));
//! // Create the graph.
//! let mut graph = PassGraph::<domain::Graphics>::new();
//! // Add our pass
//! graph.add_pass(present_pass)?;
//! // Build the graph and obtain a BuiltPassGraph.
Expand All @@ -43,10 +43,10 @@
//!
//! // Bind swapchain virtual resource to this frame's swapchain image.
//! let mut bindings = PhysicalResourceBindings::new();
//! bindings.bind_image("swapchain", ifc.swapchain_image.as_ref().unwrap());
//! let cmd = exec.on_domain::<domain::Graphics>(None, None)?;
//! bindings.bind_image("swapchain", &ifc.swapchain_image);
//! let cmd = exec.on_domain::<domain::Graphics>()?;
//! // Debug messenger not required, but recommended together with the `debug-markers` feature.
//! let final_cmd = graph.record(cmd, &bindings, &mut ifc, Some(debug_messenger))?
//! let final_cmd = graph.record(cmd, &bindings, &mut pool, Some(debug_messenger))?
//! .finish();
//! ```
Expand Down
27 changes: 15 additions & 12 deletions src/sync/fence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use anyhow::Result;
use ash::prelude::VkResult;
use ash::vk;

use crate::pool::Poolable;
use crate::Device;
use crate::pool::Poolable;

struct CleanupFnLink<'f> {
pub f: Box<dyn FnOnce() + 'f>,
Expand All @@ -32,9 +32,9 @@ pub trait FenceValue<T> {
/// ```
/// use phobos::prelude::*;
///
/// let exec = ExecutionManager::new(device, &physical_device)?;
/// let exec = ExecutionManager::new(device, &physical_device, pool)?;
/// // Obtain some command buffer
/// let cmd = exec.on_domain::<domain::All, _>(None, None)?.finish()?;
/// let cmd = exec.on_domain::<domain::All>()?.finish()?;
/// let fence = exec.submit(cmd)?;
/// // We can now await this fence, or attach a resulting value to it to make the future
/// // a little more useful
Expand Down Expand Up @@ -66,7 +66,7 @@ pub trait FenceValue<T> {
/// staging_view.mapped_slice()?.copy_from_slice(src);
/// // Create a command buffer to copy the buffers
/// let cmd =
/// exec.on_domain::<domain::Transfer>(None, None)?
/// exec.on_domain::<domain::Transfer>()?
/// .copy_buffer(&staging_view, &view)?
/// .finish()?;
/// // Submit our command buffer and obtain a fence
Expand All @@ -89,16 +89,19 @@ pub trait FenceValue<T> {
/// async fn upload_buffer<T: Copy>(device: Device, mut allocator: DefaultAllocator, exec: ExecutionManager, src: &[T]) -> Result<Buffer> {
/// // ... snip
/// // Submit our command buffer and obtain a fence
/// let fence = exec.submit(cmd)?;
/// let mut fence = exec.submit(cmd)?;
/// // Attach our resulting buffer and await the fence.
/// // To do this we have to use fence.replace() to replace the value inside the pooled object.
/// fence
/// // Add a cleanup function which will take ownership of any data that needs to be freed
/// // after the fence completes.
/// // The future will call these functions when the fence is ready.
/// .with_cleanup(move || {
/// drop(staging);
/// })
/// .attach_value(Ok(buffer)).await
/// .replace(|fence| {
/// // Add a cleanup function which will take ownership of any data that needs to be freed
/// // after the fence completes.
/// // The future will call these functions when the fence is ready.
/// fence.with_cleanup(move || {
/// drop(staging);
/// })
/// }).await?;
/// Ok(buffer)
/// }
/// ```
///
Expand Down

0 comments on commit 8014e3d

Please sign in to comment.