gpu-curtains
    Preparing search index...

    A special class used to leverage ComputePass shaders and ShaderPass for post processing effects.

    Allows to write post processing effects to a storage texture using a compute shader, which can be faster than regular ShaderPass in some cases.

    // set our main GPUCurtains instance
    const gpuCurtains = new GPUCurtains({
    container: '#canvas' // selector of our WebGPU canvas container
    })

    // set the GPU device
    // note this is asynchronous
    await gpuCurtains.setDevice()

    const computeShaderPass = new ComputeShaderPass(gpuCurtains, {
    label: 'My compute shader pass',
    shaders: {
    compute: {
    code: computeShaderPassCode, // assume it is a valid WGSL compute shader
    },
    },
    textureDispatchSize: [16, 16], // divided by the render texture [width, height] internally
    })

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    type: string

    The type of the ComputePass.

    uuid: string

    The universal unique id of the ComputePass.

    index: number

    The index of the ComputePass, incremented each time a new one is instanced.

    renderer: Renderer

    The Renderer used.

    renderOrder: number

    Controls the order in which this ComputePass should be rendered by our Scene.

    material: ComputeMaterial
    _ready: boolean

    Flag indicating whether this ComputePass is ready to be rendered.

    userData: Record<string, unknown>

    Empty object to store any additional data or custom properties into your ComputePass.

    _onReadyCallback: () => void = ...

    function assigned to the onReady callback.

    _onBeforeRenderCallback: () => void = ...

    function assigned to the onBeforeRender callback.

    _onRenderCallback: () => void = ...

    function assigned to the onRender callback.

    _onAfterRenderCallback: () => void = ...

    function assigned to the onAfterRender callback.

    _onAfterResizeCallback: () => void = ...

    function assigned to the onAfterResize callback.

    shaderPass: ShaderPass

    Associated ShaderPass that just displays the result of the ComputeShaderPass compute shader.

    storageTexture: Texture

    Storage texture to write onto by the ComputeShaderPass compute shader.

    renderTexture: Texture

    The same texture as storageTexture but with a different binding type, used to render the result in the shaderPass.

    textureDispatchSize: number[]

    Workgroup size of the compute shader. Divided internally by the storageTexture [width, height].

    Options used to create this ComputeShaderPass.

    Accessors

    • get ready(): boolean

      Get or set whether the compute pass is ready to render (the material has been successfully compiled).

      Returns boolean

    Methods