How can I get an onError callback when a shader fails to compile and is assigned to a PostProcess?
When assigning shaders to a PostProcess, I cannot get the onError
callback to fire.
Below is some example code of what I mean.
I can only get the global error callback to fire off, but it lacks context as to which shader is failing.
BABYLON.Effect.ShadersStore[`${fragmentID}FragmentShader`] = shaderPass.fragmentGLSL
const postProcess = new BABYLON.PostProcess(`Shader`,
fragmentID,
[
...STANDARDUNIFORMS,
],
SAMPLER,
ratio,
camera);
// DOESNT WORK!!!!
postProcess.getEffect().onErrorObservable.add((error) => {
console.error(error)
})
// DOESNT WORK!!!!
postProcess.getEffect().onError = (effect, errors) => {
console.error("Shader Error", errors)
}
// Works but lacks shader context
BABYLON.Logger.Error = (message) => {
console.error(message)
}
Additionally, this code looks like it could fire off on the onError
callback, however previousPipelineContext
is always nil for a newly created Effect.
if (previousPipelineContext) {
this._pipelineContext = previousPipelineContext;
this._isReady = true;
if (this.onError) {
this.onError(this, this._compilationError);
}
this.onErrorObservable.notifyObservers(this);
}