Parcourir la source

Remove call to checkFramebufferStatus (#23770)

This is a perf hit and AFAIK there's not much reason to do the check
except to give the user an error message that the browser itself
would print.

No other place in the code calls checkFramebufferStatus so not sure
why this is special. If the framebuffer is not complete you'd be
getting rendering warnings from the browser as well.
Greggman il y a 3 ans
Parent
commit
6f1caec4b6
1 fichiers modifiés avec 3 ajouts et 11 suppressions
  1. 3 11
      src/renderers/WebGLRenderer.js

+ 3 - 11
src/renderers/WebGLRenderer.js

@@ -1984,19 +1984,11 @@ function WebGLRenderer( parameters = {} ) {
 
 				}
 
-				if ( _gl.checkFramebufferStatus( _gl.FRAMEBUFFER ) === _gl.FRAMEBUFFER_COMPLETE ) {
+				// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
 
-					// the following if statement ensures valid read requests (no out-of-bounds pixels, see #8604)
+				if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
 
-					if ( ( x >= 0 && x <= ( renderTarget.width - width ) ) && ( y >= 0 && y <= ( renderTarget.height - height ) ) ) {
-
-						_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer );
-
-					}
-
-				} else {
-
-					console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.' );
+					_gl.readPixels( x, y, width, height, utils.convert( textureFormat ), utils.convert( textureType ), buffer );
 
 				}