Skip to main content

ComputeFlow

Struct ComputeFlow 

Source
#[non_exhaustive]
pub struct ComputeFlow { pub statements: Vec<NodeRef>, pub count: usize, pub workgroup_size: [u32; 3], pub name: Option<String>, pub on_init: Option<Box<ComputeFlow>>, }
Expand description

One ComputeNode — Fn( () => { … } )().compute( count, workgroupSize ).

Built with ComputeFlow::new, which takes the two things three’s .compute() cannot default; the rest are fields to set afterwards (docs/api.md decision 3).

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§statements: Vec<NodeRef>

The kernel body’s statements, in order.

§count: usize

.compute( count ) — the number of invocations the kernel is for, and the bound the generated early-return checks instanceIndex against, unless the kernel has a barrier (docs/nodes.md §84.6).

§workgroup_size: [u32; 3]

ComputeNode’s workgroupSize, padded to three components exactly as computeKernel( node, workgroupSize = [ 64 ] ) pads it.

§name: Option<String>

computeNode.setName( … ).

§on_init: Option<Box<ComputeFlow>>

computeNode.onInit — a second kernel the renderer runs once, before the first dispatch of this one, in its own command encoder and its own submit.

Implementations§

Source§

impl ComputeFlow

Source

pub fn new(statements: Vec<NodeRef>, count: usize) -> Self

Fn( () => { statements } )().compute( count ): the kernel body and the invocation count, with three’s default workgroupSize of [ 64 ], no name and no onInit.

Trait Implementations§

Source§

impl Clone for ComputeFlow

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ComputeFlow

Source§

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

Formats the value using the given formatter. Read more
Source§

impl NodeUpdate for ComputeFlow

ComputeNode.updateBefore( frame ): frame.renderer.compute( this ), with updateBeforeType = NodeUpdateType.FRAME — a kernel a material reads as a value runs once a frame, before the first draw that reads it.

Source§

fn update_before_type(&self) -> NodeUpdateType

getUpdateBeforeType().
Source§

fn update_before(&self, renderer: &mut Renderer) -> bool

updateBefore( frame ): before the draw that reaches the node. A pass renders its scene here.
Source§

fn update_type(&self) -> NodeUpdateType

getUpdateType().
Source§

fn update_after_type(&self) -> NodeUpdateType

getUpdateAfterType().
Source§

fn update(&self, _renderer: &mut Renderer) -> bool

update( frame ): while the draw’s bindings are updated.
Source§

fn update_after(&self, _renderer: &mut Renderer) -> bool

updateAfter( frame ): after the draw.
Source§

fn sync_before_build(&self, _samples: u32)

Three’s PassNode.setup() sets renderTarget.samples = renderer.samples while the graph that reaches the pass is analyzed — before any pass renders. That is what lets a composite bind the pass’s depth texture as texture_depth_multisampled_2d on the very build that discovers it. The port has no per-node setup() hook (docs/nodes.md §57.2), so sync_before_build stands in for it: it runs on every node with a live texture registration, right before Renderer builds a material’s program, which is the earliest point the builder can see a pass’s textures. PassNode is the only node that overrides it (docs/nodes.md §57.5); the default is a no-op.

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<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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.