mirror of
https://github.com/holub/mame
synced 2025-06-06 21:03:47 +03:00
screen: remember last partial updates reset time because of scheduler time travel issue
This commit is contained in:
parent
456e2e3154
commit
56a55eb6ce
@ -555,6 +555,7 @@ screen_device::screen_device(const machine_config &mconfig, const char *tag, dev
|
|||||||
, m_curbitmap(0)
|
, m_curbitmap(0)
|
||||||
, m_curtexture(0)
|
, m_curtexture(0)
|
||||||
, m_changed(true)
|
, m_changed(true)
|
||||||
|
, m_last_partial_reset(attotime::zero)
|
||||||
, m_last_partial_scan(0)
|
, m_last_partial_scan(0)
|
||||||
, m_partial_scan_hpos(0)
|
, m_partial_scan_hpos(0)
|
||||||
, m_color(rgb_t(0xff, 0xff, 0xff, 0xff))
|
, m_color(rgb_t(0xff, 0xff, 0xff, 0xff))
|
||||||
@ -877,6 +878,7 @@ void screen_device::device_start()
|
|||||||
save_item(NAME(m_visarea.min_y));
|
save_item(NAME(m_visarea.min_y));
|
||||||
save_item(NAME(m_visarea.max_x));
|
save_item(NAME(m_visarea.max_x));
|
||||||
save_item(NAME(m_visarea.max_y));
|
save_item(NAME(m_visarea.max_y));
|
||||||
|
save_item(NAME(m_last_partial_reset));
|
||||||
save_item(NAME(m_last_partial_scan));
|
save_item(NAME(m_last_partial_scan));
|
||||||
save_item(NAME(m_frame_period));
|
save_item(NAME(m_frame_period));
|
||||||
save_item(NAME(m_brightness));
|
save_item(NAME(m_brightness));
|
||||||
@ -1169,6 +1171,14 @@ bool screen_device::update_partial(int scanline)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// skip if we already rendered this frame
|
||||||
|
// this can happen if the executing cpu timeslice is in the previous frame while scanline 0 already started
|
||||||
|
if (m_last_partial_scan == 0 && m_last_partial_reset > machine().time())
|
||||||
|
{
|
||||||
|
LOG_PARTIAL_UPDATES(("skipped because frame was already rendered\n"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// set the range of scanlines to render
|
// set the range of scanlines to render
|
||||||
rectangle clip(m_visarea);
|
rectangle clip(m_visarea);
|
||||||
clip.sety((std::max)(clip.top(), m_last_partial_scan), (std::min)(clip.bottom(), scanline));
|
clip.sety((std::max)(clip.top(), m_last_partial_scan), (std::min)(clip.bottom(), scanline));
|
||||||
@ -1279,6 +1289,14 @@ void screen_device::update_now()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// skip if we already rendered this frame
|
||||||
|
// this can happen if the executing cpu timeslice is in the previous frame while scanline 0 already started
|
||||||
|
if (m_last_partial_scan == 0 && m_partial_scan_hpos == 0 && m_last_partial_reset > machine().time())
|
||||||
|
{
|
||||||
|
LOG_PARTIAL_UPDATES(("skipped because frame was already rendered\n"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LOG_PARTIAL_UPDATES(("update_now(): Y=%d, X=%d, last partial %d, partial hpos %d (vis %d %d)\n", current_vpos, current_hpos, m_last_partial_scan, m_partial_scan_hpos, m_visarea.right(), m_visarea.bottom()));
|
LOG_PARTIAL_UPDATES(("update_now(): Y=%d, X=%d, last partial %d, partial hpos %d (vis %d %d)\n", current_vpos, current_hpos, m_last_partial_scan, m_partial_scan_hpos, m_visarea.right(), m_visarea.bottom()));
|
||||||
|
|
||||||
// start off by doing a partial update up to the line before us, in case that was necessary
|
// start off by doing a partial update up to the line before us, in case that was necessary
|
||||||
@ -1394,6 +1412,7 @@ void screen_device::update_now()
|
|||||||
|
|
||||||
void screen_device::reset_partial_updates()
|
void screen_device::reset_partial_updates()
|
||||||
{
|
{
|
||||||
|
m_last_partial_reset = machine().time();
|
||||||
m_last_partial_scan = 0;
|
m_last_partial_scan = 0;
|
||||||
m_partial_scan_hpos = 0;
|
m_partial_scan_hpos = 0;
|
||||||
m_partial_updates_this_frame = 0;
|
m_partial_updates_this_frame = 0;
|
||||||
|
@ -485,6 +485,7 @@ private:
|
|||||||
u8 m_curbitmap; // current bitmap index
|
u8 m_curbitmap; // current bitmap index
|
||||||
u8 m_curtexture; // current texture index
|
u8 m_curtexture; // current texture index
|
||||||
bool m_changed; // has this bitmap changed?
|
bool m_changed; // has this bitmap changed?
|
||||||
|
attotime m_last_partial_reset; // last time partial updates were reset
|
||||||
s32 m_last_partial_scan; // scanline of last partial update
|
s32 m_last_partial_scan; // scanline of last partial update
|
||||||
s32 m_partial_scan_hpos; // horizontal pixel last rendered on this partial scanline
|
s32 m_partial_scan_hpos; // horizontal pixel last rendered on this partial scanline
|
||||||
bitmap_argb32 m_screen_overlay_bitmap; // screen overlay bitmap
|
bitmap_argb32 m_screen_overlay_bitmap; // screen overlay bitmap
|
||||||
|
Loading…
Reference in New Issue
Block a user