Prechádzať zdrojové kódy

display: don't render window if all its DRs are inactive

This is an optimization, which will skip begin_frame/end_frame for a buffer that isn't going to have anything rendered to it.  Affects the RenderPipeline.
rdb 7 rokov pred
rodič
commit
d902ea5ce4
1 zmenil súbory, kde vykonal 25 pridanie a 2 odobranie
  1. 25 2
      panda/src/display/graphicsOutput.cxx

+ 25 - 2
panda/src/display/graphicsOutput.cxx

@@ -412,15 +412,38 @@ is_active() const {
     return false;
   }
 
-  CDReader cdata(_cycler);
+  CDLockedReader cdata(_cycler);
+  if (!cdata->_active) {
+    return false;
+  }
+
   if (cdata->_one_shot_frame != -1) {
     // If one_shot is in effect, then we are active only for the one indicated
     // frame.
     if (cdata->_one_shot_frame != ClockObject::get_global_clock()->get_frame_count()) {
       return false;
+    } else {
+      return true;
     }
   }
-  return cdata->_active;
+
+  // If the window has a clear value set, it is active.
+  if (is_any_clear_active()) {
+    return true;
+  }
+
+  // If we triggered a copy operation, it is also active.
+  if (_trigger_copy) {
+    return true;
+  }
+
+  // The window is active if at least one display region is active.
+  if (cdata->_active_display_regions_stale) {
+    CDWriter cdataw(((GraphicsOutput *)this)->_cycler, cdata, false);
+    ((GraphicsOutput *)this)->do_determine_display_regions(cdataw);
+  }
+
+  return !cdata->_active_display_regions.empty();
 }
 
 /**