Skip to content

Commit

Permalink
Fix EXT_color_buffer_half_float check for WebGL 2
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Oletus committed Jan 12, 2021
1 parent c1b29e1 commit f9a1b7f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f9a1b7f

Please sign in to comment.