Struct SwapchainPresentSemaphores

Source
struct SwapchainPresentSemaphores {
    present: Vec<Semaphore>,
    present_index: usize,
    frame_index: usize,
}
Available on vulkan only.

Fields§

§present: Vec<Semaphore>

A pool of semaphores for ordering presentation after drawing.

The first present_index semaphores in this vector are:

  • all waited on by the call to vkQueuePresentKHR that presents this image, and

  • each signaled by some vkQueueSubmit queue submission that draws to this image, when the submission finishes execution.

This vector accumulates one semaphore per submission that writes to this image. This is awkward, but hard to avoid: vkQueuePresentKHR requires a semaphore to order it with respect to drawing commands, and we can’t attach new completion semaphores to a command submission after it’s been submitted. This means that, at submission time, we must create the semaphore we might need if the caller’s next action is to enqueue a presentation of this image.

An alternative strategy would be for presentation to enqueue an empty submit, ordered relative to other submits in the usual way, and signaling a single presentation semaphore. But we suspect that submits are usually expensive enough, and semaphores usually cheap enough, that performance-sensitive users will avoid making many submits, so that the cost of accumulated semaphores will usually be less than the cost of an additional submit.

Only the first present_index semaphores in the vector are actually going to be signalled by submitted commands, and need to be waited for by the next present call. Any semaphores beyond that index were created for prior presents and are simply being retained for recycling.

§present_index: usize

The number of semaphores in present to be signalled for this submission.

§frame_index: usize

Which image this semaphore set is used for.

Implementations§

Source§

impl SwapchainPresentSemaphores

Source

pub fn new(frame_index: usize) -> Self

Source

fn get_submit_signal_semaphore( &mut self, device: &DeviceShared, ) -> Result<Semaphore, DeviceError>

Return the semaphore that the next submission that writes to this image should signal when it’s done.

See SwapchainPresentSemaphores::present for details.

Source

fn end_semaphore_usage(&mut self)

Indicates the cpu-side usage of this semaphore has finished for the frame, so reset internal state to be ready for the next frame.

Source

fn get_present_wait_semaphores(&mut self) -> Vec<Semaphore>

Return the semaphores that a presentation of this image should wait on.

Return a slice of semaphores that the call to vkQueueSubmit that ends this image’s acquisition should wait for. See SwapchainPresentSemaphores::present for details.

Reset self to be ready for the next acquisition cycle.

Source

unsafe fn destroy(&self, device: &Device)

Trait Implementations§

Source§

impl Debug for SwapchainPresentSemaphores

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,