瀏覽代碼

Improve WebGL 2 detection in iframes (#25733)

* adjusts to directly check the gl.constructor.name instead of instanceof

* spacing
antpb 2 年之前
父節點
當前提交
d99c79635f
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/renderers/webgl/WebGLCapabilities.js

+ 1 - 1
src/renderers/webgl/WebGLCapabilities.js

@@ -52,7 +52,7 @@ function WebGLCapabilities( gl, extensions, parameters ) {
 
 	}
 
-	const isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext;
+	const isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl.constructor.name === 'WebGL2RenderingContext';
 
 	let precision = parameters.precision !== undefined ? parameters.precision : 'highp';
 	const maxPrecision = getMaxPrecision( precision );