diff --git a/src/core/gpu_sw_backend.cpp b/src/core/gpu_sw_backend.cpp index 52850719..137884fc 100644 --- a/src/core/gpu_sw_backend.cpp +++ b/src/core/gpu_sw_backend.cpp @@ -96,7 +96,7 @@ GPU_SW_Backend::~GPU_SW_Backend() bool GPU_SW_Backend::Initialize(bool force_thread) { - SetUprenderScale(g_settings.gpu_resolution_scale); + SetUprenderScale(g_settings.gpu_resolution_soft_scale); return GPUBackend::Initialize(force_thread); } @@ -105,7 +105,7 @@ void GPU_SW_Backend::UpdateSettings() GPUBackend::UpdateSettings(); // invokes Sync() [inheritance style coding caveat] // function internally shortcuts out if setting is up-to-date. - SetUprenderScale(g_settings.gpu_resolution_scale); + SetUprenderScale(g_settings.gpu_resolution_soft_scale); } void GPU_SW_Backend::Reset(bool clear_vram) diff --git a/src/core/host_interface.cpp b/src/core/host_interface.cpp index 3b6195e9..842b0e3a 100644 --- a/src/core/host_interface.cpp +++ b/src/core/host_interface.cpp @@ -495,6 +495,7 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si) si.SetStringValue("GPU", "Renderer", Settings::GetRendererName(Settings::DEFAULT_GPU_RENDERER)); si.SetIntValue("GPU", "ResolutionScale", 1); + si.SetIntValue("GPU", "ResolutionSoftScale", 1); si.SetIntValue("GPU", "Multisamples", 1); si.SetBoolValue("GPU", "UseDebugDevice", false); si.SetBoolValue("GPU", "UseSoftwareRendererForReadbacks", false); @@ -623,6 +624,7 @@ void HostInterface::FixIncompatibleSettings(bool display_osd_messages) g_settings.cpu_overclock_active = false; g_settings.enable_8mb_ram = false; g_settings.gpu_resolution_scale = 1; + g_settings.gpu_resolution_soft_scale = 1; g_settings.gpu_multisamples = 1; g_settings.gpu_per_sample_shading = false; g_settings.gpu_true_color = false; @@ -776,6 +778,7 @@ void HostInterface::CheckForSettingsChanges(const Settings& old_settings) m_audio_stream->SetOutputVolume(GetAudioOutputVolume()); if (g_settings.gpu_resolution_scale != old_settings.gpu_resolution_scale || + g_settings.gpu_resolution_soft_scale != old_settings.gpu_resolution_soft_scale || g_settings.gpu_multisamples != old_settings.gpu_multisamples || g_settings.gpu_per_sample_shading != old_settings.gpu_per_sample_shading || g_settings.gpu_use_thread != old_settings.gpu_use_thread || @@ -1097,10 +1100,13 @@ void HostInterface::ModifyResolutionScale(s32 increment) { const u32 new_resolution_scale = std::clamp( static_cast(static_cast(g_settings.gpu_resolution_scale) + increment), 1, GPU::MAX_RESOLUTION_SCALE); - if (new_resolution_scale == g_settings.gpu_resolution_scale) + const u32 new_resolution_soft_scale = std::clamp( + static_cast(static_cast(g_settings.gpu_resolution_soft_scale) + increment), 1, GPU::MAX_RESOLUTION_SCALE); + if (new_resolution_scale == g_settings.gpu_resolution_scale || new_resolution_soft_scale == g_settings.gpu_resolution_soft_scale) return; g_settings.gpu_resolution_scale = new_resolution_scale; + g_settings.gpu_resolution_soft_scale = new_resolution_soft_scale; if (!System::IsShutdown()) { diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 9956d379..bb1b1cf8 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -182,6 +182,7 @@ void Settings::Load(SettingsInterface& si) .value_or(DEFAULT_GPU_RENDERER); gpu_adapter = si.GetStringValue("GPU", "Adapter", ""); gpu_resolution_scale = static_cast(si.GetIntValue("GPU", "ResolutionScale", 1)); + gpu_resolution_soft_scale = static_cast(si.GetIntValue("GPU", "ResolutionSoftScale", 1)); gpu_multisamples = static_cast(si.GetIntValue("GPU", "Multisamples", 1)); gpu_use_debug_device = si.GetBoolValue("GPU", "UseDebugDevice", false); gpu_per_sample_shading = si.GetBoolValue("GPU", "PerSampleShading", false); @@ -373,6 +374,7 @@ void Settings::Save(SettingsInterface& si) const si.SetStringValue("GPU", "Renderer", GetRendererName(gpu_renderer)); si.SetStringValue("GPU", "Adapter", gpu_adapter.c_str()); si.SetIntValue("GPU", "ResolutionScale", static_cast(gpu_resolution_scale)); + si.SetIntValue("GPU", "ResolutionSoftScale", static_cast(gpu_resolution_soft_scale)); si.SetIntValue("GPU", "Multisamples", static_cast(gpu_multisamples)); si.SetBoolValue("GPU", "UseDebugDevice", gpu_use_debug_device); si.SetBoolValue("GPU", "PerSampleShading", gpu_per_sample_shading); diff --git a/src/core/settings.h b/src/core/settings.h index a8b77a59..578fad45 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -108,6 +108,7 @@ struct Settings std::string gpu_adapter; std::string display_post_process_chain; u32 gpu_resolution_scale = 1; + u32 gpu_resolution_soft_scale = 1; u32 gpu_multisamples = 1; bool gpu_use_thread = true; bool gpu_use_software_renderer_for_readbacks = false; diff --git a/src/core/system.cpp b/src/core/system.cpp index c0f955b5..2ffc0b88 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -2258,7 +2258,7 @@ void SetCheatList(std::unique_ptr cheats) void CalculateRewindMemoryUsage(u32 num_saves, u64* ram_usage, u64* vram_usage) { *ram_usage = MAX_SAVE_STATE_SIZE * static_cast(num_saves); - *vram_usage = (VRAM_WIDTH * VRAM_HEIGHT * 4) * static_cast(std::max(g_settings.gpu_resolution_scale, 1u)) * + *vram_usage = (VRAM_WIDTH * VRAM_HEIGHT * 4) * static_cast(std::max((g_settings.gpu_renderer == GPURenderer::Software ? g_settings.gpu_resolution_soft_scale : g_settings.gpu_resolution_scale), 1u)) * static_cast(g_settings.gpu_multisamples) * static_cast(num_saves); } diff --git a/src/duckstation-libretro/libretro_core_options.h b/src/duckstation-libretro/libretro_core_options.h index bf631386..3f4ee70a 100644 --- a/src/duckstation-libretro/libretro_core_options.h +++ b/src/duckstation-libretro/libretro_core_options.h @@ -395,8 +395,8 @@ struct retro_core_option_v2_definition option_defs_us[] = { "duckstation_GPU.ResolutionScale", "Internal Resolution Scale", NULL, - "Scales internal VRAM resolution by the specified multiplier. Larger values are slower. Some games require " - "1x VRAM resolution or they will have rendering issues. Software render supports only 1x, 2x, 4x.", + "Scales internal VRAM resolution by the specified multiplier for the hardware renderer. Larger values are slower. " + " Some games require 1x VRAM resolution or they will have rendering issues.", NULL, "enhancement", { @@ -420,6 +420,24 @@ struct retro_core_option_v2_definition option_defs_us[] = { }, "1" }, + { + "duckstation_GPU.ResolutionSoftScale", + "Internal Resolution Scale (Software)", + NULL, + "Scales internal VRAM resolution by the specified multiplier for the software renderer. Larger values are slower. " + "Some games require 1x VRAM resolution or they will have rendering issues.", + NULL, + "enhancement", + { + { "1", "1x" }, +#ifndef ANDROID + { "2", "2x" }, + { "4", "4x" }, +#endif + { NULL, NULL }, + }, + "1" + }, { "duckstation_GPU.UseThread", "Threaded Rendering (Software)", diff --git a/src/duckstation-libretro/libretro_host_interface.cpp b/src/duckstation-libretro/libretro_host_interface.cpp index 90132a58..6e8cf9b2 100644 --- a/src/duckstation-libretro/libretro_host_interface.cpp +++ b/src/duckstation-libretro/libretro_host_interface.cpp @@ -484,11 +484,15 @@ bool LibretroHostInterface::retro_load_game(const struct retro_game_info* game) { option_display.key = "duckstation_GPU.UseSoftwareRendererForReadbacks"; g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + option_display.key = "duckstation_GPU.ResolutionScale"; + g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); } else { option_display.key = "duckstation_GPU.UseThread"; g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); + option_display.key = "duckstation_GPU.ResolutionSoftScale"; + g_retro_environment_callback(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display); } return true; @@ -794,6 +798,7 @@ void LibretroHostInterface::UpdateSettings() // Don't let the base class mess with the GPU. old_settings.gpu_resolution_scale = g_settings.gpu_resolution_scale; + old_settings.gpu_resolution_soft_scale = g_settings.gpu_resolution_soft_scale; } if (g_settings.gpu_renderer != old_settings.gpu_renderer)