Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ComputeEffect

Effect wrapping a compute shader and let execute (dispatch) the shader

Hierarchy

  • ComputeEffect

Index

Constructors

constructor

  • Creates a compute effect that can be used to execute a compute shader

    Parameters

    • baseName: any

      Name of the effect

    • options: IComputeEffectCreationOptions

      Set of all options to create the effect

    • engine: Engine

      The engine the effect is created for

    • Optional key: string

      Effect Key identifying uniquely compiled shader variants

    Returns ComputeEffect

Properties

definesSearch playground for defines

defines: string

String container all the define statements that should be set on the shader.

nameSearch playground for name

name: any

Name of the effect.

onBindObservableSearch playground for onBindObservable

onBindObservable: Observable<ComputeEffect>

Observable that will be called when effect is bound.

onCompileObservableSearch playground for onCompileObservable

onCompileObservable: Observable<ComputeEffect>

Observable that will be called when the shader is compiled. It is recommended to use executeWhenCompile() or to make sure that scene.isReady() is called to get this observable raised.

onCompiledSearch playground for onCompiled

onCompiled: Nullable<(effect: ComputeEffect) => void>

Callback that will be called when the shader is compiled.

onErrorSearch playground for onError

onError: Nullable<(effect: ComputeEffect, errors: string) => void>

Callback that will be called if an error occurs during shader compilation.

onErrorObservableSearch playground for onErrorObservable

onErrorObservable: Observable<ComputeEffect>

Observable that will be called if an error occurs during shader compilation.

uniqueIdSearch playground for uniqueId

uniqueId: number

Unique ID of the effect.

Static LogShaderCodeOnCompilationErrorSearch playground for LogShaderCodeOnCompilationError

LogShaderCodeOnCompilationError: boolean

Enable logging of the shader code when a compilation error occurs

Accessors

computeSourceCode

  • get computeSourceCode(): string
  • Gets the compute shader source code of this effect

    Returns string

key

  • get key(): string
  • Unique key for this effect

    Returns string

rawComputeSourceCode

  • get rawComputeSourceCode(): string
  • Gets the compute shader source code before it has been processed by the preprocessor

    Returns string

Methods

disposeSearch playground for dispose

  • dispose(): void
  • Release all associated resources.

    Returns void

executeWhenCompiledSearch playground for executeWhenCompiled

  • executeWhenCompiled(func: (effect: ComputeEffect) => void): void
  • Adds a callback to the onCompiled observable and call the callback immediately if already ready.

    Parameters

    Returns void

getCompilationErrorSearch playground for getCompilationError

  • getCompilationError(): string
  • The error from the last compilation.

    Returns string

    the error string.

getEngineSearch playground for getEngine

  • The engine the effect was initialized with.

    Returns Engine

    the engine.

getPipelineContextSearch playground for getPipelineContext

  • The pipeline context for this effect

    Returns Nullable<IComputePipelineContext>

    the associated pipeline context

isReadySearch playground for isReady

  • isReady(): boolean
  • If the effect has been compiled and prepared.

    Returns boolean

    if the effect is compiled and prepared.

Static RegisterShaderSearch playground for RegisterShader

  • RegisterShader(name: string, computeShader: string): void
  • This function will add a new compute shader to the shader store

    Parameters

    • name: string

      the name of the shader

    • computeShader: string

      compute shader content

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method