From c1aa445aa7cd57d53568a9fe56812e647bca55bf Mon Sep 17 00:00:00 2001 From: Martin Valigursky <59932779+mvaligursky@users.noreply.github.com> Date: Fri, 1 Dec 2023 16:14:42 +0000 Subject: [PATCH] [Fix] Framebuffer clear flags on the Layer were not correctly used (#5875) Co-authored-by: Martin Valigursky --- src/scene/composition/layer-composition.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/scene/composition/layer-composition.js b/src/scene/composition/layer-composition.js index 434cb8ce6ea..ac7a53e7569 100644 --- a/src/scene/composition/layer-composition.js +++ b/src/scene/composition/layer-composition.js @@ -314,9 +314,10 @@ class LayerComposition extends EventHandler { // clear flags - use camera clear flags in the first render action for each camera, // or when render target (from layer) was not yet cleared by this camera - const needsClear = cameraFirstRenderAction || !used; - if (needsClear) { - renderAction.setupClears(needsClear ? camera : undefined, layer); + const needsCameraClear = cameraFirstRenderAction || !used; + const needsLayerClear = layer.clearColorBuffer || layer.clearDepthBuffer || layer.clearStencilBuffer; + if (needsCameraClear || needsLayerClear) { + renderAction.setupClears(needsCameraClear ? camera : undefined, layer); } return renderAction;