Pārlūkot izejas kodu

Fix unpack colorspace on context only or wipeCache

sebavan 5 gadi atpakaļ
vecāks
revīzija
6e3a98d123
1 mainītis faili ar 4 papildinājumiem un 3 dzēšanām
  1. 4 3
      src/Engines/thinEngine.ts

+ 4 - 3
src/Engines/thinEngine.ts

@@ -591,9 +591,6 @@ export class ThinEngine {
             if (!this._gl) {
                 throw new Error("WebGL not supported");
             }
-
-            // Ensures a consistent color space unpacking of textures cross browser.
-            this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);
         } else {
             this._gl = <WebGLRenderingContext>canvasOrContext;
             this._renderingCanvas = this._gl.canvas as HTMLCanvasElement;
@@ -608,6 +605,9 @@ export class ThinEngine {
             }
         }
 
+        // Ensures a consistent color space unpacking of textures cross browser.
+        this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);
+
         if (options.useHighPrecisionFloats !== undefined) {
             this._highPrecisionShadersAllowed = options.useHighPrecisionFloats;
         }
@@ -2617,6 +2617,7 @@ export class ThinEngine {
 
             this._unpackFlipYCached = null;
 
+            this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);
             this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);
         }