1
0
Fork 0
forked from suyu/suyu

Settings: eliminate rescaling_factor.

This commit is contained in:
Fernando Sahmkow 2021-07-20 18:29:52 +02:00
parent 84f2aea896
commit 71ca84d829
7 changed files with 19 additions and 37 deletions

View file

@ -48,7 +48,6 @@ void LogSettings() {
log_setting("Core_UseMultiCore", values.use_multi_core.GetValue()); log_setting("Core_UseMultiCore", values.use_multi_core.GetValue());
log_setting("CPU_Accuracy", values.cpu_accuracy.GetValue()); log_setting("CPU_Accuracy", values.cpu_accuracy.GetValue());
log_setting("Renderer_UseResolutionScaling", values.resolution_setup.GetValue()); log_setting("Renderer_UseResolutionScaling", values.resolution_setup.GetValue());
log_setting("Renderer_UseResolutionFactor", values.resolution_factor.GetValue());
log_setting("Renderer_UseSpeedLimit", values.use_speed_limit.GetValue()); log_setting("Renderer_UseSpeedLimit", values.use_speed_limit.GetValue());
log_setting("Renderer_SpeedLimit", values.speed_limit.GetValue()); log_setting("Renderer_SpeedLimit", values.speed_limit.GetValue());
log_setting("Renderer_UseDiskShaderCache", values.use_disk_shader_cache.GetValue()); log_setting("Renderer_UseDiskShaderCache", values.use_disk_shader_cache.GetValue());
@ -155,6 +154,7 @@ void UpdateRescalingInfo() {
info.down_factor = static_cast<f32>(1U << info.down_shift) / info.up_scale; info.down_factor = static_cast<f32>(1U << info.down_shift) / info.up_scale;
info.size_up = info.up_scale * info.up_scale; info.size_up = info.up_scale * info.up_scale;
info.size_shift = info.down_shift * 2; info.size_shift = info.down_shift * 2;
info.active = info.up_scale != 1 || info.down_shift != 0;
} }
void RestoreGlobalState(bool is_powered_on) { void RestoreGlobalState(bool is_powered_on) {

View file

@ -69,6 +69,7 @@ struct ResolutionScalingInfo {
f32 down_factor{1.0f}; f32 down_factor{1.0f};
u32 size_up{1}; u32 size_up{1};
u32 size_shift{0}; u32 size_shift{0};
bool active{};
}; };
/** The BasicSetting class is a simple resource manager. It defines a label and default value /** The BasicSetting class is a simple resource manager. It defines a label and default value
@ -472,7 +473,6 @@ struct Values {
ResolutionScalingInfo resolution_info{}; ResolutionScalingInfo resolution_info{};
Setting<ResolutionSetup> resolution_setup{ResolutionSetup::Res1X, "resolution_setup"}; Setting<ResolutionSetup> resolution_setup{ResolutionSetup::Res1X, "resolution_setup"};
Setting<u16> resolution_factor{1, "resolution_factor"};
// *nix platforms may have issues with the borderless windowed fullscreen mode. // *nix platforms may have issues with the borderless windowed fullscreen mode.
// Default to exclusive fullscreen on these platforms for now. // Default to exclusive fullscreen on these platforms for now.
RangedSetting<FullscreenMode> fullscreen_mode{ RangedSetting<FullscreenMode> fullscreen_mode{

View file

@ -797,15 +797,11 @@ void ICommonStateGetter::GetDefaultDisplayResolution(Kernel::HLERequestContext&
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
if (Settings::values.use_docked_mode.GetValue()) { if (Settings::values.use_docked_mode.GetValue()) {
rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth) * rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth));
static_cast<u32>(Settings::values.resolution_factor.GetValue())); rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight));
rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight) *
static_cast<u32>(Settings::values.resolution_factor.GetValue()));
} else { } else {
rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedWidth) * rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedWidth));
static_cast<u32>(Settings::values.resolution_factor.GetValue())); rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedHeight));
rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedHeight) *
static_cast<u32>(Settings::values.resolution_factor.GetValue()));
} }
} }

View file

@ -541,11 +541,8 @@ private:
switch (transaction) { switch (transaction) {
case TransactionId::Connect: { case TransactionId::Connect: {
IGBPConnectRequestParcel request{ctx.ReadBuffer()}; IGBPConnectRequestParcel request{ctx.ReadBuffer()};
IGBPConnectResponseParcel response{ IGBPConnectResponseParcel response{static_cast<u32>(DisplayResolution::UndockedWidth),
static_cast<u32>(static_cast<u32>(DisplayResolution::UndockedWidth) * static_cast<u32>(DisplayResolution::UndockedHeight)};
Settings::values.resolution_factor.GetValue()),
static_cast<u32>(static_cast<u32>(DisplayResolution::UndockedHeight) *
Settings::values.resolution_factor.GetValue())};
buffer_queue.Connect(); buffer_queue.Connect();
@ -775,15 +772,11 @@ private:
rb.Push(ResultSuccess); rb.Push(ResultSuccess);
if (Settings::values.use_docked_mode.GetValue()) { if (Settings::values.use_docked_mode.GetValue()) {
rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth) * rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedWidth));
static_cast<u32>(Settings::values.resolution_factor.GetValue())); rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight));
rb.Push(static_cast<u32>(Service::VI::DisplayResolution::DockedHeight) *
static_cast<u32>(Settings::values.resolution_factor.GetValue()));
} else { } else {
rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedWidth) * rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedWidth));
static_cast<u32>(Settings::values.resolution_factor.GetValue())); rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedHeight));
rb.Push(static_cast<u32>(Service::VI::DisplayResolution::UndockedHeight) *
static_cast<u32>(Settings::values.resolution_factor.GetValue()));
} }
rb.PushRaw<float>(60.0f); // This wouldn't seem to be correct for 30 fps games. rb.PushRaw<float>(60.0f); // This wouldn't seem to be correct for 30 fps games.
@ -1063,10 +1056,8 @@ private:
// This only returns the fixed values of 1280x720 and makes no distinguishing // This only returns the fixed values of 1280x720 and makes no distinguishing
// between docked and undocked dimensions. We take the liberty of applying // between docked and undocked dimensions. We take the liberty of applying
// the resolution scaling factor here. // the resolution scaling factor here.
rb.Push(static_cast<u64>(DisplayResolution::UndockedWidth) * rb.Push(static_cast<u64>(DisplayResolution::UndockedWidth));
static_cast<u32>(Settings::values.resolution_factor.GetValue())); rb.Push(static_cast<u64>(DisplayResolution::UndockedHeight));
rb.Push(static_cast<u64>(DisplayResolution::UndockedHeight) *
static_cast<u32>(Settings::values.resolution_factor.GetValue()));
} }
void SetLayerScalingMode(Kernel::HLERequestContext& ctx) { void SetLayerScalingMode(Kernel::HLERequestContext& ctx) {
@ -1099,8 +1090,6 @@ private:
LOG_WARNING(Service_VI, "(STUBBED) called"); LOG_WARNING(Service_VI, "(STUBBED) called");
DisplayInfo display_info; DisplayInfo display_info;
display_info.width *= static_cast<u64>(Settings::values.resolution_factor.GetValue());
display_info.height *= static_cast<u64>(Settings::values.resolution_factor.GetValue());
ctx.WriteBuffer(&display_info, sizeof(DisplayInfo)); ctx.WriteBuffer(&display_info, sizeof(DisplayInfo));
IPC::ResponseBuilder rb{ctx, 4}; IPC::ResponseBuilder rb{ctx, 4};
rb.Push(ResultSuccess); rb.Push(ResultSuccess);

View file

@ -229,8 +229,6 @@ void TelemetrySession::AddInitialInfo(Loader::AppLoader& app_loader,
AddField(field_type, "Core_UseMultiCore", Settings::values.use_multi_core.GetValue()); AddField(field_type, "Core_UseMultiCore", Settings::values.use_multi_core.GetValue());
AddField(field_type, "Renderer_Backend", AddField(field_type, "Renderer_Backend",
TranslateRenderer(Settings::values.renderer_backend.GetValue())); TranslateRenderer(Settings::values.renderer_backend.GetValue()));
AddField(field_type, "Renderer_ResolutionFactor",
Settings::values.resolution_factor.GetValue());
AddField(field_type, "Renderer_UseSpeedLimit", Settings::values.use_speed_limit.GetValue()); AddField(field_type, "Renderer_UseSpeedLimit", Settings::values.use_speed_limit.GetValue());
AddField(field_type, "Renderer_SpeedLimit", Settings::values.speed_limit.GetValue()); AddField(field_type, "Renderer_SpeedLimit", Settings::values.speed_limit.GetValue());
AddField(field_type, "Renderer_UseDiskShaderCache", AddField(field_type, "Renderer_UseDiskShaderCache",

View file

@ -53,11 +53,10 @@ std::unique_ptr<Tegra::GPU> CreateGPU(Core::Frontend::EmuWindow& emu_window, Cor
} }
} }
u16 GetResolutionScaleFactor(const RendererBase& renderer) { float GetResolutionScaleFactor(const RendererBase& renderer) {
return static_cast<u16>( return Settings::values.resolution_info.active
Settings::values.resolution_factor.GetValue() != 0 ? Settings::values.resolution_info.up_factor
? Settings::values.resolution_factor.GetValue() : renderer.GetRenderWindow().GetFramebufferLayout().GetScalingRatio();
: renderer.GetRenderWindow().GetFramebufferLayout().GetScalingRatio());
} }
} // namespace VideoCore } // namespace VideoCore

View file

@ -25,6 +25,6 @@ class RendererBase;
/// Creates an emulated GPU instance using the given system context. /// Creates an emulated GPU instance using the given system context.
std::unique_ptr<Tegra::GPU> CreateGPU(Core::Frontend::EmuWindow& emu_window, Core::System& system); std::unique_ptr<Tegra::GPU> CreateGPU(Core::Frontend::EmuWindow& emu_window, Core::System& system);
u16 GetResolutionScaleFactor(const RendererBase& renderer); float GetResolutionScaleFactor(const RendererBase& renderer);
} // namespace VideoCore } // namespace VideoCore