Skip to main content

GpuFrameSink

Struct GpuFrameSink 

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

A FrameSink that processes each frame through a RenderGraph before forwarding to a downstream sink.

When the wgpu feature is enabled and the graph was created with a GPU context, the GPU pipeline runs. On GPU error the unprocessed frame is forwarded as a fallback.

When the wgpu feature is not enabled (or the graph is CPU-only), the CPU fallback pipeline runs transparently.

§Example

let ctx = Arc::new(RenderContext::init().await?);
let graph = RenderGraph::new(ctx)
    .push(ColorGradeNode { brightness: 0.2, ..Default::default() });
let sink = GpuFrameSink::new(graph, Box::new(RgbaSink::new()));
runner.set_sink(Box::new(sink));

Implementations§

Source§

impl GpuFrameSink

Source

pub fn new(graph: RenderGraph, downstream: Box<dyn FrameSink>) -> Self

Construct a sink that applies graph to every incoming frame and forwards the result to downstream.

Trait Implementations§

Source§

impl FrameSink for GpuFrameSink

Source§

fn push_frame(&mut self, rgba: &[u8], width: u32, height: u32, pts: Duration)

Receive a video frame at its presentation time. Read more
Source§

fn flush(&mut self)

Called when playback ends (EOF or PlayerHandle::stop). Default: no-op. 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
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.