瀏覽代碼

Fix EXT_color_buffer_half_float check for WebGL 2

EXT_color_buffer_half_float may be supported on WebGL 2 on platforms that support 16-bit float render targets but not 32-bit float render targets.
Olli Etuaho 4 年之前
父節點
當前提交
f9a1b7fc1a
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/renderers/WebGLRenderer.js

+ 3 - 1
src/renderers/WebGLRenderer.js

@@ -1894,9 +1894,11 @@ function WebGLRenderer( parameters ) {
 
 				}
 
+				const halfFloatSupportedByExt = textureType === HalfFloatType && ( extensions.get( 'EXT_color_buffer_half_float' ) || ( capabilities.isWebGL2 && extensions.get( 'EXT_color_buffer_float' ) ) );
+
 				if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // IE11, Edge and Chrome Mac < 52 (#9513)
 					! ( textureType === FloatType && ( capabilities.isWebGL2 || extensions.get( 'OES_texture_float' ) || extensions.get( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox
-					! ( textureType === HalfFloatType && ( capabilities.isWebGL2 ? extensions.get( 'EXT_color_buffer_float' ) : extensions.get( 'EXT_color_buffer_half_float' ) ) ) ) {
+					! halfFloatSupportedByExt ) {
 
 					console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );
 					return;