pub struct RenderGraph<'a> { /* private fields */ }Expand description
An insertion-ordered, acyclic render program.
Implementations§
Source§impl<'a> RenderGraph<'a>
impl<'a> RenderGraph<'a>
Sourcepub fn add_gaussian_pixels(
&mut self,
source: RenderNodeId,
sigma_pixels: f32,
runtime: EffectRuntime,
) -> Result<RenderNodeId, GraphError>
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>
impl<'a> RenderGraph<'a>
Sourcepub fn new(size: RenderSize) -> Self
pub fn new(size: RenderSize) -> Self
Creates an empty graph whose rendered nodes share one output size.
Sourcepub const fn size(&self) -> RenderSize
pub const fn size(&self) -> RenderSize
The size every rendered node of this graph has.
Sourcepub fn set_blend_space(&mut self, space: BlendSpace)
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.
Sourcepub fn add_source(&mut self, texture: SourceView<'a>) -> RenderNodeId
pub fn add_source(&mut self, texture: SourceView<'a>) -> RenderNodeId
Adds an externally owned source texture.
Sourcepub fn add_source_with_key(
&mut self,
texture: SourceView<'a>,
key: RenderCacheKey,
) -> RenderNodeId
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.
Sourcepub fn add_effect(
&mut self,
effect: EffectId,
source: RenderNodeId,
params: EffectParams<'a>,
runtime: EffectRuntime,
) -> Result<RenderNodeId, GraphError>
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.
Sourcepub fn add_effect_with_resources(
&mut self,
effect: EffectId,
source: RenderNodeId,
params: EffectParams<'a>,
resources: EffectResources,
runtime: EffectRuntime,
) -> Result<RenderNodeId, GraphError>
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.
Sourcepub fn add_effect_with_inputs(
&mut self,
effect: EffectId,
source: RenderNodeId,
inputs: EffectInputs<'a>,
params: EffectParams<'a>,
resources: EffectResources,
runtime: EffectRuntime,
) -> Result<RenderNodeId, GraphError>
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.
Sourcepub fn add_generator(
&mut self,
effect: EffectId,
params: EffectParams<'a>,
runtime: EffectRuntime,
) -> RenderNodeId
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.
Sourcepub fn add_generator_with_resources(
&mut self,
effect: EffectId,
params: EffectParams<'a>,
resources: EffectResources,
runtime: EffectRuntime,
) -> RenderNodeId
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.
Sourcepub fn add_vector(&mut self, scene: Arc<VectorScene>) -> RenderNodeId
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.
Sourcepub fn add_transition(
&mut self,
effect: EffectId,
from: RenderNodeId,
to: RenderNodeId,
params: EffectParams<'a>,
runtime: EffectRuntime,
) -> Result<RenderNodeId, GraphError>
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.
Sourcepub fn add_transition_with_resources(
&mut self,
effect: EffectId,
from: RenderNodeId,
to: RenderNodeId,
params: EffectParams<'a>,
resources: EffectResources,
runtime: EffectRuntime,
) -> Result<RenderNodeId, GraphError>
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.
Sourcepub fn add_composite(
&mut self,
layers: Vec<GraphLayer>,
) -> Result<RenderNodeId, GraphError>
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.
Sourcepub fn add_composite_over(
&mut self,
layers: Vec<GraphLayer>,
background: Color,
) -> Result<RenderNodeId, GraphError>
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.
Sourcepub fn set_output(&mut self, output: RenderNodeId) -> Result<(), GraphError>
pub fn set_output(&mut self, output: RenderNodeId) -> Result<(), GraphError>
Sourcepub const fn output(&self) -> Option<RenderNodeId>
pub const fn output(&self) -> Option<RenderNodeId>
The selected graph result, if one was selected.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Returns the number of nodes in insertion order.
Sourcepub fn node_kind(&self, id: RenderNodeId) -> Option<RenderNodeKind>
pub fn node_kind(&self, id: RenderNodeId) -> Option<RenderNodeKind>
Returns the public category of a node.
Sourcepub fn set_cache_intent(
&mut self,
node: RenderNodeId,
intent: CacheIntent,
) -> Result<(), GraphError>
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.
Sourcepub fn cache_eligibility(
&self,
node: RenderNodeId,
) -> Result<CacheEligibility, GraphError>
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<'_>
impl RenderGraph<'_>
Sourcepub fn compile(&self) -> Result<RenderPlan, GraphError>
pub fn compile(&self) -> Result<RenderPlan, GraphError>
Compiles reachable nodes and their final-use positions.
§Errors
Returns GraphError::MissingOutput when no output was selected.
Sourcepub fn compile_with_quality(
&self,
quality: RenderQualityControls,
) -> Result<RenderPlan, GraphError>
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.