Capítulo 397 de 859

Chapter 397: ComputeNode

Core Idea

Represents a compute shader node.

Key Concepts

  • computeNode : Node: The node that defines the compute shader logic.
  • count : number | Array.<number>: The total number of threads (invocations) to execute. If it is a number, it will be used to automatically generate bounds checking against …
  • countNode : UniformNode: A uniform node holding the dispatch count for bounds checking. Created automatically when count is a number.
  • dispatchSize : number | Array.<number>: The dispatch size for workgroups on X, Y, and Z axes. Used directly if count is not provided.
  • isComputeNode : boolean (readonly): This flag can be used for type testing.
  • name : string: The name or label of the uniform.
  • onInitFunction : function: A callback executed when the compute node finishes initialization.
  • updateBeforeType : string: The updateBeforeType is set to NodeUpdateType.OBJECT since ComputeNode#updateBefore is executed once p…
  • version : number: The version of the node.
  • workgroupSize : Array.<number>: An array defining the X, Y, and Z dimensions of the workgroup for compute shader execution.

Reference Tables

Constructor

Signature
new ComputeNode( computeNode : Node, workgroupSize : Array.<number> )

Properties

PropertyDescription
.computeNode : NodeThe node that defines the compute shader logic.
`.count : numberArray.<number>`
.countNode : UniformNodeA uniform node holding the dispatch count for bounds checking. Created automatically when count is a number.
`.dispatchSize : numberArray.<number>`
.isComputeNode : boolean (readonly)This flag can be used for type testing.
.name : stringThe name or label of the uniform.
.onInitFunction : functionA callback executed when the compute node finishes initialization.
.updateBeforeType : stringThe updateBeforeType is set to NodeUpdateType.OBJECT since ComputeNode#updateBefore is executed once per object by default.
.version : numberThe version of the node.
.workgroupSize : Array.<number>An array defining the X, Y, and Z dimensions of the workgroup for compute shader execution.

Methods

MethodDescription
.dispose()Executes the dispose event for this node.
.label( name : string ) : ComputeNodeSets the ComputeNode#name property.
.onInit( callback : function ) : ComputeNodeSets the callback to run during initialization.
.setName( name : string ) : ComputeNodeSets the ComputeNode#name property.
.updateBefore( frame : NodeFrame )The method execute the compute for this node.

Key Takeaways

  1. ComputeNode extends: EventDispatcher → Node
  2. Most relevant properties: computeNode, count, countNode, dispatchSize.
  3. Key methods: dispose, label, onInit, setName.

Connects To