diff --git a/cocos/core/game.ts b/cocos/core/game.ts index 2e73e9f670..3d157ec116 100644 --- a/cocos/core/game.ts +++ b/cocos/core/game.ts @@ -754,6 +754,7 @@ class Game extends EventTarget { // WebGL context created successfully if (this.renderType === Game.RENDER_TYPE_WEBGL) { let useWebGL2 = (!!window.WebGL2RenderingContext); + const userAgent = navigator.userAgent.toLowerCase(); if (userAgent.indexOf('safari') !== -1) { if (userAgent.indexOf('chrome') === -1) { @@ -761,7 +762,7 @@ class Game extends EventTarget { } } - useWebGL2 = false; + // useWebGL2 = false; if (useWebGL2) { this._gfxDevice = new cc.WebGL2GFXDevice(); } else { diff --git a/cocos/gfx/webgl/webgl-commands.ts b/cocos/gfx/webgl/webgl-commands.ts index fc0f3243e4..4fa51f2b97 100644 --- a/cocos/gfx/webgl/webgl-commands.ts +++ b/cocos/gfx/webgl/webgl-commands.ts @@ -1437,7 +1437,9 @@ export function WebGLCmdFuncExecuteCmds (device: WebGLGFXDevice, cmdPackage: Web const gl = device.gl; const cache = device.stateCache; - cmdIds.fill(0); + for (let i = 0; i < WebGLCmd.COUNT; ++i) { + cmdIds[i] = 0; + } let gpuPipelineState: WebGLGPUPipelineState | null = null; let gpuShader: WebGLGPUShader | null = null; @@ -1620,11 +1622,13 @@ export function WebGLCmdFuncExecuteCmds (device: WebGLGFXDevice, cmdPackage: Web break; } + /* case WebGLCmd.END_RENDER_PASS: { // WebGL 1.0 doesn't support store operation of attachments. // GFXStoreOp.Store is the default GL behaviour. break; } + */ case WebGLCmd.BIND_STATES: { const cmd2 = cmdPackage.bindStatesCmds.array[cmdId]; diff --git a/cocos/gfx/webgl2/webgl2-commands.ts b/cocos/gfx/webgl2/webgl2-commands.ts index d3cc4333b3..f114350298 100644 --- a/cocos/gfx/webgl2/webgl2-commands.ts +++ b/cocos/gfx/webgl2/webgl2-commands.ts @@ -1693,7 +1693,9 @@ export function WebGL2CmdFuncExecuteCmds (device: WebGL2GFXDevice, cmdPackage: W const gl = device.gl; const cache = device.stateCache; - cmdIds.fill(0); + for (let i = 0; i < WebGL2Cmd.COUNT; ++i) { + cmdIds[i] = 0; + } let gpuPipelineState: WebGL2GPUPipelineState | null = null; let gpuShader: WebGL2GPUShader | null = null;