ComputePass constructor
Renderer class object or GPUCurtains class object used to create this ComputePass.
parameters used to create our ComputePass.
The type of the ComputePass.
The universal unique id of the ComputePass.
The index of the ComputePass, incremented each time a new one is instanced.
The Renderer used.
Controls the order in which this ComputePass should be rendered by our Scene.
Options used to create this ComputePass.
ComputeMaterial used by this ComputePass.
Flag indicating whether this ComputePass is ready to be rendered.
Empty object to store any additional data or custom properties into your ComputePass.
function assigned to the onReady callback.
function assigned to the onBeforeRender callback.
function assigned to the onRender callback.
function assigned to the onAfterRender callback.
function assigned to the onAfterResize callback.
Get or set whether the compute pass is ready to render (the material has been successfully compiled).
Get the active property value.
Set the active property value.
New active value.
Get our ComputeMaterial textures array
Get our ComputeMaterial uniforms.
Get our ComputeMaterial storages.
Add our ComputePass to the scene and optionally to the renderer.
Whether to add this ComputePass to the Renderer computePasses array.
Remove our ComputePass from the scene and optionally from the renderer as well.
whether to remove this ComputePass from the Renderer computePasses array.
Set a new Renderer for this ComputePass.
new Renderer to set.
Create the compute pass material.
ComputeMaterial parameters.
Set or update the ComputePass ComputeMaterial.
New ComputeMaterial to use.
Called when the device has been restored.
Create a new MediaTexture.
Create a new Texture.
Add a Texture or MediaTexture.
Texture to add.
Callback to run when the ComputePass is ready.
Callback to run when ComputePass is ready.
Callback to run before the ComputePass is rendered.
Callback to run just before ComputePass will be rendered. The callback won't be called if the Renderer is not ready or the ComputePass itself is neither ready nor active.
Callback to run when the ComputePass is rendered.
Callback to run when ComputePass is rendered. The callback won't be called if the Renderer is not ready or the ComputePass itself is neither ready nor active.
Callback to run after the ComputePass has been rendered.
Callback to run just after ComputePass has been rendered. The callback won't be called if the Renderer is not ready or the ComputePass itself is neither ready nor active.
Callback used to run a custom render function instead of the default one. This won't be called if the Renderer is not ready or the ComputePass itself is neither ready nor active.
Your custom render function where you will have to set all the bind groups and dispatch the workgroups by yourself.
Callback to run after the renderer has been resized.
Callback to run just after renderer has been resized.
Called before rendering the ComputePass. Checks if the material is ready and eventually update its bindings.
Render our ComputeMaterial.
Current compute pass encoder.
Called after having rendered the ComputePass.
Render our compute pass. Basically just check if our renderer is ready, and then render our ComputeMaterial.
Current compute pass encoder.
Copy the result of our read/write GPUBuffer into our result binding array.
Current GPU command encoder.
Get the result GPU buffer content by binding and buffer element names.
Parameters used to get the result
Optional
bindingName?: stringbinding name from which to get the result.
Optional
bufferElementName?: stringOptional buffer element (i.e. struct member) name if the result needs to be restrained to only one element.
Remove the ComputePass from the Scene and destroy it.
Destroy the ComputePass.
Used to create a ComputePass, i.e. run computations on the GPU.
A ComputePass is basically a wrapper around a ComputeMaterial that handles most of the process.
The default render behaviour of a ComputePass is to set its bind groups and then dispatch the workgroups based on the provided dispatchSize.
However, most of the time you'd want a slightly more complex behaviour. The
useCustomRender
hook lets you define a totally custom behaviour, but you'll have to set all the bind groups and dispatch the workgroups by yourself.Example