Define the parameters used to create a ComputeShaderPass.

interface ComputeShaderPassParams {
    label?: string;
    shaders?: MaterialShaders;
    useAsyncPipeline?: boolean;
    texturesOptions?: SceneObjectTextureOptions;
    autoRender?: boolean;
    visible?: boolean;
    renderOrder?: number;
    outputTarget?: RenderTarget;
    targets?: Partial<GPUColorTargetState>[];
    renderBundle?: RenderBundle;
    renderTextureName?: string;
    copyOutputToRenderTexture?: boolean;
    isPrePass?: boolean;
    inputTarget?: RenderTarget;
    storageTextureParams?: ComputeStorageTextureParams;
    textureDispatchSize?: number | number[];
    shaderPassSampler?: Sampler;
    uniforms?: ReadOnlyInputBindings;
    storages?: ReadWriteInputBindings;
    bindings?: BindGroupBindingElement[];
    bindGroups?: BindGroup[];
    samplers?: Sampler[];
    textures?: MaterialTexture[];
    transparent?: boolean;
    depth?: boolean;
    depthWriteEnabled?: boolean;
    depthCompare?: GPUCompareFunction;
    depthFormat?: GPUTextureFormat;
    depthBias?: number;
    depthBiasClamp?: number;
    depthBiasSlopeScale?: number;
    stencil?: {
        front: GPUStencilFaceState;
        back?: GPUStencilFaceState;
        stencilReference?: number;
        stencilReadMask?: number;
        stencilWriteMask?: number;
    };
    sampleCount?: number;
    alphaToCoverageEnabled?: boolean;
    mask?: number;
    unclippedDepth?: boolean;
}

Hierarchy

Properties

label?: string

The label of the ComputePass.

shaders?: MaterialShaders

Compute shader passed to the ComputePass following the shader object notation.

useAsyncPipeline?: boolean

whether the compute pipeline should be compiled asynchronously.

texturesOptions?: SceneObjectTextureOptions

Parameters used by this ComputePass to create a MediaTexture.

autoRender?: boolean

Whether we should add this Mesh to our Scene to let it handle the rendering process automatically.

visible?: boolean

Flag indicating whether to draw this Mesh or not.

renderOrder?: number

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

outputTarget?: RenderTarget

Optional RenderTarget to render this Mesh to instead of the canvas context.

targets?: Partial<GPUColorTargetState>[]

Optional targets properties.

renderBundle?: RenderBundle

Optional RenderBundle into which this Mesh should be added.

renderTextureName?: string

Texture name to use for the ShaderPass renderTexture. Default to 'renderTexture'.

copyOutputToRenderTexture?: boolean

Whether the result of this ShaderPass should be copied to the renderTexture after each render. Default to false.

isPrePass?: boolean

Whether this ShaderPass should be rendered to the main buffer using the renderer renderPass before drawing the other objects to the main buffer. Useful for "blit" passes using the content of an inputTarget.

inputTarget?: RenderTarget

Optional input RenderTarget to assign to the ShaderPass. Used to automatically copy the content of the given RenderTarget texture into the ShaderPass renderTexture.

storageTextureParams?: ComputeStorageTextureParams

Options used to create the storage texture used in the compute shader.

textureDispatchSize?: number | number[]

Workgroup size of the compute shader to use. Divided internally by the storage texture [width, height]. Default to [16, 16].

shaderPassSampler?: Sampler

Optional Sampler to use in the ShaderPass to sample the result.

Uniforms input to pass to a BindGroup.

Read only or read/write storages input to pass to a BindGroup.

Array of already created bindings (buffers, texture, etc.) to pass to this BindGroup.

bindGroups?: BindGroup[]

Array of already created bind groups to be used by this Material.

samplers?: Sampler[]

Array of already created samplers to be used by this Material.

textures?: MaterialTexture[]

Array of already created Texture or MediaTexture to be used by this Material.

transparent?: boolean

Whether this RenderMaterial should be treated as transparent. Impacts the render pipeline blend property.

depth?: boolean

Whether this RenderMaterial should write to the depth buffer.

depthWriteEnabled?: boolean

Whether this RenderMaterial should enable depth write.

depthCompare?: GPUCompareFunction

Depth function to use with this RenderMaterial.

depthFormat?: GPUTextureFormat

Format of the depth texture to use with this RenderMateria.l

depthBias?: number

A number representing a constant depth bias that is added to each fragment. Default to 0.

depthBiasClamp?: number

A number representing the maximum depth bias of a fragment. Default to 0.

depthBiasSlopeScale?: number

A number representing a depth bias that scales with the fragment's slope. Default to 0.

stencil?: {
    front: GPUStencilFaceState;
    back?: GPUStencilFaceState;
    stencilReference?: number;
    stencilReadMask?: number;
    stencilWriteMask?: number;
}

Define the stencil operations to use if any.

Type declaration

  • front: GPUStencilFaceState

    Defines how stencil comparisons and operations are performed for front-facing primitives.

  • Optionalback?: GPUStencilFaceState

    Defines how stencil comparisons and operations are performed for back-facing primitives. If undefined, will fall back to front values.

  • OptionalstencilReference?: number

    Set the GPURenderPassEncoder stencil reference value used during stencil tests if any. Default to 0x000000 if a stencil is used.

  • OptionalstencilReadMask?: number

    A bitmask controlling which stencil value bits are read when performing stencil comparison tests. Default to 0xFFFFFF.

  • OptionalstencilWriteMask?: number

    A bitmask controlling which stencil value bits are written to when performing stencil comparison tests. Default to 0xFFFFFF.

sampleCount?: number

The sampleCount of the RenderPass onto which we'll be drawing. Set internally.

alphaToCoverageEnabled?: boolean

When true indicates that a fragment's alpha channel should be used to generate a sample coverage mask. Default to false.

mask?: number

Mask determining which samples are written to. Default to 0xFFFFFFFF.

unclippedDepth?: boolean

If true, indicates that depth clipping is disabled. Requires the depth-clip-control feature to be enabled. Default to false.