Merge pull request #5744 from JosJuice/remove-non-integer-irs

Remove non-integer IRs
This commit is contained in:
Leo Lam 2017-08-10 17:10:26 +08:00 committed by GitHub
commit e41a9905c0
44 changed files with 161 additions and 269 deletions

View File

@ -18,7 +18,6 @@ EmulationIssues =
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings] [Video_Settings]
EFBScale = -1
SafeTextureCacheColorSamples = 512 SafeTextureCacheColorSamples = 512
[Video_Enhancements] [Video_Enhancements]

View File

@ -21,8 +21,5 @@ EmulationIssues = Needs Efb to Ram for BBox (proper graphics).
EFBToTextureEnable = False EFBToTextureEnable = False
BBoxEnable = True BBoxEnable = True
[Video_Settings]
EFBScale = -1
[Video_Stereoscopy] [Video_Stereoscopy]
StereoConvergence = 545 StereoConvergence = 545

View File

@ -17,8 +17,5 @@ EmulationIssues =
[ActionReplay] [ActionReplay]
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings]
EFBScale = -1
[Video_Stereoscopy] [Video_Stereoscopy]
StereoConvergence = 64 StereoConvergence = 64

View File

@ -6,7 +6,7 @@
[EmuState] [EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set. # The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 4 EmulationStateId = 4
EmulationIssues = If EFB scale is not integral, serious texture glitches occur. EmulationIssues =
[OnLoad] [OnLoad]
# Add memory patches to be loaded once on boot here. # Add memory patches to be loaded once on boot here.
@ -18,7 +18,4 @@ EmulationIssues = If EFB scale is not integral, serious texture glitches occur.
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings] [Video_Settings]
EFBScale = -1
SafeTextureCacheColorSamples = 0 SafeTextureCacheColorSamples = 0

View File

@ -21,4 +21,3 @@ EmulationIssues =
UseXFB = True UseXFB = True
UseRealXFB = False UseRealXFB = False
SafeTextureCacheColorSamples = 512 SafeTextureCacheColorSamples = 512
EFBScale = -1

View File

@ -7,7 +7,7 @@ FPRF = True
[EmuState] [EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set. # The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 4 EmulationStateId = 4
EmulationIssues = EFB must be an integer (integral, 1x, 2x, 3x). EmulationIssues =
[OnLoad] [OnLoad]
# Add memory patches to be loaded once on boot here. # Add memory patches to be loaded once on boot here.
@ -19,8 +19,6 @@ EmulationIssues = EFB must be an integer (integral, 1x, 2x, 3x).
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings] [Video_Settings]
EFBScale = -1
SafeTextureCacheColorSamples = 512 SafeTextureCacheColorSamples = 512
[Video_Hacks] [Video_Hacks]

View File

@ -16,7 +16,3 @@ EmulationIssues =
[ActionReplay] [ActionReplay]
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings]
EFBScale = -1

View File

@ -7,7 +7,7 @@ SyncGPU = True
[EmuState] [EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set. # The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 4 EmulationStateId = 4
EmulationIssues = HLE music fades in and out. If EFB scale is not integral, 1x, 2x or 3x serious texture glitches occur EmulationIssues =
[OnLoad] [OnLoad]
# Add memory patches to be loaded once on boot here. # Add memory patches to be loaded once on boot here.
@ -19,5 +19,4 @@ EmulationIssues = HLE music fades in and out. If EFB scale is not integral, 1x,
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings] [Video_Settings]
EFBScale = -1
SafeTextureCacheColorSamples = 0 SafeTextureCacheColorSamples = 0

View File

@ -19,7 +19,6 @@ EmulationIssues =
[Video_Settings] [Video_Settings]
SafeTextureCacheColorSamples = 512 SafeTextureCacheColorSamples = 512
EFBScale = -1
[Video_Enhancements] [Video_Enhancements]
ForceFiltering = False ForceFiltering = False

View File

@ -6,7 +6,7 @@
[EmuState] [EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set. # The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationStateId = 4 EmulationStateId = 4
EmulationIssues = Needs integral scaling for the black lines to disappear. EmulationIssues =
[OnLoad] [OnLoad]
# Add memory patches to be loaded once on boot here. # Add memory patches to be loaded once on boot here.
@ -18,6 +18,4 @@ EmulationIssues = Needs integral scaling for the black lines to disappear.
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings] [Video_Settings]
EFBScale = -1
SafeTextureCacheColorSamples = 512 SafeTextureCacheColorSamples = 512

View File

@ -18,5 +18,4 @@ EmulationIssues = Jerky videos need safe cache.
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings] [Video_Settings]
EFBScale = -1
SafeTextureCacheColorSamples = 512 SafeTextureCacheColorSamples = 512

View File

@ -16,7 +16,3 @@ EmulationIssues =
[ActionReplay] [ActionReplay]
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings]
EFBScale = -1

View File

@ -17,9 +17,6 @@ EmulationIssues = USB Microphone not emulated
[ActionReplay] [ActionReplay]
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings]
EFBScale = -1
[Video_Enhancements] [Video_Enhancements]
MaxAnisotropy = 0 MaxAnisotropy = 0
ForceFiltering = False ForceFiltering = False

View File

@ -21,7 +21,6 @@ EmulationIssues =
UseXFB = True UseXFB = True
UseRealXFB = False UseRealXFB = False
SafeTextureCacheColorSamples = 0 SafeTextureCacheColorSamples = 0
EFBScale = -1
[Video_Hacks] [Video_Hacks]
EFBToTextureEnable = False EFBToTextureEnable = False

View File

@ -5,8 +5,8 @@
[EmuState] [EmuState]
# The Emulation State. 1 is worst, 5 is best, 0 is not set. # The Emulation State. 1 is worst, 5 is best, 0 is not set.
EmulationIssues = Skip any errors at startup and use integral efb scale.
EmulationStateId = 4 EmulationStateId = 4
EmulationIssues =
[OnLoad] [OnLoad]
# Add memory patches to be loaded once on boot here. # Add memory patches to be loaded once on boot here.
@ -18,6 +18,4 @@ EmulationStateId = 4
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings] [Video_Settings]
EFBScale = -1
SafeTextureCacheColorSamples = 512 SafeTextureCacheColorSamples = 512

View File

@ -18,7 +18,6 @@ EmulationIssues =
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings] [Video_Settings]
EFBScale = -1
SafeTextureCacheColorSamples = 512 SafeTextureCacheColorSamples = 512
[Video_Enhancements] [Video_Enhancements]

View File

@ -21,7 +21,6 @@ EmulationIssues =
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings] [Video_Settings]
EFBScale = -1
SafeTextureCacheColorSamples = 512 SafeTextureCacheColorSamples = 512
[Video_Enhancements] [Video_Enhancements]

View File

@ -17,9 +17,6 @@ EmulationIssues =
[ActionReplay] [ActionReplay]
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings]
EFBScale = -1
[Video_Enhancements] [Video_Enhancements]
MaxAnisotropy = 0 MaxAnisotropy = 0
ForceFiltering = False ForceFiltering = False

View File

@ -18,7 +18,6 @@ EmulationIssues = Enable progressive scan if the game has boot issues.
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings] [Video_Settings]
EFBScale = -1
SafeTextureCacheColorSamples = 0 SafeTextureCacheColorSamples = 0
[Video_Enhancements] [Video_Enhancements]

View File

@ -18,6 +18,5 @@ EmulationIssues = Enable progressive scan if the game has boot issues.
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings] [Video_Settings]
EFBScale = -1
SafeTextureCacheColorSamples = 0 SafeTextureCacheColorSamples = 0

View File

@ -18,7 +18,6 @@ EmulationIssues =
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings] [Video_Settings]
EFBScale = -1
SafeTextureCacheColorSamples = 512 SafeTextureCacheColorSamples = 512
[Video_Enhancements] [Video_Enhancements]

View File

@ -21,7 +21,6 @@ EmulationIssues =
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings] [Video_Settings]
EFBScale = -1
SafeTextureCacheColorSamples = 512 SafeTextureCacheColorSamples = 512
[Video_Enhancements] [Video_Enhancements]

View File

@ -17,9 +17,6 @@ EmulationIssues =
[ActionReplay] [ActionReplay]
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings]
EFBScale = -1
[Video_Enhancements] [Video_Enhancements]
MaxAnisotropy = 0 MaxAnisotropy = 0
ForceFiltering = False ForceFiltering = False

View File

@ -17,9 +17,6 @@ EmulationIssues =
[ActionReplay] [ActionReplay]
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings]
EFBScale = -1
[Video_Enhancements] [Video_Enhancements]
MaxAnisotropy = 0 MaxAnisotropy = 0
ForceFiltering = False ForceFiltering = False

View File

@ -17,9 +17,6 @@ EmulationStateId = 5
[ActionReplay] [ActionReplay]
# Add action replay cheats here. # Add action replay cheats here.
[Video_Settings]
EFBScale = -1
[Video_Hacks] [Video_Hacks]
EFBAccessEnable = False EFBAccessEnable = False

View File

@ -20,7 +20,5 @@ EmulationIssues =
[Video_Settings] [Video_Settings]
UseXFB = True UseXFB = True
UseRealXFB = False UseRealXFB = False
EFBScale = -1
SafeTextureCacheColorSamples = 512 SafeTextureCacheColorSamples = 512

View File

@ -20,7 +20,4 @@ EmulationIssues =
[Video_Settings] [Video_Settings]
UseXFB = True UseXFB = True
UseRealXFB = False UseRealXFB = False
SafeTextureCacheColorSamples = 512 SafeTextureCacheColorSamples = 512
EFBScale = -1

View File

@ -104,9 +104,7 @@
<!-- Internal Resolution Preference --> <!-- Internal Resolution Preference -->
<string-array name="internalResolutionEntries" translatable="false"> <string-array name="internalResolutionEntries" translatable="false">
<item>1x Native (640x528)</item> <item>1x Native (640x528)</item>
<item>1.5x Native (960x792)</item>
<item>2x Native (1280x1056) for 720p</item> <item>2x Native (1280x1056) for 720p</item>
<item>2.5x Native (1600x1320)</item>
<item>3x Native (1920x1584) for 1080p</item> <item>3x Native (1920x1584) for 1080p</item>
<item>4x Native (2560x2112)</item> <item>4x Native (2560x2112)</item>
<item>5x Native (3200x2640)</item> <item>5x Native (3200x2640)</item>
@ -114,9 +112,7 @@
</string-array> </string-array>
<integer-array name="internalResolutionValues" translatable="false"> <integer-array name="internalResolutionValues" translatable="false">
<item>2</item> <item>2</item>
<item>3</item>
<item>4</item> <item>4</item>
<item>5</item>
<item>6</item> <item>6</item>
<item>7</item> <item>7</item>
<item>8</item> <item>8</item>

View File

@ -4,13 +4,48 @@
#include "Core/Config/GraphicsSettings.h" #include "Core/Config/GraphicsSettings.h"
#include <optional>
#include <string> #include <string>
#include "Common/Config/Config.h" #include "Common/Config/Config.h"
#include "Common/StringUtil.h"
#include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoConfig.h"
namespace Config namespace Config
{ {
std::optional<int> ConvertFromLegacyEFBScale(int efb_scale)
{
// In game INIs, -1 was used as a special value meaning
// "use the value from the base layer but round it to an integer scale".
// We only support integer scales nowadays, so we can simply ignore -1
// in game INIs in order to automatically use a previous layer's value.
if (efb_scale < 0)
return {};
return efb_scale - (efb_scale > 0) - (efb_scale > 2) - (efb_scale > 4);
}
std::optional<int> ConvertFromLegacyEFBScale(const std::string& efb_scale)
{
int efb_scale_int;
if (!TryParse(efb_scale, &efb_scale_int))
return {};
return ConvertFromLegacyEFBScale(efb_scale_int);
}
int ConvertToLegacyEFBScale(int efb_scale)
{
return efb_scale + (efb_scale >= 0) + (efb_scale > 1) + (efb_scale > 2);
}
std::optional<int> ConvertToLegacyEFBScale(const std::string& efb_scale)
{
int efb_scale_int;
if (!TryParse(efb_scale, &efb_scale_int))
return {};
return ConvertToLegacyEFBScale(efb_scale_int);
}
// Configuration Information // Configuration Information
// Graphics.Hardware // Graphics.Hardware
@ -60,8 +95,7 @@ const ConfigInfo<bool> GFX_ENABLE_PIXEL_LIGHTING{{System::GFX, "Settings", "Enab
const ConfigInfo<bool> GFX_FAST_DEPTH_CALC{{System::GFX, "Settings", "FastDepthCalc"}, true}; const ConfigInfo<bool> GFX_FAST_DEPTH_CALC{{System::GFX, "Settings", "FastDepthCalc"}, true};
const ConfigInfo<u32> GFX_MSAA{{System::GFX, "Settings", "MSAA"}, 1}; const ConfigInfo<u32> GFX_MSAA{{System::GFX, "Settings", "MSAA"}, 1};
const ConfigInfo<bool> GFX_SSAA{{System::GFX, "Settings", "SSAA"}, false}; const ConfigInfo<bool> GFX_SSAA{{System::GFX, "Settings", "SSAA"}, false};
const ConfigInfo<int> GFX_EFB_SCALE{{System::GFX, "Settings", "EFBScale"}, const ConfigInfo<int> GFX_EFB_SCALE{{System::GFX, "Settings", "EFBScale"}, 1};
static_cast<int>(SCALE_1X)};
const ConfigInfo<bool> GFX_TEXFMT_OVERLAY_ENABLE{{System::GFX, "Settings", "TexFmtOverlayEnable"}, const ConfigInfo<bool> GFX_TEXFMT_OVERLAY_ENABLE{{System::GFX, "Settings", "TexFmtOverlayEnable"},
false}; false};
const ConfigInfo<bool> GFX_TEXFMT_OVERLAY_CENTER{{System::GFX, "Settings", "TexFmtOverlayCenter"}, const ConfigInfo<bool> GFX_TEXFMT_OVERLAY_CENTER{{System::GFX, "Settings", "TexFmtOverlayCenter"},

View File

@ -4,12 +4,18 @@
#pragma once #pragma once
#include <optional>
#include <string> #include <string>
#include "Common/Config/Config.h" #include "Common/Config/Config.h"
namespace Config namespace Config
{ {
std::optional<int> ConvertFromLegacyEFBScale(int efb_scale);
std::optional<int> ConvertFromLegacyEFBScale(const std::string& efb_scale);
int ConvertToLegacyEFBScale(int efb_scale);
std::optional<int> ConvertToLegacyEFBScale(const std::string& efb_scale);
// Configuration Information // Configuration Information
// Graphics.Hardware // Graphics.Hardware

View File

@ -17,6 +17,7 @@
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/Config/Config.h" #include "Common/Config/Config.h"
#include "Core/Config/GraphicsSettings.h"
#include "Core/ConfigLoaders/IsSettingSaveable.h" #include "Core/ConfigLoaders/IsSettingSaveable.h"
namespace ConfigLoaders namespace ConfigLoaders
@ -53,10 +54,22 @@ public:
const IniFile::Section::SectionMap& section_map = section.GetValues(); const IniFile::Section::SectionMap& section_map = section.GetValues();
for (const auto& value : section_map) for (const auto& value : section_map)
{
const Config::ConfigLocation location{system.first, section_name, value.first};
if (location == Config::GFX_EFB_SCALE.location)
{
std::optional<int> efb_scale = Config::ConvertFromLegacyEFBScale(value.second);
if (efb_scale)
config_section->Set(value.first, *efb_scale);
}
else
{
config_section->Set(value.first, value.second); config_section->Set(value.first, value.second);
} }
} }
} }
}
}
void Save(Config::Layer* config_layer) override void Save(Config::Layer* config_layer) override
{ {
@ -83,12 +96,22 @@ public:
for (const auto& value : section_values) for (const auto& value : section_values)
{ {
if (!IsSettingSaveable({system.first, section->GetName(), value.first})) const Config::ConfigLocation location{system.first, section->GetName(), value.first};
if (!IsSettingSaveable(location))
continue; continue;
if (location == Config::GFX_EFB_SCALE.location)
{
std::optional<int> efb_scale = Config::ConvertToLegacyEFBScale(value.second);
if (efb_scale)
ini_section->Set(value.first, *efb_scale);
}
else
{
ini_section->Set(value.first, value.second); ini_section->Set(value.first, value.second);
} }
} }
}
ini.Save(File::GetUserPath(mapping->second)); ini.Save(File::GetUserPath(mapping->second));
} }

View File

@ -312,9 +312,19 @@ private:
auto* config_section = auto* config_section =
config_layer->GetOrCreateSection(mapped_config.system, mapped_config.section); config_layer->GetOrCreateSection(mapped_config.system, mapped_config.section);
if (mapped_config == Config::GFX_EFB_SCALE.location)
{
std::optional<int> efb_scale = Config::ConvertFromLegacyEFBScale(value.second);
if (efb_scale)
config_section->Set(mapped_config.key, *efb_scale);
}
else
{
config_section->Set(mapped_config.key, value.second); config_section->Set(mapped_config.key, value.second);
} }
} }
}
const std::string m_id; const std::string m_id;
const u16 m_revision; const u16 m_revision;
@ -335,19 +345,28 @@ void INIGameConfigLayerLoader::Save(Config::Layer* config_layer)
{ {
for (const auto& value : section->GetValues()) for (const auto& value : section->GetValues())
{ {
if (!IsSettingSaveable({system.first, section->GetName(), value.first})) const Config::ConfigLocation location{system.first, section->GetName(), value.first};
if (!IsSettingSaveable(location))
continue; continue;
const auto ini_location = const auto ini_location = GetINILocationFromConfig(location);
GetINILocationFromConfig({system.first, section->GetName(), value.first});
if (ini_location.first.empty() && ini_location.second.empty()) if (ini_location.first.empty() && ini_location.second.empty())
continue; continue;
IniFile::Section* ini_section = ini.GetOrCreateSection(ini_location.first); IniFile::Section* ini_section = ini.GetOrCreateSection(ini_location.first);
if (location == Config::GFX_EFB_SCALE.location)
{
std::optional<int> efb_scale = Config::ConvertToLegacyEFBScale(value.second);
if (efb_scale)
ini_section->Set(ini_location.second, *efb_scale);
}
else
{
ini_section->Set(ini_location.second, value.second); ini_section->Set(ini_location.second, value.second);
} }
} }
} }
}
// Try to save to the revision specific INI first, if it exists. // Try to save to the revision specific INI first, if it exists.
const std::string gameini_with_rev = const std::string gameini_with_rev =

View File

@ -43,16 +43,15 @@ void EnhancementsWidget::CreateWidgets()
auto* enhancements_layout = new QGridLayout(); auto* enhancements_layout = new QGridLayout();
enhancements_box->setLayout(enhancements_layout); enhancements_box->setLayout(enhancements_layout);
m_ir_combo = new GraphicsChoice( m_ir_combo = new GraphicsChoice({tr("Auto (Multiple of 640x528)"), tr("Native (640x528)"),
{tr("Auto (Window Size)"), tr("Auto (Multiple of 640x528)"), tr("Native (640x528)"), tr("2x Native (1280x1056) for 720p"),
tr("1.5x Native (960x792)"), tr("2x Native (1280x1056) for 720p"), tr("3x Native (1920x1584) for 1080p"),
tr("2.5x Native (1600x1320)"), tr("3x Native (1920x1584) for 1080p"), tr("4x Native (2560x2112) for 1440p"),
tr("4x Native (2560x2112) for 1440p"), tr("5x Native (3200x2640)"), tr("5x Native (3200x2640)"), tr("6x Native (3840x3168) for 4K"),
tr("6x Native (3840x3168) for 4K"), tr("7x Native (4480x3696)"), tr("7x Native (4480x3696)"), tr("8x Native (5120x4224) for 5K")},
tr("8x Native (5120x4224) for 5K")},
Config::GFX_EFB_SCALE); Config::GFX_EFB_SCALE);
if (g_Config.iEFBScale > 11) if (g_Config.iEFBScale > 8)
{ {
m_ir_combo->addItem(tr("Custom")); m_ir_combo->addItem(tr("Custom"));
m_ir_combo->setCurrentIndex(m_ir_combo->count() - 1); m_ir_combo->setCurrentIndex(m_ir_combo->count() - 1);
@ -221,10 +220,8 @@ void EnhancementsWidget::AddDescriptions()
static const char* TR_INTERNAL_RESOLUTION_DESCRIPTION = static const char* TR_INTERNAL_RESOLUTION_DESCRIPTION =
QT_TR_NOOP("Specifies the resolution used to render at. A high resolution greatly improves " QT_TR_NOOP("Specifies the resolution used to render at. A high resolution greatly improves "
"visual quality, but also greatly increases GPU load and can cause issues in " "visual quality, but also greatly increases GPU load and can cause issues in "
"certain games.\n\"Multiple of 640x528\" will result in a size slightly larger " "certain games. Generally speaking, the lower the internal resolution is, the "
"than \"Window Size\" but yield fewer issues. Generally speaking, the lower the " "better your performance will be.\n\nIf unsure, select Native.");
"internal resolution is, the better your performance will be. Auto (Window Size), "
"1.5x, and 2.5x may cause issues in some games.\n\nIf unsure, select Native.");
static const char* TR_ANTIALIAS_DESCRIPTION = static const char* TR_ANTIALIAS_DESCRIPTION =
QT_TR_NOOP("Reduces the amount of aliasing caused by rasterizing 3D graphics. This smooths " QT_TR_NOOP("Reduces the amount of aliasing caused by rasterizing 3D graphics. This smooths "

View File

@ -207,7 +207,7 @@ void HotkeyScheduler::Run()
if (IsHotkey(HK_INCREASE_IR)) if (IsHotkey(HK_INCREASE_IR))
++g_Config.iEFBScale; ++g_Config.iEFBScale;
if (IsHotkey(HK_DECREASE_IR)) if (IsHotkey(HK_DECREASE_IR))
g_Config.iEFBScale = std::max(g_Config.iEFBScale - 1, static_cast<int>(SCALE_AUTO)); g_Config.iEFBScale = std::max(g_Config.iEFBScale - 1, EFB_SCALE_AUTO_INTEGRAL);
if (IsHotkey(HK_TOGGLE_CROP)) if (IsHotkey(HK_TOGGLE_CROP))
g_Config.bCrop = !g_Config.bCrop; g_Config.bCrop = !g_Config.bCrop;
if (IsHotkey(HK_TOGGLE_AR)) if (IsHotkey(HK_TOGGLE_AR))

View File

@ -1446,7 +1446,7 @@ void CFrame::ParseHotkeys()
if (IsHotkey(HK_DECREASE_IR)) if (IsHotkey(HK_DECREASE_IR))
{ {
OSDChoice = 1; OSDChoice = 1;
if (Config::Get(Config::GFX_EFB_SCALE) > SCALE_AUTO) if (Config::Get(Config::GFX_EFB_SCALE) > EFB_SCALE_AUTO_INTEGRAL)
Config::SetCurrent(Config::GFX_EFB_SCALE, Config::Get(Config::GFX_EFB_SCALE) - 1); Config::SetCurrent(Config::GFX_EFB_SCALE, Config::Get(Config::GFX_EFB_SCALE) - 1);
} }
if (IsHotkey(HK_TOGGLE_CROP)) if (IsHotkey(HK_TOGGLE_CROP))

View File

@ -186,10 +186,8 @@ static wxString borderless_fullscreen_desc = wxTRANSLATE(
static wxString internal_res_desc = static wxString internal_res_desc =
wxTRANSLATE("Specifies the resolution used to render at. A high resolution greatly improves " wxTRANSLATE("Specifies the resolution used to render at. A high resolution greatly improves "
"visual quality, but also greatly increases GPU load and can cause issues in " "visual quality, but also greatly increases GPU load and can cause issues in "
"certain games.\n\"Multiple of 640x528\" will result in a size slightly larger " "certain games. Generally speaking, the lower the internal resolution is, the "
"than \"Window Size\" but yield fewer issues. Generally speaking, the lower the " "better your performance will be.\n\nIf unsure, select Native.");
"internal resolution is, the better your performance will be. Auto (Window Size), "
"1.5x, and 2.5x may cause issues in some games.\n\nIf unsure, select Native.");
static wxString efb_access_desc = static wxString efb_access_desc =
wxTRANSLATE("Ignore any requests from the CPU to read from or write to the EFB.\nImproves " wxTRANSLATE("Ignore any requests from the CPU to read from or write to the EFB.\nImproves "
"performance in some games, but might disable some gameplay-related features or " "performance in some games, but might disable some gameplay-related features or "
@ -517,27 +515,20 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string& title)
// Internal resolution // Internal resolution
{ {
const wxString efbscale_choices[] = {_("Auto (Window Size)"), const wxString efbscale_choices[] = {
_("Auto (Multiple of 640x528)"), _("Auto (Multiple of 640x528)"), _("Native (640x528)"),
_("Native (640x528)"), _("2x Native (1280x1056) for 720p"), _("3x Native (1920x1584) for 1080p"),
_("1.5x Native (960x792)"), _("4x Native (2560x2112) for 1440p"), _("5x Native (3200x2640)"),
_("2x Native (1280x1056) for 720p"), _("6x Native (3840x3168) for 4K"), _("7x Native (4480x3696)"),
_("2.5x Native (1600x1320)"), _("8x Native (5120x4224) for 5K"), _("Custom")};
_("3x Native (1920x1584) for 1080p"),
_("4x Native (2560x2112) for 1440p"),
_("5x Native (3200x2640)"),
_("6x Native (3840x3168) for 4K"),
_("7x Native (4480x3696)"),
_("8x Native (5120x4224) for 5K"),
_("Custom")};
wxChoice* const choice_efbscale = CreateChoice( wxChoice* const choice_efbscale = CreateChoice(
page_enh, Config::GFX_EFB_SCALE, wxGetTranslation(internal_res_desc), page_enh, Config::GFX_EFB_SCALE, wxGetTranslation(internal_res_desc),
(vconfig.iEFBScale > 11) ? ArraySize(efbscale_choices) : ArraySize(efbscale_choices) - 1, (vconfig.iEFBScale > 8) ? ArraySize(efbscale_choices) : ArraySize(efbscale_choices) - 1,
efbscale_choices); efbscale_choices);
if (vconfig.iEFBScale > 11) if (vconfig.iEFBScale > 8)
choice_efbscale->SetSelection(12); choice_efbscale->SetSelection(9);
szr_enh->Add(new wxStaticText(page_enh, wxID_ANY, _("Internal Resolution:")), szr_enh->Add(new wxStaticText(page_enh, wxID_ANY, _("Internal Resolution:")),
wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL); wxGBPosition(row, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
@ -1120,7 +1111,7 @@ void VideoConfigDiag::OnUpdateUI(wxUpdateUIEvent& ev)
cache_hires_textures->Enable(vconfig.bHiresTextures); cache_hires_textures->Enable(vconfig.bHiresTextures);
// Vertex rounding // Vertex rounding
vertex_rounding_checkbox->Enable(vconfig.iEFBScale != SCALE_1X); vertex_rounding_checkbox->Enable(vconfig.iEFBScale != 1);
// Repopulating the post-processing shaders can't be done from an event // Repopulating the post-processing shaders can't be done from an event
if (choice_ppshader && choice_ppshader->IsEmpty()) if (choice_ppshader && choice_ppshader->IsEmpty())

View File

@ -128,10 +128,10 @@ void PSTextureEncoder::Encode(u8* dst, const EFBCopyParams& params, u32 native_w
D3D::stateman->SetPixelConstants(m_encodeParams); D3D::stateman->SetPixelConstants(m_encodeParams);
// We also linear filtering for both box filtering and downsampling higher resolutions to 1x // We also linear filtering for both box filtering and downsampling higher resolutions to 1x
// TODO: This only produces perfect downsampling for 1.5x and 2x IR, other resolution will // TODO: This only produces perfect downsampling for 2x IR, other resolutions will need more
// need more complex down filtering to average all pixels and produce the correct result. // complex down filtering to average all pixels and produce the correct result.
// Also, box filtering won't be correct for anything other than 1x IR // Also, box filtering won't be correct for anything other than 1x IR
if (scale_by_half || g_ActiveConfig.iEFBScale != SCALE_1X) if (scale_by_half || g_ActiveConfig.iEFBScale != 1)
D3D::SetLinearCopySampler(); D3D::SetLinearCopySampler();
else else
D3D::SetPointCopySampler(); D3D::SetPointCopySampler();

View File

@ -230,10 +230,10 @@ static void EncodeToRamUsingShader(GLuint srcTexture, u8* destAddr, u32 dst_line
glBindTexture(GL_TEXTURE_2D_ARRAY, srcTexture); glBindTexture(GL_TEXTURE_2D_ARRAY, srcTexture);
// We also linear filtering for both box filtering and downsampling higher resolutions to 1x // We also linear filtering for both box filtering and downsampling higher resolutions to 1x
// TODO: This only produces perfect downsampling for 1.5x and 2x IR, other resolution will // TODO: This only produces perfect downsampling for 2x IR, other resolutions will need more
// need more complex down filtering to average all pixels and produce the correct result. // complex down filtering to average all pixels and produce the correct result.
// Also, box filtering won't be correct for anything other than 1x IR // Also, box filtering won't be correct for anything other than 1x IR
if (linearFilter || g_ActiveConfig.iEFBScale != SCALE_1X) if (linearFilter || g_ActiveConfig.iEFBScale != 1)
g_sampler_cache->BindLinearSampler(9); g_sampler_cache->BindLinearSampler(9);
else else
g_sampler_cache->BindNearestSampler(9); g_sampler_cache->BindNearestSampler(9);

View File

@ -248,9 +248,9 @@ void TextureConverter::EncodeTextureToMemory(VkImageView src_texture, u8* dest_p
draw.SetPushConstants(position_uniform, sizeof(position_uniform)); draw.SetPushConstants(position_uniform, sizeof(position_uniform));
// We also linear filtering for both box filtering and downsampling higher resolutions to 1x // We also linear filtering for both box filtering and downsampling higher resolutions to 1x
// TODO: This only produces perfect downsampling for 1.5x and 2x IR, other resolution will // TODO: This only produces perfect downsampling for 2x IR, other resolutions will need more
// need more complex down filtering to average all pixels and produce the correct result. // complex down filtering to average all pixels and produce the correct result.
bool linear_filter = (scale_by_half && !params.depth) || g_ActiveConfig.iEFBScale != SCALE_1X; bool linear_filter = (scale_by_half && !params.depth) || g_ActiveConfig.iEFBScale != 1;
draw.SetPSSampler(0, src_texture, linear_filter ? g_object_cache->GetLinearSampler() : draw.SetPSSampler(0, src_texture, linear_filter ? g_object_cache->GetLinearSampler() :
g_object_cache->GetPointSampler()); g_object_cache->GetPointSampler());

View File

@ -80,8 +80,7 @@ static float AspectToWidescreen(float aspect)
} }
Renderer::Renderer(int backbuffer_width, int backbuffer_height) Renderer::Renderer(int backbuffer_width, int backbuffer_height)
: m_backbuffer_width(backbuffer_width), m_backbuffer_height(backbuffer_height), : m_backbuffer_width(backbuffer_width), m_backbuffer_height(backbuffer_height)
m_last_efb_scale(g_ActiveConfig.iEFBScale)
{ {
FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH); FramebufferManagerBase::SetLastXfbWidth(MAX_XFB_WIDTH);
FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT); FramebufferManagerBase::SetLastXfbHeight(MAX_XFB_HEIGHT);
@ -134,26 +133,12 @@ void Renderer::RenderToXFB(u32 xfbAddr, const EFBRectangle& sourceRc, u32 fbStri
int Renderer::EFBToScaledX(int x) const int Renderer::EFBToScaledX(int x) const
{ {
switch (g_ActiveConfig.iEFBScale) return x * static_cast<int>(m_efb_scale);
{
case SCALE_AUTO: // fractional
return FramebufferManagerBase::ScaleToVirtualXfbWidth(x, m_target_rectangle);
default:
return x * (int)m_efb_scale_numeratorX / (int)m_efb_scale_denominatorX;
};
} }
int Renderer::EFBToScaledY(int y) const int Renderer::EFBToScaledY(int y) const
{ {
switch (g_ActiveConfig.iEFBScale) return y * static_cast<int>(m_efb_scale);
{
case SCALE_AUTO: // fractional
return FramebufferManagerBase::ScaleToVirtualXfbHeight(y, m_target_rectangle);
default:
return y * (int)m_efb_scale_numeratorY / (int)m_efb_scale_denominatorY;
};
} }
float Renderer::EFBToScaledXf(float x) const float Renderer::EFBToScaledXf(float x) const
@ -168,88 +153,30 @@ float Renderer::EFBToScaledYf(float y) const
std::tuple<int, int> Renderer::CalculateTargetScale(int x, int y) const std::tuple<int, int> Renderer::CalculateTargetScale(int x, int y) const
{ {
if (g_ActiveConfig.iEFBScale == SCALE_AUTO || g_ActiveConfig.iEFBScale == SCALE_AUTO_INTEGRAL) return std::make_tuple(x * static_cast<int>(m_efb_scale), y * static_cast<int>(m_efb_scale));
{
return std::make_tuple(x, y);
}
const int scaled_x =
x * static_cast<int>(m_efb_scale_numeratorX) / static_cast<int>(m_efb_scale_denominatorX);
const int scaled_y =
y * static_cast<int>(m_efb_scale_numeratorY) / static_cast<int>(m_efb_scale_denominatorY);
return std::make_tuple(scaled_x, scaled_y);
} }
// return true if target size changed // return true if target size changed
bool Renderer::CalculateTargetSize() bool Renderer::CalculateTargetSize()
{ {
m_last_efb_scale = g_ActiveConfig.iEFBScale; if (g_ActiveConfig.iEFBScale == EFB_SCALE_AUTO_INTEGRAL)
int new_efb_width = 0;
int new_efb_height = 0;
// TODO: Ugly. Clean up
switch (m_last_efb_scale)
{ {
case SCALE_AUTO: // Set a scale based on the window size
case SCALE_AUTO_INTEGRAL: int width = FramebufferManagerBase::ScaleToVirtualXfbWidth(EFB_WIDTH, m_target_rectangle);
new_efb_width = FramebufferManagerBase::ScaleToVirtualXfbWidth(EFB_WIDTH, m_target_rectangle); int height = FramebufferManagerBase::ScaleToVirtualXfbHeight(EFB_HEIGHT, m_target_rectangle);
new_efb_height = m_efb_scale = std::max((width - 1) / EFB_WIDTH + 1, (height - 1) / EFB_HEIGHT + 1);
FramebufferManagerBase::ScaleToVirtualXfbHeight(EFB_HEIGHT, m_target_rectangle);
if (m_last_efb_scale == SCALE_AUTO_INTEGRAL)
{
m_efb_scale_numeratorX = m_efb_scale_numeratorY =
std::max((new_efb_width - 1) / EFB_WIDTH + 1, (new_efb_height - 1) / EFB_HEIGHT + 1);
m_efb_scale_denominatorX = m_efb_scale_denominatorY = 1;
new_efb_width = EFBToScaledX(EFB_WIDTH);
new_efb_height = EFBToScaledY(EFB_HEIGHT);
} }
else else
{ {
m_efb_scale_numeratorX = new_efb_width; m_efb_scale = g_ActiveConfig.iEFBScale;
m_efb_scale_denominatorX = EFB_WIDTH;
m_efb_scale_numeratorY = new_efb_height;
m_efb_scale_denominatorY = EFB_HEIGHT;
} }
break;
case SCALE_1X:
m_efb_scale_numeratorX = m_efb_scale_numeratorY = 1;
m_efb_scale_denominatorX = m_efb_scale_denominatorY = 1;
break;
case SCALE_1_5X:
m_efb_scale_numeratorX = m_efb_scale_numeratorY = 3;
m_efb_scale_denominatorX = m_efb_scale_denominatorY = 2;
break;
case SCALE_2X:
m_efb_scale_numeratorX = m_efb_scale_numeratorY = 2;
m_efb_scale_denominatorX = m_efb_scale_denominatorY = 1;
break;
case SCALE_2_5X:
m_efb_scale_numeratorX = m_efb_scale_numeratorY = 5;
m_efb_scale_denominatorX = m_efb_scale_denominatorY = 2;
break;
default:
m_efb_scale_numeratorX = m_efb_scale_numeratorY = m_last_efb_scale - 3;
m_efb_scale_denominatorX = m_efb_scale_denominatorY = 1;
const u32 max_size = g_ActiveConfig.backend_info.MaxTextureSize; const u32 max_size = g_ActiveConfig.backend_info.MaxTextureSize;
if (max_size < EFB_WIDTH * m_efb_scale_numeratorX / m_efb_scale_denominatorX) if (max_size < EFB_WIDTH * m_efb_scale)
{ m_efb_scale = max_size / EFB_WIDTH;
m_efb_scale_numeratorX = m_efb_scale_numeratorY = (max_size / EFB_WIDTH);
m_efb_scale_denominatorX = m_efb_scale_denominatorY = 1;
}
break; int new_efb_width = 0;
} int new_efb_height = 0;
if (m_last_efb_scale > SCALE_AUTO_INTEGRAL)
std::tie(new_efb_width, new_efb_height) = CalculateTargetScale(EFB_WIDTH, EFB_HEIGHT); std::tie(new_efb_width, new_efb_height) = CalculateTargetScale(EFB_WIDTH, EFB_HEIGHT);
if (new_efb_width != m_target_width || new_efb_height != m_target_height) if (new_efb_width != m_target_width || new_efb_height != m_target_height)
@ -383,26 +310,14 @@ void Renderer::DrawDebugText()
std::string res_text; std::string res_text;
switch (g_ActiveConfig.iEFBScale) switch (g_ActiveConfig.iEFBScale)
{ {
case SCALE_AUTO: case EFB_SCALE_AUTO_INTEGRAL:
res_text = "Auto (fractional)";
break;
case SCALE_AUTO_INTEGRAL:
res_text = "Auto (integral)"; res_text = "Auto (integral)";
break; break;
case SCALE_1X: case 1:
res_text = "Native"; res_text = "Native";
break; break;
case SCALE_1_5X:
res_text = "1.5x";
break;
case SCALE_2X:
res_text = "2x";
break;
case SCALE_2_5X:
res_text = "2.5x";
break;
default: default:
res_text = StringFromFormat("%dx", g_ActiveConfig.iEFBScale - 3); res_text = StringFromFormat("%dx", g_ActiveConfig.iEFBScale);
break; break;
} }
const char* ar_text = ""; const char* ar_text = "";
@ -648,6 +563,7 @@ void Renderer::SetWindowSize(int width, int height)
height = std::max(height, 1); height = std::max(height, 1);
// Scale the window size by the EFB scale. // Scale the window size by the EFB scale.
if (g_ActiveConfig.iEFBScale != EFB_SCALE_AUTO_INTEGRAL)
std::tie(width, height) = CalculateTargetScale(width, height); std::tie(width, height) = CalculateTargetScale(width, height);
float scaled_width, scaled_height; float scaled_width, scaled_height;

View File

@ -78,8 +78,7 @@ public:
virtual void RestoreState() {} virtual void RestoreState() {}
virtual void ResetAPIState() {} virtual void ResetAPIState() {}
virtual void RestoreAPIState() {} virtual void RestoreAPIState() {}
// Ideal internal resolution - determined by display resolution (automatic scaling) and/or a // Ideal internal resolution - multiple of the native EFB resolution
// multiple of the native EFB resolution
int GetTargetWidth() const { return m_target_width; } int GetTargetWidth() const { return m_target_width; }
int GetTargetHeight() const { return m_target_height; } int GetTargetHeight() const { return m_target_height; }
// Display resolution // Display resolution
@ -170,7 +169,6 @@ protected:
// TODO: Add functionality to reinit all the render targets when the window is resized. // TODO: Add functionality to reinit all the render targets when the window is resized.
int m_backbuffer_width = 0; int m_backbuffer_width = 0;
int m_backbuffer_height = 0; int m_backbuffer_height = 0;
int m_last_efb_scale = 0;
TargetRectangle m_target_rectangle = {}; TargetRectangle m_target_rectangle = {};
bool m_xfb_written = false; bool m_xfb_written = false;
@ -191,10 +189,7 @@ private:
void ShutdownFrameDumping(); void ShutdownFrameDumping();
PEControl::PixelFormat m_prev_efb_format = PEControl::INVALID_FMT; PEControl::PixelFormat m_prev_efb_format = PEControl::INVALID_FMT;
unsigned int m_efb_scale_numeratorX = 1; unsigned int m_efb_scale = 1;
unsigned int m_efb_scale_numeratorY = 1;
unsigned int m_efb_scale_denominatorX = 1;
unsigned int m_efb_scale_denominatorY = 1;
// These will be set on the first call to SetWindowSize. // These will be set on the first call to SetWindowSize.
int m_last_window_request_width = 0; int m_last_window_request_width = 0;

View File

@ -376,8 +376,7 @@ void VertexShaderManager::SetConstants()
// NOTE: If we ever emulate antialiasing, the sample locations set by // NOTE: If we ever emulate antialiasing, the sample locations set by
// BP registers 0x01-0x04 need to be considered here. // BP registers 0x01-0x04 need to be considered here.
const float pixel_center_correction = 7.0f / 12.0f - 0.5f; const float pixel_center_correction = 7.0f / 12.0f - 0.5f;
const bool bUseVertexRounding = const bool bUseVertexRounding = g_ActiveConfig.bVertexRounding && g_ActiveConfig.iEFBScale != 1;
g_ActiveConfig.bVertexRounding && g_ActiveConfig.iEFBScale != SCALE_1X;
const float viewport_width = bUseVertexRounding ? const float viewport_width = bUseVertexRounding ?
(2.f * xfmem.viewport.wd) : (2.f * xfmem.viewport.wd) :
g_renderer->EFBToScaledXf(2.f * xfmem.viewport.wd); g_renderer->EFBToScaledXf(2.f * xfmem.viewport.wd);

View File

@ -139,26 +139,6 @@ void VideoConfig::Refresh()
phack.m_zfar = Config::Get(Config::GFX_PROJECTION_HACK_ZFAR); phack.m_zfar = Config::Get(Config::GFX_PROJECTION_HACK_ZFAR);
bPerfQueriesEnable = Config::Get(Config::GFX_PERF_QUERIES_ENABLE); bPerfQueriesEnable = Config::Get(Config::GFX_PERF_QUERIES_ENABLE);
if (iEFBScale == SCALE_FORCE_INTEGRAL)
{
// Round down to multiple of native IR
switch (Config::GetBase(Config::GFX_EFB_SCALE))
{
case SCALE_AUTO:
iEFBScale = SCALE_AUTO_INTEGRAL;
break;
case SCALE_1_5X:
iEFBScale = SCALE_1X;
break;
case SCALE_2_5X:
iEFBScale = SCALE_2X;
break;
default:
iEFBScale = Config::GetBase(Config::GFX_EFB_SCALE);
break;
}
}
VerifyValidity(); VerifyValidity();
} }

View File

@ -22,6 +22,8 @@
#define CONF_SAVETARGETS 8 #define CONF_SAVETARGETS 8
#define CONF_SAVESHADERS 16 #define CONF_SAVESHADERS 16
constexpr int EFB_SCALE_AUTO_INTEGRAL = 0;
enum AspectMode enum AspectMode
{ {
ASPECT_AUTO = 0, ASPECT_AUTO = 0,
@ -30,17 +32,6 @@ enum AspectMode
ASPECT_STRETCH = 3, ASPECT_STRETCH = 3,
}; };
enum EFBScale
{
SCALE_FORCE_INTEGRAL = -1,
SCALE_AUTO,
SCALE_AUTO_INTEGRAL,
SCALE_1X,
SCALE_1_5X,
SCALE_2X,
SCALE_2_5X,
};
enum StereoMode enum StereoMode
{ {
STEREO_OFF = 0, STEREO_OFF = 0,
@ -252,7 +243,7 @@ struct VideoConfig final
{ {
return backend_info.bSupportsGPUTextureDecoding && bEnableGPUTextureDecoding; return backend_info.bSupportsGPUTextureDecoding && bEnableGPUTextureDecoding;
} }
bool UseVertexRounding() const { return bVertexRounding && iEFBScale != SCALE_1X; } bool UseVertexRounding() const { return bVertexRounding && iEFBScale != 1; }
u32 GetShaderCompilerThreads() const; u32 GetShaderCompilerThreads() const;
u32 GetShaderPrecompilerThreads() const; u32 GetShaderPrecompilerThreads() const;
bool CanPrecompileUberShaders() const; bool CanPrecompileUberShaders() const;