Skip to main content

Presenter

Struct Presenter 

Source
pub struct Presenter<'window> { /* private fields */ }
Expand description

Engine-borrowing presentation session.

Construction creates and owns the SDL3 Vulkan surface, then records whether the Engine’s retained graphics queue can present to that exact surface. Swapchain acquire/present is intentionally the next lifecycle phase rather than a fabricated method on this real surface session.

Implementations§

Source§

impl<'window> Presenter<'window>

Source

pub fn new(engine: &Engine, window: &'window SdlWindow) -> Result<Self>

Create a presentation session for one SDL3 window.

The Engine must have been built using EngineRequirements::presentation() and window.required_instance_extensions().

Source

pub fn has_transparent_composition(&self) -> bool

Whether the active swapchain negotiated premultiplied client-frame alpha.

Source

pub fn has_graphics(&self) -> bool

Return whether the Engine retained a graphics-capable queue.

A surface can exist without this capability; swapchain allocation will require a graphics queue that can also present to this exact surface.

Source

pub fn supports_swapchain(&self) -> bool

Return whether the selected device enabled VK_KHR_swapchain.

Source

pub fn has_present(&self) -> bool

Return whether any queue family can present to this surface.

True when the graphics queue can present directly (same-family path) or when a distinct present-capable family was found during surface creation.

Source

pub fn capabilities(&self) -> Result<PresentationCapabilities>

Query the exact surface capabilities before swapchain allocation.

Source

pub fn swapchain_extent(&self, window: &SdlWindow) -> Result<Option<[u32; 2]>>

Select the currently valid drawable extent for a future swapchain.

Source

pub fn can_create_swapchain(&self, window: &SdlWindow) -> Result<bool>

Validate whether a swapchain can be allocated at the current drawable size.

false is the normal minimized-window state; unsupported WSI capability remains an error rather than being hidden behind a fallback.

Source

pub fn init_swapchain(&mut self, window: &SdlWindow) -> Result<bool>

Allocate the negotiated swapchain for the current drawable extent.

Source

pub fn wait_presentation_idle(&mut self) -> Result<()>

Wait for submitted WSI work before retiring or replacing swapchain resources.

Source

pub fn close_swapchain(&mut self) -> Result<()>

Explicitly retire the current swapchain after its submitted WSI work completes.

Source

pub fn recreate_swapchain(&mut self, window: &SdlWindow) -> Result<bool>

Retire the old swapchain and allocate one for the current drawable extent.

Source

pub fn notify_pixel_size_changed(&mut self, width: u32, height: u32)

Record SDL’s pixel-size change for explicit swapchain retirement/recreation.

The caller must recreate only after all presentation work using the old images has completed; this notification itself never submits or waits.

Source

pub fn needs_swapchain_recreate(&self) -> bool

Source

pub fn has_swapchain(&self) -> bool

Source

pub fn swapchain_image_count(&self) -> usize

Return the number of owned swapchain image views.

Source

pub fn frames_in_flight(&self) -> usize

Number of independent WSI frame slots owned by this Presenter.

Source

pub fn present_empty_frame(&mut self) -> Result<bool>

Acquire, transition, submit, and present one empty WSI frame. Returns true when the surface became suboptimal and should be recreated.

Source

pub fn present_clear_frame(&mut self, color: Color) -> Result<bool>

Acquire, clear with a linear RGBA color, submit, and present one WSI frame.

Source

pub fn present_texture(&mut self, texture: &Texture) -> Result<bool>

Scale and present one native image-backed Texture.

Source

pub fn present_compose( &mut self, compose_image: Image, compose_width: u32, compose_height: u32, record: impl FnOnce(&Device, CommandBuffer) -> Result<()>, ) -> Result<bool>

Compose the UI layer and present it directly to the swapchain.

record draws the UI raster pass into compose_image as a color attachment. The swapchain blit and present run in the same submission — no host readback, no extra queue round-trip.

Source

pub fn swapchain_extent_px(&self) -> Option<[u32; 2]>

Return the current swapchain image extent, or None when none is allocated.

Trait Implementations§

Source§

impl Drop for Presenter<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<'window> !RefUnwindSafe for Presenter<'window>

§

impl<'window> !Send for Presenter<'window>

§

impl<'window> !Sync for Presenter<'window>

§

impl<'window> !UnwindSafe for Presenter<'window>

§

impl<'window> Forget for Presenter<'window>

§

impl<'window> Freeze for Presenter<'window>

§

impl<'window> Move for Presenter<'window>

§

impl<'window> Unpin for Presenter<'window>

§

impl<'window> UnsafeUnpin for Presenter<'window>

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
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.