Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions src/emu/screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1779,7 +1779,6 @@ bool screen_device::update_quads()
}
m_texture[m_curbitmap]->set_bitmap(m_bitmap[m_curbitmap], m_visarea, m_bitmap[m_curbitmap].texformat());
m_curtexture = m_curbitmap;
m_curbitmap = 1 - m_curbitmap;
}

// brightness adjusted render color
Expand All @@ -1791,10 +1790,30 @@ bool screen_device::update_quads()
}
}

return m_changed;
}


//-------------------------------------------------
// switch current bitmap
//-------------------------------------------------

void screen_device::switch_current_bitmap()
{
// only updated if live
if (machine().render().is_live(*this))
{
// only updated if empty and not a vector game; otherwise assume the driver did it directly
if (m_type != SCREEN_TYPE_VECTOR && (m_video_attributes & VIDEO_SELF_RENDER) == 0)
{
// if we're not skipping the frame and if the screen actually changed, then switch the bitmap
if (!machine().video().skip_this_frame() && m_changed)
m_curbitmap = 1 - m_curbitmap;
}
}

// reset the screen changed flags
bool result = m_changed;
m_changed = false;
return result;
}


Expand Down
1 change: 1 addition & 0 deletions src/emu/screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ class screen_device : public device_t

// internal to the video system
bool update_quads();
void switch_current_bitmap();
void update_burnin();

// globally accessible constants
Expand Down
17 changes: 17 additions & 0 deletions src/emu/video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ void video_manager::frame_update(bool from_debugger)
machine().osd().update(!from_debugger && skipped_it);
}

// prepare screens for next frame
if (update_screens)
post_screen_updates();

// we synchronize after rendering instead of before, if low latency mode is enabled
if (!from_debugger && phase > machine_phase::INIT && m_low_latency && effective_throttle())
update_throttle(current_time);
Expand Down Expand Up @@ -655,6 +659,19 @@ bool video_manager::finish_screen_updates()
}


//-------------------------------------------------
// post_screen_updates - prepare screens for next
// frame
//-------------------------------------------------

void video_manager::post_screen_updates()
{
screen_device_enumerator iter(machine().root_device());

for (screen_device &screen : iter)
screen.switch_current_bitmap();
}


//-------------------------------------------------
// update_throttle - throttle to the game's
Expand Down
1 change: 1 addition & 0 deletions src/emu/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class video_manager
// speed and throttling helpers
int original_speed_setting() const;
bool finish_screen_updates();
void post_screen_updates();
void update_throttle(attotime emutime);
osd_ticks_t throttle_until_ticks(osd_ticks_t target_ticks);
void update_frameskip();
Expand Down
Loading