Class ComputeEffect
Constructors
constructor
-
new ComputeEffect(
baseName: string | IComputeShaderPath,
options: IComputeEffectCreationOptions,
engine: AbstractEngine,
key?: string,
): ComputeEffectCreates a compute effect that can be used to execute a compute shader
Parameters
- baseName: string | IComputeShaderPath
Name of the effect
- options: IComputeEffectCreationOptions
Set of all options to create the effect
- engine: AbstractEngine
The engine the effect is created for
- key: string = ""
Effect Key identifying uniquely compiled shader variants
Returns ComputeEffect
- baseName: string | IComputeShaderPath
Properties
defines
String container all the define statements that should be set on the shader.
name
Name of the effect.
on Bind Observable
Observable that will be called when effect is bound.
on Compiled
Callback that will be called when the shader is compiled.
on Compile Observable
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.
on Error
Callback that will be called if an error occurs during shader compilation.
on Error Observable
Observable that will be called if an error occurs during shader compilation.
unique Id
Unique ID of the effect.
StaticLog Shader Code On Compilation Error
Enable logging of the shader code when a compilation error occurs
Accessors
compute Source Code
-
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
raw Compute Source Code
-
get rawComputeSourceCode(): string
Gets the compute shader source code before it has been processed by the preprocessor
Returns string
Methods
dispose
-
Release all associated resources.
Returns void
execute When Compiled
-
Adds a callback to the onCompiled observable and call the callback immediately if already ready.
Parameters
- func: (effect: ComputeEffect) => void
The callback to be used.
Returns void
- func: (effect: ComputeEffect) => void
get Compilation Error
-
The error from the last compilation.
Returns string
the error string.
get Engine
get Pipeline Context
-
The pipeline context for this effect
Returns Nullable<IComputePipelineContext>
the associated pipeline context
is Ready
-
If the effect has been compiled and prepared.
Returns boolean
if the effect is compiled and prepared.
StaticRegister Shader
-
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
- name: string
Effect wrapping a compute shader and let execute (dispatch) the shader