Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

FramePair

Struct FramePair 

Source
pub struct FramePair<const N: usize, S: 'static> { /* private fields */ }
Expand description

Two FrameStorages in the usual ping-pong: build frame N+1 into one while the GPU walks frame N from the other.

ⓘ
loop {
    pair.build(|frame, packets| { /* add packets */ });
    pair.wait();                // frame N's walk is done
    psx_gpu::arm_draw_done();   // anything that must precede the kick
    pair.kick();                // frame N+1 goes out; storages swap
}

Implementations§

Source§

impl<const N: usize, S> FramePair<N, S>

Source

pub fn new( a: &'static mut FrameStorage<N, S>, b: &'static mut FrameStorage<N, S>, dma: GpuDma, ) -> Self

Ping-pong between a and b, owning the GPU DMA token.

Source

pub fn build<R>( &mut self, build: impl for<'f> FnOnce(&mut OtFrame<'f, N>, &'f mut S) -> R, ) -> R

Build the next frame into the storage the GPU is not walking.

Building again before kick starts that frame over.

Source

pub fn wait(&mut self) -> &mut GpuDma

Wait until the frame kicked last has been walked, and lend the token for work that must not overlap it (VRAM uploads, immediate GP0).

Source

pub fn kick(&mut self)

Wait for the previous walk, kick the frame built last, and switch build to the other storage.

Source

pub fn release(self) -> ([&'static mut FrameStorage<N, S>; 2], GpuDma)

Wait for the last walk, then hand back both storages and the token.

Source

pub fn present<R>( &mut self, build: impl for<'f> FnOnce(&mut OtFrame<'f, N>, &'f mut S) -> R, ) -> R

build, then kick.

Trait Implementations§

Source§

impl<const N: usize, S: Debug + 'static> Debug for FramePair<N, S>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<const N: usize, S> Freeze for FramePair<N, S>

§

impl<const N: usize, S> RefUnwindSafe for FramePair<N, S>
where S: RefUnwindSafe,

§

impl<const N: usize, S> Send for FramePair<N, S>
where S: Send,

§

impl<const N: usize, S> Sync for FramePair<N, S>
where S: Sync,

§

impl<const N: usize, S> Unpin for FramePair<N, S>

§

impl<const N: usize, S> UnsafeUnpin for FramePair<N, S>

§

impl<const N: usize, S> !UnwindSafe for FramePair<N, S>

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.