Skip to content

Commit

Permalink
feat: add support for 'WEBGL_debug_shaders' extension
Browse files Browse the repository at this point in the history
  • Loading branch information
bhouston committed Jun 23, 2020
1 parent c22865a commit 286f21b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/lib/renderers/webgl/shaders/Shader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,20 @@ export class Shader implements IDisposable {
if (!success) {
// Something went wrong during compilation; get the error
const infoLog = gl.getShaderInfoLog(this.glShader);
throw new Error(`could not compile shader: ${infoLog}`);
const errorMessage = `could not compile shader: ${infoLog}`;
console.error(errorMessage, sourceCode);
throw new Error(errorMessage);
}
}

get translatedSourceCode(): string {
const ds = this.context.glxo.WEBGL_debug_shaders;
if (ds !== null) {
return ds.getTranslatedShaderSource(this.glShader);
}
return "";
}

dispose(): void {
if (!this.disposed) {
this.context.gl.deleteShader(this.glShader);
Expand Down

0 comments on commit 286f21b

Please sign in to comment.