Struct shadergraph::graph::ShaderGraph [−][src]
pub struct ShaderGraph {
pub created: Instant,
// some fields omitted
}
Expand description
Represents a Directed Acyclic Graph of shaders. Each shader is run sequentially, and can be the input to shaders later down the line.
Fields
created: Instant
Implementations
Creates a new shader graph within a specific glium context.
Adds anything that implements the Node
trait to
the graph Will panic if the Node
does not
preserve DAG structure.
Adds an input to the shader graph.
Use the returned NodeId
to mark it as a
texture input to other shaders.
Adds a shader to a shader graph.
Each shader has its own underlying Texture2d
of a
particular size. Shader is bound to the graph’s
context.
Add a recurrent shader to the graph.
pub fn add_compute<T: AsUniformValue + 'static>(
&mut self,
compute_node: ComputeNode<T>
) -> Result<NodeId, String>
pub fn add_compute<T: AsUniformValue + 'static>(
&mut self,
compute_node: ComputeNode<T>
) -> Result<NodeId, String>
Adds a compute node, which produces a set of uniforms for use in the next shader.
Mark a node in the graph as an output.
When calling forward
, this node’s texture will be
included in the output map. To access it, index
the map with the NodeId
this method returns.
Returns None
if the requested Node
does not
support being an output.
Does a forward pass of the entire shader graph.
Takes a set of N
inputs, and produces a set of M
outputs. Each shader in the DAG is run, from
front to back, previous input textures are bound
as uniforms of the form: u_texture_0, .., u_texture_n
. Use the map!
macro to quickly
build a BTreeMap
to pass to this function. All
marked outputs will be included in the output map.