mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-23 06:15:38 +00:00
GPU: Add a helper function to determine how many GPU ticks are pending
This commit is contained in:
parent
635ab72b37
commit
6b9c6d3750
|
@ -408,10 +408,16 @@ void GPU::UpdateCRTCConfig()
|
|||
cs.visible_display_height - cs.active_display_height - cs.active_display_top);
|
||||
}
|
||||
|
||||
static TickCount GPUTicksToSystemTicks(u32 gpu_ticks)
|
||||
static TickCount GPUTicksToSystemTicks(TickCount gpu_ticks)
|
||||
{
|
||||
// convert to master clock, rounding up as we want to overshoot not undershoot
|
||||
return (gpu_ticks * 7 + 10) / 11;
|
||||
return static_cast<TickCount>((static_cast<u32>(gpu_ticks) * 7u + 10u) / 11u);
|
||||
}
|
||||
|
||||
TickCount GPU::GetPendingGPUTicks() const
|
||||
{
|
||||
const TickCount pending_sysclk_ticks = m_tick_event->GetTicksSinceLastExecution();
|
||||
return ((pending_sysclk_ticks * 11) + m_crtc_state.fractional_ticks) / 7;
|
||||
}
|
||||
|
||||
void GPU::UpdateSliceTicks()
|
||||
|
|
|
@ -307,6 +307,9 @@ protected:
|
|||
// Ticks for hblank/vblank.
|
||||
void Execute(TickCount ticks);
|
||||
|
||||
/// Returns the number of pending GPU ticks.
|
||||
TickCount GetPendingGPUTicks() const;
|
||||
|
||||
/// Returns true if scanout should be interlaced.
|
||||
bool IsDisplayInterlaced() const { return !m_force_progressive_scan && m_GPUSTAT.In480iMode(); }
|
||||
|
||||
|
|
Loading…
Reference in a new issue