Skip to main content

AcquiredFrameHandle

Struct AcquiredFrameHandle 

Source
pub struct AcquiredFrameHandle { /* private fields */ }
Expand description

Owns one native handle.

A rendered frame that the caller holds to read or show.

See mln_acquired_frame in the C API reference.

Implementations§

Source§

impl AcquiredFrameHandle

Source

pub fn id(&self) -> u64

Returns the native handle value.

Source§

impl AcquiredFrameHandle

Source

pub fn discard(self) -> Result<(), ReleaseError<Self>>

Gives up an acquired frame without saying when your GPU stops reading it.

Because your GPU may still read the frame’s texture, the session never renders into that texture again.

See mln_acquired_frame_discard in the C API reference.

Source

pub fn get_result(&self) -> Result<RenderFrameResult>

Reads the frame result of an acquired frame.

It succeeds until you release or discard the frame, whatever the session’s state.

See mln_acquired_frame_get_result in the C API reference.

Source

pub unsafe fn release( self, consumer_completion: &GpuSync, ) -> Result<(), ReleaseError<Self>>

Gives an acquired frame back to the session once you’re done reading it.

consumer_completion says when your GPU work that reads the texture finishes. Pass GpuSyncKind::CpuComplete when that work has already finished. The session waits for that point before it renders into the texture again. If that wait fails, such as for an OpenGL fence outside the session’s share group, the session fails.

See mln_acquired_frame_release in the C API reference.

§Errors
  • Status::Unsupported when RenderSessionCapabilities::consumer_sync_kinds lacks the kind of consumer_completion.
§Safety

Native graphics objects must have the types, lifetimes, and synchronization required by the C operation.

Source§

impl AcquiredFrameHandle

Source

pub fn view(&self) -> Result<AcquiredFrameView<'_>>

Keeps an acquired frame’s texture and sync objects in place while you use them.

See mln_acquired_frame_view_begin in the C API reference.

§Errors
  • Status::TargetLost when the session failed, or you detached, abandoned, or disposed it.

Trait Implementations§

Source§

impl Debug for AcquiredFrameHandle

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> ErasedDestructor for T
where T: 'static,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.