ComputePass constructor
a Renderer class object or a GPUCurtains class object
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
Private
#autoWhether this ComputePass should be added to our Scene to let it handle the rendering process automatically
function assigned to the onReady callback
function assigned to the onReady callback
function assigned to the onBeforeRender callback
function assigned to the onBeforeRender callback
function assigned to the onRender callback
function assigned to the onRender callback
function assigned to the onAfterRender callback
function assigned to the onAfterRender callback
function assigned to the onAfterResize 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 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 lost to prepare everything for restoration. Basically set all the GPUBuffer to null so they will be reset next time we try to render
Called when the device has been restored
Create a new DOMTexture
Create a new Texture
Add a Texture or DOMTexture
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
Callback to run when the ComputePass is rendered
callback to run when ComputePass is rendered
Callback to run after the ComputePass has been rendered
callback to run just after ComputePass has been rendered
Callback used to run a custom render function instead of the default one.
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
Render our ComputeMaterial
current compute pass encoder
Render our compute pass Basically just check if our renderer is ready, and then render our ComputeMaterial
Get the result GPU buffer content by binding and buffer element names
parameters used to get the result
Optional
bindingbinding name from which to get the result
Optional
bufferoptional buffer element (i.e. struct member) name if the result needs to be restrained to only one element
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