Skip to content

Commit d902ea5

Browse files
committed
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.
1 parent e759a1b commit d902ea5

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

panda/src/display/graphicsOutput.cxx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,15 +412,38 @@ is_active() const {
412412
return false;
413413
}
414414

415-
CDReader cdata(_cycler);
415+
CDLockedReader cdata(_cycler);
416+
if (!cdata->_active) {
417+
return false;
418+
}
419+
416420
if (cdata->_one_shot_frame != -1) {
417421
// If one_shot is in effect, then we are active only for the one indicated
418422
// frame.
419423
if (cdata->_one_shot_frame != ClockObject::get_global_clock()->get_frame_count()) {
420424
return false;
425+
} else {
426+
return true;
421427
}
422428
}
423-
return cdata->_active;
429+
430+
// If the window has a clear value set, it is active.
431+
if (is_any_clear_active()) {
432+
return true;
433+
}
434+
435+
// If we triggered a copy operation, it is also active.
436+
if (_trigger_copy) {
437+
return true;
438+
}
439+
440+
// The window is active if at least one display region is active.
441+
if (cdata->_active_display_regions_stale) {
442+
CDWriter cdataw(((GraphicsOutput *)this)->_cycler, cdata, false);
443+
((GraphicsOutput *)this)->do_determine_display_regions(cdataw);
444+
}
445+
446+
return !cdata->_active_display_regions.empty();
424447
}
425448

426449
/**

0 commit comments

Comments
 (0)