mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 13:55:38 +00:00
System: Fix incorrect rewind VRAM estimation
This commit is contained in:
parent
9e82c18559
commit
e6be0532cb
|
@ -3155,6 +3155,7 @@ void FullscreenUI::DrawEmulationSettingsPage()
|
|||
}
|
||||
else if (rewind_enabled)
|
||||
{
|
||||
const u32 resolution_scale = GetEffectiveUIntSetting(bsi, "GPU", "ResolutionScale", 1);
|
||||
const float rewind_frequency = GetEffectiveFloatSetting(bsi, "Main", "RewindFrequency", 10.0f);
|
||||
const s32 rewind_save_slots = GetEffectiveIntSetting(bsi, "Main", "RewindSaveSlots", 10);
|
||||
const float duration =
|
||||
|
@ -3162,7 +3163,7 @@ void FullscreenUI::DrawEmulationSettingsPage()
|
|||
static_cast<float>(rewind_save_slots);
|
||||
|
||||
u64 ram_usage, vram_usage;
|
||||
System::CalculateRewindMemoryUsage(rewind_save_slots, &ram_usage, &vram_usage);
|
||||
System::CalculateRewindMemoryUsage(rewind_save_slots, resolution_scale, &ram_usage, &vram_usage);
|
||||
rewind_summary.format(
|
||||
FSUI_FSTR("Rewind for {0} frames, lasting {1:.2f} seconds will require up to {2} MB of RAM and {3} MB of VRAM."),
|
||||
rewind_save_slots, duration, ram_usage / 1048576, vram_usage / 1048576);
|
||||
|
|
|
@ -3844,10 +3844,11 @@ void System::LogUnsafeSettingsToConsole(const std::string& messages)
|
|||
Log_WarningPrint(console_messages.c_str());
|
||||
}
|
||||
|
||||
void System::CalculateRewindMemoryUsage(u32 num_saves, u64* ram_usage, u64* vram_usage)
|
||||
void System::CalculateRewindMemoryUsage(u32 num_saves, u32 resolution_scale, u64* ram_usage, u64* vram_usage)
|
||||
{
|
||||
const u64 real_resolution_scale = static_cast<u64>(std::max(g_settings.gpu_resolution_scale, 1u));
|
||||
*ram_usage = MAX_SAVE_STATE_SIZE * static_cast<u64>(num_saves);
|
||||
*vram_usage = (VRAM_WIDTH * VRAM_HEIGHT * 4) * static_cast<u64>(std::max(g_settings.gpu_resolution_scale, 1u)) *
|
||||
*vram_usage = ((VRAM_WIDTH * real_resolution_scale) * (VRAM_HEIGHT * real_resolution_scale) * 4) *
|
||||
static_cast<u64>(g_settings.gpu_multisamples) * static_cast<u64>(num_saves);
|
||||
}
|
||||
|
||||
|
@ -3869,7 +3870,7 @@ void System::UpdateMemorySaveStateSettings()
|
|||
s_rewind_save_counter = 0;
|
||||
|
||||
u64 ram_usage, vram_usage;
|
||||
CalculateRewindMemoryUsage(g_settings.rewind_save_slots, &ram_usage, &vram_usage);
|
||||
CalculateRewindMemoryUsage(g_settings.rewind_save_slots, g_settings.gpu_resolution_scale, &ram_usage, &vram_usage);
|
||||
Log_InfoPrintf(
|
||||
"Rewind is enabled, saving every %d frames, with %u slots and %" PRIu64 "MB RAM and %" PRIu64 "MB VRAM usage",
|
||||
std::max(s_rewind_save_frequency, 1), g_settings.rewind_save_slots, ram_usage / 1048576, vram_usage / 1048576);
|
||||
|
|
|
@ -472,7 +472,7 @@ void InvalidateDisplay();
|
|||
//////////////////////////////////////////////////////////////////////////
|
||||
// Memory Save States (Rewind and Runahead)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CalculateRewindMemoryUsage(u32 num_saves, u64* ram_usage, u64* vram_usage);
|
||||
void CalculateRewindMemoryUsage(u32 num_saves, u32 resolution_scale, u64* ram_usage, u64* vram_usage);
|
||||
void ClearMemorySaveStates();
|
||||
void UpdateMemorySaveStateSettings();
|
||||
bool LoadRewindState(u32 skip_saves = 0, bool consume_state = true);
|
||||
|
|
|
@ -183,13 +183,14 @@ void EmulationSettingsWidget::updateRewind()
|
|||
|
||||
if (!runahead_enabled && rewind_enabled)
|
||||
{
|
||||
const u32 resolution_scale = static_cast<u32>(m_dialog->getEffectiveIntValue("GPU", "ResolutionScale", 1));
|
||||
const u32 frames = static_cast<u32>(m_ui.rewindSaveSlots->value());
|
||||
const float frequency = static_cast<float>(m_ui.rewindSaveFrequency->value());
|
||||
const float duration =
|
||||
((frequency <= std::numeric_limits<float>::epsilon()) ? (1.0f / 60.0f) : frequency) * static_cast<float>(frames);
|
||||
|
||||
u64 ram_usage, vram_usage;
|
||||
System::CalculateRewindMemoryUsage(frames, &ram_usage, &vram_usage);
|
||||
System::CalculateRewindMemoryUsage(frames, resolution_scale, &ram_usage, &vram_usage);
|
||||
|
||||
m_ui.rewindSummary->setText(
|
||||
tr("Rewind for %n frame(s), lasting %1 second(s) will require up to %2MB of RAM and %3MB of VRAM.", "", frames)
|
||||
|
|
Loading…
Reference in a new issue