From eb649aeba2b0ea5f2175404ebdb31204df0e14ab Mon Sep 17 00:00:00 2001 From: ChiaNing Date: Sat, 19 Sep 2020 21:23:53 +0800 Subject: [PATCH] fix iOS14 crash on getExtension (#7417) (cherry picked from commit aaafb6681b49e5de3a49d354f3aa86457966c8c0) --- cocos/core/gfx/webgl/webgl-device.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cocos/core/gfx/webgl/webgl-device.ts b/cocos/core/gfx/webgl/webgl-device.ts index 9852bee53d..b572a09d95 100644 --- a/cocos/core/gfx/webgl/webgl-device.ts +++ b/cocos/core/gfx/webgl/webgl-device.ts @@ -325,7 +325,10 @@ export class WebGLDevice extends GFXDevice { this._WEBGL_compressed_texture_etc1 = this.getExtension('WEBGL_compressed_texture_etc1'); this._WEBGL_compressed_texture_etc = this.getExtension('WEBGL_compressed_texture_etc'); this._WEBGL_compressed_texture_pvrtc = this.getExtension('WEBGL_compressed_texture_pvrtc'); - this._WEBGL_compressed_texture_astc = this.getExtension('WEBGL_compressed_texture_astc'); + // protect for iOS 14 browser crash on function:getExtension('WEBGL_compressed_texture_astc') + if (sys.os !== sys.OS_IOS || sys.osMainVersion !== 14 || !sys.isBrowser) { + this._WEBGL_compressed_texture_astc = this.getExtension('WEBGL_compressed_texture_astc'); + } this._WEBGL_compressed_texture_s3tc = this.getExtension('WEBGL_compressed_texture_s3tc'); this._WEBGL_compressed_texture_s3tc_srgb = this.getExtension('WEBGL_compressed_texture_s3tc_srgb'); this._WEBGL_debug_shaders = this.getExtension('WEBGL_debug_shaders');