Skip to content

Commit

Permalink
Fix spacing in doc examples
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAPenguin0 committed Apr 2, 2023
1 parent 1dcf3ee commit b068c6c
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 26 deletions.
3 changes: 1 addition & 2 deletions src/allocator/default_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl Allocator for DefaultAllocator {

impl traits::Allocation for Allocation {
/// Get unsafe access to the underlying [`VkDeviceMemory`](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkDeviceMemory.html).
/// Should always be used together with [`Allocation::offset()`].
/// Should always be used together with [`Allocation::offset()`](crate::traits::Allocation::offset()).
/// # Example
/// This is useful when binding memory to a buffer or image. For [`Buffer`](crate::Buffer) and [`Image`](crate::Image) this is already
/// done internally.
Expand Down Expand Up @@ -208,7 +208,6 @@ impl traits::Allocation for Allocation {
/// # Example
/// ```
/// use phobos::*;
///
/// // Writes the integer '5' into the first std::mem::size_of::<i32>() bytes of the allocation.
/// // Assumes this allocation is mappable and at least std::mem::size_of::<i32>() bytes large.
/// unsafe fn write_five<A: Allocation>(allocation: &A) {
Expand Down
2 changes: 0 additions & 2 deletions src/allocator/memory_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
/// where your allocation should live.
///
/// See also: [`Allocator::allocate()`](crate::Allocator::allocate()), [`DefaultAllocator::allocate()`](crate::DefaultAllocator::allocate())
/// # Example
///
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum MemoryType {
/// Store the allocation in GPU only accessible memory - typically this is the faster GPU resource and this should be
Expand Down
4 changes: 0 additions & 4 deletions src/allocator/scratch_allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
//! ```
//! # use phobos::prelude::*;
//! # use anyhow::Result;
//!
//! // Function that uses the buffer in some way and returns a fence
//! // that is signaled when the work is done.
//! fn use_the_buffer(buffer: BufferView) -> Fence<()> {
Expand Down Expand Up @@ -46,7 +45,6 @@ use crate::Error::AllocationError;
/// ```
/// # use phobos::prelude::*;
/// # use anyhow::Result;
///
/// // Function that uses the buffer in some way and returns a fence
/// // that is signaled when the work is done.
/// fn use_the_buffer(buffer: BufferView) -> Fence<()> {
Expand Down Expand Up @@ -82,7 +80,6 @@ impl<A: Allocator> ScratchAllocator<A> {
/// ```
/// # use phobos::*;
/// # use anyhow::Result;
///
/// fn make_scratch_allocator<A: Allocator>(device: Device, alloc: &mut A) -> Result<ScratchAllocator<A>> {
/// ScratchAllocator::new(device, alloc, 1024 as usize, vk::BufferUsageFlags::UNIFORM_BUFFER)
/// }
Expand Down Expand Up @@ -150,7 +147,6 @@ impl<A: Allocator> ScratchAllocator<A> {
/// ```
/// # use phobos::prelude::*;
/// # use anyhow::Result;
///
/// // Function that uses the buffer in some way and returns a fence
/// // that is signaled when the work is done.
/// fn use_the_buffer(buffer: BufferView) -> Fence<()> {
Expand Down
3 changes: 1 addition & 2 deletions src/allocator/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ pub trait Allocation: Default {
/// * If this memory comes from a [`HOST_VISIBLE`](ash::vk::MemoryPropertyFlags::HOST_VISIBLE) heap, this returns `Some(ptr)`, with `ptr` a non-null pointer pointing to the allocation memory.
/// # Example
/// ```
/// use phobos::*;
///
/// # use phobos::*;
/// // Writes the integer '5' into the first std::mem::size_of::<i32>() bytes of the allocation.
/// // Assumes this allocation is mappable and at least std::mem::size_of::<i32>() bytes large.
/// unsafe fn write_five<A: Allocation>(allocation: &A) {
Expand Down
2 changes: 0 additions & 2 deletions src/command_buffer/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ impl<D: ComputeSupport + ExecutionDomain> ComputeCmdBuffer for IncompleteCommand
/// # use phobos::*;
/// # use phobos::domain::ExecutionDomain;
/// # use anyhow::Result;
///
/// // Assumes "my_pipeline" was previously added to the pipeline cache with `PipelineCache::create_named_compute_pipeline()`,
/// // and that cmd was created with this cache.
/// fn compute_pipeline<D: ExecutionDomain + ComputeSupport>(cmd: IncompleteCommandBuffer<D>) -> Result<IncompleteCommandBuffer<D>> {
Expand Down Expand Up @@ -51,7 +50,6 @@ impl<D: ComputeSupport + ExecutionDomain> ComputeCmdBuffer for IncompleteCommand
/// # use phobos::*;
/// # use phobos::domain::ExecutionDomain;
/// # use anyhow::Result;
///
/// // Assumes "my_pipeline" was previously added to the pipeline cache with `PipelineCache::create_named_compute_pipeline()`,
/// // and that cmd was created with this cache.
/// fn compute_pipeline<D: ExecutionDomain + ComputeSupport>(cmd: IncompleteCommandBuffer<D>) -> Result<IncompleteCommandBuffer<D>> {
Expand Down
9 changes: 0 additions & 9 deletions src/command_buffer/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ impl<D: GfxSupport + ExecutionDomain> GraphicsCmdBuffer for IncompleteCommandBuf
/// # use anyhow::Result;
/// # use phobos::*;
/// # use phobos::domain::*;
///
/// fn set_viewport<C: GraphicsCmdBuffer>(cmd: C) -> C {
/// // Now the current viewport and scissor cover the current attachment's entire area
/// cmd.full_viewport_scissor()
Expand All @@ -38,7 +37,6 @@ impl<D: GfxSupport + ExecutionDomain> GraphicsCmdBuffer for IncompleteCommandBuf
/// # use anyhow::Result;
/// # use phobos::*;
/// # use phobos::domain::*;
///
/// fn set_viewport<C: GraphicsCmdBuffer>(cmd: C) -> C {
/// cmd.viewport(vk::Viewport {
/// x: 0.0,
Expand All @@ -63,7 +61,6 @@ impl<D: GfxSupport + ExecutionDomain> GraphicsCmdBuffer for IncompleteCommandBuf
/// # use anyhow::Result;
/// # use phobos::*;
/// # use phobos::domain::*;
///
/// fn set_scissor<C: GraphicsCmdBuffer>(cmd: C) -> C {
/// cmd.scissor(vk::Rect2D {
/// offset: Default::default(),
Expand All @@ -90,7 +87,6 @@ impl<D: GfxSupport + ExecutionDomain> GraphicsCmdBuffer for IncompleteCommandBuf
/// # use anyhow::Result;
/// # use phobos::*;
/// # use phobos::domain::*;
///
/// fn draw<C: GraphicsCmdBuffer>(cmd: C, vertex_buffer: &BufferView) -> Result<C> {
/// cmd.full_viewport_scissor()
/// .bind_graphics_pipeline("my_pipeline")?
Expand All @@ -116,7 +112,6 @@ impl<D: GfxSupport + ExecutionDomain> GraphicsCmdBuffer for IncompleteCommandBuf
/// # use anyhow::Result;
/// # use phobos::*;
/// # use phobos::domain::*;
///
/// fn draw_indexed<C: GraphicsCmdBuffer>(cmd: C, vertex_buffer: &BufferView, index_buffer: &BufferView) -> Result<C> {
/// cmd.full_viewport_scissor()
/// .bind_graphics_pipeline("my_pipeline")?
Expand Down Expand Up @@ -149,7 +144,6 @@ impl<D: GfxSupport + ExecutionDomain> GraphicsCmdBuffer for IncompleteCommandBuf
/// # use phobos::*;
/// # use phobos::domain::ExecutionDomain;
/// # use anyhow::Result;
///
/// // Assumes "my_pipeline" was previously added to the pipeline cache with `PipelineCache::create_named_pipeline()`,
/// // and that cmd was created with this cache.
/// fn compute_pipeline<C: GraphicsCmdBuffer>(cmd: C) -> Result<C> {
Expand All @@ -174,7 +168,6 @@ impl<D: GfxSupport + ExecutionDomain> GraphicsCmdBuffer for IncompleteCommandBuf
/// # use anyhow::Result;
/// # use phobos::*;
/// # use phobos::domain::*;
///
/// fn draw<C: GraphicsCmdBuffer>(cmd: C, vertex_buffer: &BufferView) -> Result<C> {
/// cmd.bind_vertex_buffer(0, vertex_buffer)
/// .draw(6, 1, 0, 0)
Expand Down Expand Up @@ -203,7 +196,6 @@ impl<D: GfxSupport + ExecutionDomain> GraphicsCmdBuffer for IncompleteCommandBuf
/// # use anyhow::Result;
/// # use phobos::*;
/// # use phobos::domain::*;
///
/// fn draw_indexed<C: GraphicsCmdBuffer>(cmd: C, vertex_buffer: &BufferView, index_buffer: &BufferView) -> Result<C> {
/// cmd.bind_vertex_buffer(0, vertex_buffer)
/// .bind_index_buffer(index_buffer, vk::IndexType::UINT32)
Expand Down Expand Up @@ -263,7 +255,6 @@ impl<D: GfxSupport + ExecutionDomain> GraphicsCmdBuffer for IncompleteCommandBuf
/// # use anyhow::Result;
/// # use phobos::*;
/// # use phobos::domain::*;
///
/// fn set_polygon_mode<C: GraphicsCmdBuffer>(cmd: C) -> Result<C> {
/// // Subsequent drawcalls will get a wireframe view.
/// cmd.set_polygon_mode(vk::PolygonMode::LINE)
Expand Down
1 change: 0 additions & 1 deletion src/command_buffer/incomplete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ impl<'q, D: ExecutionDomain> IncompleteCmdBuffer<'q> for IncompleteCommandBuffer
/// # use phobos::*;
/// # use anyhow::Result;
/// # use phobos::domain::{ExecutionDomain, Graphics};
///
/// fn finish_command_buffer<D: ExecutionDomain>(cmd: IncompleteCommandBuffer<D>) -> Result<CommandBuffer<D>> {
/// // Releases the lock on a queue associated with the domain `D`, allowing other command
/// // buffers to start recording on this domain.
Expand Down
3 changes: 1 addition & 2 deletions src/command_buffer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub struct CommandBuffer<D: ExecutionDomain> {
}

/// This struct represents an incomplete command buffer.
/// This is a command buffer that has not been called [`IncompleteCommandBuffer::finish()`] on yet.
/// This is a command buffer that has not been called [`IncompleteCommandBuffer::finish()`](crate::IncompleteCommandBuffer::finish) on yet.
/// Calling this method will turn it into an immutable command buffer which can then be submitted
/// to the queue it was allocated from. See also [`ExecutionManager`].
///
Expand All @@ -76,7 +76,6 @@ pub struct CommandBuffer<D: ExecutionDomain> {
/// # use phobos::*;
/// # use phobos::domain::{ExecutionDomain, Graphics};
/// # use anyhow::Result;
///
/// fn submit_some_commands(exec: ExecutionManager) -> Result<()> {
/// let cmd: IncompleteCommandBuffer<Graphics> = exec.on_domain::<Graphics>(None, None)?;
/// // ... record some commands
Expand Down
2 changes: 0 additions & 2 deletions src/command_buffer/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ impl<D: TransferSupport + ExecutionDomain> TransferCmdBuffer for IncompleteComma
/// # use anyhow::Result;
/// # use phobos::*;
/// # use phobos::domain::*;
///
/// fn copy_buffer<C: TransferCmdBuffer>(cmd: C, src: &BufferView, dst: &BufferView) -> Result<C> {
/// cmd.copy_buffer(src, dst)
/// }
Expand Down Expand Up @@ -44,7 +43,6 @@ impl<D: TransferSupport + ExecutionDomain> TransferCmdBuffer for IncompleteComma
/// # use anyhow::Result;
/// # use phobos::*;
/// # use phobos::domain::*;
///
/// fn copy_buffer_to_image<C: TransferCmdBuffer>(cmd: C, src: &BufferView, dst: &ImageView) -> Result<C> {
/// cmd.copy_buffer_to_image(src, dst)
/// }
Expand Down

0 comments on commit b068c6c

Please sign in to comment.