Browse Source

Dump more info when a shader can't be created

Popov72 4 years ago
parent
commit
9bdc9b2973
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/Engines/thinEngine.ts

+ 4 - 1
src/Engines/thinEngine.ts

@@ -2249,10 +2249,13 @@ export class ThinEngine {
 
     private _compileRawShader(source: string, type: string): WebGLShader {
         var gl = this._gl;
+
+        while (gl.getError() != gl.NO_ERROR) { }
+
         var shader = gl.createShader(type === "vertex" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);
 
         if (!shader) {
-            throw new Error(`Something went wrong while creating a gl ${type} shader object. gl error=${gl.getError()}`);
+            throw new Error(`Something went wrong while creating a gl ${type} shader object. gl error=${gl.getError()}, gl isContextLost=${gl.isContextLost()}, _contextWasLost=${this._contextWasLost}`);
         }
 
         gl.shaderSource(shader, source);