struct SwapchainPresentSemaphores {
present: Vec<Semaphore>,
present_index: usize,
frame_index: usize,
}
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
impl SwapchainPresentSemaphores
pub fn new(frame_index: usize) -> Self
Sourcefn get_submit_signal_semaphore(
&mut self,
device: &DeviceShared,
) -> Result<Semaphore, DeviceError>
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.
Sourcefn end_semaphore_usage(&mut self)
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.
Sourcefn get_present_wait_semaphores(&mut self) -> Vec<Semaphore>
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.