Browse Source

WebGLRenderer: Release cache at the end of .render(). (#14946)

* Release _currentCamera at the end of .render()

* Move cache reset for next frame to the end of .render()

* Update WebGLRenderer.js

Clean up.

* Update WebGLRenderer.js

Clean up.

Co-authored-by: Michael Herzog <[email protected]>
Takahiro 4 years ago
parent
commit
5f8ef89092
1 changed files with 4 additions and 6 deletions
  1. 4 6
      src/renderers/WebGLRenderer.js

+ 4 - 6
src/renderers/WebGLRenderer.js

@@ -989,12 +989,6 @@ function WebGLRenderer( parameters ) {
 
 		if ( _isContextLost === true ) return;
 
-		// reset caching for this frame
-
-		bindingStates.resetDefaultState();
-		_currentMaterialId = - 1;
-		_currentCamera = null;
-
 		// update scene graph
 
 		if ( scene.autoUpdate === true ) scene.updateMatrixWorld();
@@ -1101,6 +1095,10 @@ function WebGLRenderer( parameters ) {
 
 		// _gl.finish();
 
+		bindingStates.resetDefaultState();
+		_currentMaterialId = - 1;
+		_currentCamera = null;
+
 		renderStateStack.pop();
 
 		if ( renderStateStack.length > 0 ) {