From 1f84469cd994b950b44b84599707fecdabd65d1c Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 3 Aug 2021 10:59:10 +0200 Subject: [PATCH] filter: Fix issue with cached CullResult persisting after cleanup This can cause issues if a DR gets assigned an inactive camera - the old cull result will persist and be used for draw. Possibly we need to do this in set_camera. Reproduced by #1166 --- direct/src/filter/FilterManager.py | 2 ++ panda/src/display/displayRegion.cxx | 9 +++++++++ panda/src/display/displayRegion.h | 1 + 3 files changed, 12 insertions(+) diff --git a/direct/src/filter/FilterManager.py b/direct/src/filter/FilterManager.py index 7e76bd686a..784a2cc2b3 100644 --- a/direct/src/filter/FilterManager.py +++ b/direct/src/filter/FilterManager.py @@ -366,6 +366,8 @@ class FilterManager(DirectObject): self.camstate = self.caminit self.camera.node().setInitialState(self.caminit) self.region.setCamera(self.camera) + if hasattr(self.region, 'clearCullResult'): + self.region.clearCullResult() self.nextsort = self.win.getSort() - 1000 self.basex = 0 self.basey = 0 diff --git a/panda/src/display/displayRegion.cxx b/panda/src/display/displayRegion.cxx index 4629a38f75..cddfd2b4a5 100644 --- a/panda/src/display/displayRegion.cxx +++ b/panda/src/display/displayRegion.cxx @@ -514,6 +514,15 @@ get_screenshot() { return tex; } +/** + * + */ +void DisplayRegion:: +clear_cull_result() { + CDCullWriter cdata_cull(_cycler_cull, true); + cdata_cull->_cull_result = nullptr; +} + /** * Returns a special scene graph constructed to represent the results of the * last frame's cull operation. diff --git a/panda/src/display/displayRegion.h b/panda/src/display/displayRegion.h index 280edaa333..0aa9d2b998 100644 --- a/panda/src/display/displayRegion.h +++ b/panda/src/display/displayRegion.h @@ -160,6 +160,7 @@ PUBLISHED: bool get_screenshot(PNMImage &image); PT(Texture) get_screenshot(); + void clear_cull_result(); virtual PT(PandaNode) make_cull_result_graph(); public: