add sync-flip

This commit is contained in:
David Rose 2007-07-14 05:48:47 +00:00
parent 57cbc60935
commit ed353d83f8
3 changed files with 32 additions and 1 deletions

View File

@ -80,6 +80,14 @@ ConfigVariableBool auto_flip
"time, while setting it false can get a better frame rate as more "
"is achieved in parallel with the graphics card."));
ConfigVariableBool sync_flip
("sync-flip", false,
PRC_DESC("Set this true to attempt to flip all windows at the same time, "
"or false to flip each window as late as possible. Setting this "
"false can improve parallelization. This is a temporary "
"variable; it will later be replaced with a more explicit control "
"over synchronizing window flip."));
ConfigVariableBool yield_timeslice
("yield-timeslice", false,
PRC_DESC("Set this true to yield the timeslice at the end of the frame to be "

View File

@ -43,6 +43,7 @@ extern EXPCL_PANDA ConfigVariableBool pstats_unused_states;
extern EXPCL_PANDA ConfigVariableString threading_model;
extern EXPCL_PANDA ConfigVariableBool allow_nonpipeline_threads;
extern EXPCL_PANDA ConfigVariableBool auto_flip;
extern EXPCL_PANDA ConfigVariableBool sync_flip;
extern EXPCL_PANDA ConfigVariableBool yield_timeslice;
extern EXPCL_PANDA ConfigVariableString screenshot_filename;

View File

@ -614,7 +614,7 @@ render_frame() {
do_resort_windows();
}
if (_flip_state != FS_flip) {
if (sync_flip && _flip_state != FS_flip) {
do_flip_frame(current_thread);
}
@ -1037,6 +1037,17 @@ cull_and_draw_together(const GraphicsEngine::Windows &wlist,
for (wi = wlist.begin(); wi != wlist.end(); ++wi) {
GraphicsOutput *win = (*wi);
if (win->is_active() && win->get_gsg()->is_active()) {
if (win->flip_ready()) {
{
PStatTimer timer(GraphicsEngine::_flip_begin_pcollector, current_thread);
win->begin_flip();
}
{
PStatTimer timer(GraphicsEngine::_flip_end_pcollector, current_thread);
win->end_flip();
}
}
if (win->begin_frame(GraphicsOutput::FM_render, current_thread)) {
win->clear(current_thread);
@ -1233,6 +1244,17 @@ draw_bins(const GraphicsEngine::Windows &wlist, Thread *current_thread) {
for (wi = wlist.begin(); wi != wlist.end(); ++wi) {
GraphicsOutput *win = (*wi);
if (win->is_active() && win->get_gsg()->is_active()) {
if (win->flip_ready()) {
{
PStatTimer timer(GraphicsEngine::_flip_begin_pcollector, current_thread);
win->begin_flip();
}
{
PStatTimer timer(GraphicsEngine::_flip_end_pcollector, current_thread);
win->end_flip();
}
}
PStatTimer timer(win->get_draw_window_pcollector(), current_thread);
if (win->begin_frame(GraphicsOutput::FM_render, current_thread)) {
win->clear(current_thread);