Skip to main content

RenderGraph

Struct RenderGraph 

Source
pub struct RenderGraph<'a> { /* private fields */ }
Expand description

An insertion-ordered, acyclic render program.

Implementations§

Source§

impl<'a> RenderGraph<'a>

Source

pub fn add_gaussian_pixels( &mut self, source: RenderNodeId, sigma_pixels: f32, runtime: EffectRuntime, ) -> Result<RenderNodeId, GraphError>

Adds a Gaussian blur of source whose standard deviation is sigma_pixels of the graph’s pixels on both axes, drawn as the built-in blur draws: narrow one-axis passes, within the renderer’s filter-sample budget. A mask’s feather softens its coverage with it. A deviation that is not finite and positive returns source itself.

§Errors

Returns GraphError::InvalidDependency unless source is earlier.

Source§

impl<'a> RenderGraph<'a>

Source

pub fn new(size: RenderSize) -> Self

Creates an empty graph whose rendered nodes share one output size.

Source

pub const fn size(&self) -> RenderSize

The size every rendered node of this graph has.

Source

pub fn set_blend_space(&mut self, space: BlendSpace)

Blends this graph’s composites in space rather than in the renderer’s default space. A timeline frame takes it from its project, so preview and export blend alike whatever renderer draws them.

Source

pub fn add_source(&mut self, texture: SourceView<'a>) -> RenderNodeId

Adds an externally owned source texture.

Source

pub fn add_source_with_key( &mut self, texture: SourceView<'a>, key: RenderCacheKey, ) -> RenderNodeId

Adds an externally owned texture with a cross-frame stable cache key.

The key is the caller’s promise that the texture’s pixels depend on nothing it leaves out: the source’s content, the frame, and how it was decoded and converted. Results drawn from it can then be cached.

Source

pub fn add_effect( &mut self, effect: EffectId, source: RenderNodeId, params: EffectParams<'a>, runtime: EffectRuntime, ) -> Result<RenderNodeId, GraphError>

Adds a registered one-input effect node.

§Errors

Returns GraphError::InvalidDependency unless source is earlier.

Source

pub fn add_effect_with_resources( &mut self, effect: EffectId, source: RenderNodeId, params: EffectParams<'a>, resources: EffectResources, runtime: EffectRuntime, ) -> Result<RenderNodeId, GraphError>

Adds a registered one-input effect node with external resources.

The built-in Gaussian blur and glow are added as the internal passes that draw them, and the returned node is the last of those.

§Errors

Returns GraphError::InvalidDependency unless source is earlier; for a built-in drawn as passes, also RenderError::InvalidEffectParams when its parameters are not ones it declares or are out of range.

Source

pub fn add_effect_with_inputs( &mut self, effect: EffectId, source: RenderNodeId, inputs: EffectInputs<'a>, params: EffectParams<'a>, resources: EffectResources, runtime: EffectRuntime, ) -> Result<RenderNodeId, GraphError>

Adds a registered effect node that also samples inputs, bound by the names its definition declares.

§Errors

Returns GraphError::InvalidDependency unless source and every input are earlier, RenderError::InvalidEffectParams for named inputs on a built-in drawn as passes, and otherwise the errors of Self::add_effect_with_resources.

Source

pub fn add_generator( &mut self, effect: EffectId, params: EffectParams<'a>, runtime: EffectRuntime, ) -> RenderNodeId

Adds a registered generator node: a picture drawn from its parameters alone, at the graph’s size.

Source

pub fn add_generator_with_resources( &mut self, effect: EffectId, params: EffectParams<'a>, resources: EffectResources, runtime: EffectRuntime, ) -> RenderNodeId

Adds a registered generator node that samples external resources, bound by the names its definition declares, as an effect’s are.

Source

pub fn add_vector(&mut self, scene: Arc<VectorScene>) -> RenderNodeId

Adds a vector scene: its fills drawn from tile coverage at the graph’s size, over transparency (see alpha2_geometry::VectorScene). Its key is the scene’s, so an unchanged scene is a cache hit; its picture is premultiplied and sRGB-encoded, as every node’s.

The scene’s coordinates are this graph’s pixels: one built for another size draws at that size’s coordinates.

Source

pub fn add_transition( &mut self, effect: EffectId, from: RenderNodeId, to: RenderNodeId, params: EffectParams<'a>, runtime: EffectRuntime, ) -> Result<RenderNodeId, GraphError>

Adds a registered two-input transition node.

§Errors

Returns GraphError::InvalidDependency unless both inputs are earlier.

Source

pub fn add_transition_with_resources( &mut self, effect: EffectId, from: RenderNodeId, to: RenderNodeId, params: EffectParams<'a>, resources: EffectResources, runtime: EffectRuntime, ) -> Result<RenderNodeId, GraphError>

Adds a registered two-input transition node with external resources.

§Errors

Returns GraphError::InvalidDependency unless both inputs are earlier.

Source

pub fn add_composite( &mut self, layers: Vec<GraphLayer>, ) -> Result<RenderNodeId, GraphError>

Adds an ordered layer-composition node over a transparent target.

§Errors

Returns GraphError::InvalidDependency for a missing layer source.

Source

pub fn add_composite_over( &mut self, layers: Vec<GraphLayer>, background: Color, ) -> Result<RenderNodeId, GraphError>

Adds an ordered layer-composition node over a solid background.

background is the bottom layer: the first layer blends against it as against any lower layer. Like crate::Renderer::render_solid’s color, it is a premultiplied, sRGB-encoded storage value.

§Errors

Returns GraphError::InvalidDependency for a missing layer source, or RenderError::InvalidColor for a background out of range or not premultiplied.

Source

pub fn set_output(&mut self, output: RenderNodeId) -> Result<(), GraphError>

Selects the graph result.

§Errors

Returns GraphError::InvalidDependency for an unknown node.

Source

pub const fn output(&self) -> Option<RenderNodeId>

The selected graph result, if one was selected.

Source

pub fn node_count(&self) -> usize

Returns the number of nodes in insertion order.

Source

pub fn node_kind(&self, id: RenderNodeId) -> Option<RenderNodeKind>

Returns the public category of a node.

Source

pub fn set_cache_intent( &mut self, node: RenderNodeId, intent: CacheIntent, ) -> Result<(), GraphError>

Names node a cache candidate: its result is looked up before it is drawn and kept after, as intent says, when its key is complete. crate::CacheIntent::Bypass instead keeps it, everything it is drawn from, and everything drawn from it out of the cache.

§Errors

Returns GraphError::InvalidDependency for an unknown node.

Source

pub fn cache_eligibility( &self, node: RenderNodeId, ) -> Result<CacheEligibility, GraphError>

Whether node’s result can be cached, and if not, why.

§Errors

Returns GraphError::InvalidDependency for an unknown node.

Source§

impl RenderGraph<'_>

Source

pub fn compile(&self) -> Result<RenderPlan, GraphError>

Compiles reachable nodes and their final-use positions.

§Errors

Returns GraphError::MissingOutput when no output was selected.

Source

pub fn compile_with_quality( &self, quality: RenderQualityControls, ) -> Result<RenderPlan, GraphError>

Compiles with explicit filter and temporal sampling controls.

§Errors

Returns GraphError::MissingOutput when no output was selected.

Trait Implementations§

Source§

impl<'a> Debug for RenderGraph<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for RenderGraph<'a>

§

impl<'a> !UnwindSafe for RenderGraph<'a>

§

impl<'a> Freeze for RenderGraph<'a>

§

impl<'a> Send for RenderGraph<'a>

§

impl<'a> Sync for RenderGraph<'a>

§

impl<'a> Unpin for RenderGraph<'a>

§

impl<'a> UnsafeUnpin for RenderGraph<'a>

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

Source§

fn downcast(&self) -> &T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,