瀏覽代碼

Fix unpack colorspace on context only or wipeCache

sebavan 5 年之前
父節點
當前提交
6e3a98d123
共有 1 個文件被更改,包括 4 次插入3 次删除
  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);
         }