playcanvas / engine

JavaScript game engine built on WebGL, WebGPU, WebXR and glTF
https://playcanvas.com
MIT License
9.52k stars 1.33k forks source link

LayerComposition's dirty flag do not work when multiple compositions are used #3434

Closed mvaligursky closed 1 year ago

mvaligursky commented 3 years ago

Layer composition stores dirty flags:

https://github.com/playcanvas/engine/blob/8b86603a6a489ff383e3049dfb9a31f55cbe2b0d/src/scene/composition/layer-composition.js#L66-L69

Which are set by various engine systems to inform it that some parts need to be updated - which is an optimization allowing most of the updates to be skipped each frame.

When multiple layer compositions are used at the same time (main scene with the lightmapper or the picker), those dirty flags are consumed and reset by the first composition that updates, and other compositions end up not being updated correctly. This manifests itself in various ways:

mvaligursky commented 1 year ago

This is partially addressed in #5536 and #5540

mvaligursky commented 1 year ago

Final PR that should resolve this: https://github.com/playcanvas/engine/pull/5604