Merge pull request #5498 from iwubcode/hybrid_xfb

Hybrid xfb
This commit is contained in:
Pierre Bourdon
2017-11-19 04:58:59 +01:00
committed by GitHub
329 changed files with 2602 additions and 3736 deletions

View File

@ -20,7 +20,6 @@ HacksWidget::HacksWidget(GraphicsWindow* parent) : GraphicsWidget(parent)
CreateWidgets();
LoadSettings();
ConnectWidgets();
OnXFBToggled();
AddDescriptions();
}
@ -68,13 +67,12 @@ void HacksWidget::CreateWidgets()
auto* xfb_layout = new QGridLayout();
xfb_box->setLayout(xfb_layout);
m_disable_xfb = new GraphicsBool(tr("Disable"), Config::GFX_USE_XFB, true);
m_real_xfb = new GraphicsBoolEx(tr("Real"), Config::GFX_USE_REAL_XFB, false);
m_virtual_xfb = new GraphicsBoolEx(tr("Virtual"), Config::GFX_USE_REAL_XFB, true);
m_store_xfb_copies = new GraphicsBool(tr("Store XFB Copies to Texture Only"),
Config::GFX_HACK_SKIP_XFB_COPY_TO_RAM);
m_immediate_xfb = new GraphicsBool(tr("Immediately Present XFB"), Config::GFX_HACK_IMMEDIATE_XFB);
xfb_layout->addWidget(m_store_xfb_copies, 1, 0);
xfb_layout->addWidget(m_disable_xfb, 0, 0);
xfb_layout->addWidget(m_virtual_xfb, 0, 1);
xfb_layout->addWidget(m_real_xfb, 0, 2);
// Other
auto* other_box = new QGroupBox(tr("Other"));
auto* other_layout = new QGridLayout();
@ -101,16 +99,9 @@ void HacksWidget::CreateWidgets()
void HacksWidget::ConnectWidgets()
{
connect(m_disable_xfb, &QCheckBox::toggled, this, &HacksWidget::OnXFBToggled);
connect(m_accuracy, &QSlider::valueChanged, [this](int) { SaveSettings(); });
}
void HacksWidget::OnXFBToggled()
{
m_real_xfb->setEnabled(!m_disable_xfb->isChecked());
m_virtual_xfb->setEnabled(!m_disable_xfb->isChecked());
}
void HacksWidget::LoadSettings()
{
auto samples = Config::Get(Config::GFX_SAFE_TEXTURE_CACHE_COLOR_SAMPLES);
@ -179,20 +170,18 @@ void HacksWidget::AddDescriptions()
"from RAM.\nLower accuracies cause in-game text to appear garbled in certain "
"games.\n\nIf unsure, use the rightmost value.");
static const char* TR_DISABLE_XFB_DESCRIPTION = QT_TR_NOOP(
"Disable any XFB emulation.\nSpeeds up emulation a lot but causes heavy glitches in many "
"games "
"which rely on them (especially homebrew applications).\n\nIf unsure, leave this checked.");
static const char* TR_VIRTUAL_XFB_DESCRIPTION = QT_TR_NOOP(
"Emulate XFBs using GPU texture objects.\nFixes many games which don't work without XFB "
"emulation while not being as slow as real XFB emulation. However, it may still fail for "
"a lot "
"of other games (especially homebrew applications).\n\nIf unsure, leave this checked.");
static const char* TR_STORE_XFB_TO_TEXTURE_DESCRIPTION = QT_TR_NOOP(
"Stores XFB Copies exclusively on the GPU, bypassing system memory. Causes graphical defects "
"in a small number of games that need to readback from memory.\n\nEnabled = XFB Copies to "
"Texture\nDisabled = XFB Copies to RAM "
"(and Texture)\n\nIf unsure, leave this checked.");
static const char* TR_REAL_XFB_DESCRIPTION =
QT_TR_NOOP("Emulate XFBs accurately.\nSlows down emulation a lot and prohibits "
"high-resolution rendering but is necessary to emulate a number of games "
"properly.\n\nIf unsure, check virtual XFB emulation instead.");
static const char* TR_IMMEDIATE_XFB_DESCRIPTION =
QT_TR_NOOP("Displays the XFB copies as soon as they are created, without waiting for "
"scanout. Can cause graphical defects "
"in some games if the game doesn't expect all XFB copies to be displayed. "
"However, turning this setting on reduces latency."
"\n\nIf unsure, leave this unchecked.");
static const char* TR_GPU_DECODING_DESCRIPTION =
QT_TR_NOOP("Enables texture decoding using the GPU instead of the CPU. This may result in "
@ -215,9 +204,8 @@ void HacksWidget::AddDescriptions()
AddDescription(m_ignore_format_changes, TR_IGNORE_FORMAT_CHANGE_DESCRIPTION);
AddDescription(m_store_efb_copies, TR_STORE_EFB_TO_TEXTURE_DESCRIPTION);
AddDescription(m_accuracy, TR_ACCUARCY_DESCRIPTION);
AddDescription(m_disable_xfb, TR_DISABLE_XFB_DESCRIPTION);
AddDescription(m_virtual_xfb, TR_VIRTUAL_XFB_DESCRIPTION);
AddDescription(m_real_xfb, TR_REAL_XFB_DESCRIPTION);
AddDescription(m_store_xfb_copies, TR_STORE_XFB_TO_TEXTURE_DESCRIPTION);
AddDescription(m_immediate_xfb, TR_STORE_XFB_TO_TEXTURE_DESCRIPTION);
AddDescription(m_gpu_texture_decoding, TR_GPU_DECODING_DESCRIPTION);
AddDescription(m_fast_depth_calculation, TR_FAST_DEPTH_CALC_DESCRIPTION);
AddDescription(m_disable_bounding_box, TR_DISABLE_BOUNDINGBOX_DESCRIPTION);

View File

@ -21,8 +21,6 @@ private:
void LoadSettings() override;
void SaveSettings() override;
void OnXFBToggled();
// EFB
QCheckBox* m_skip_efb_cpu;
QCheckBox* m_ignore_format_changes;
@ -33,9 +31,8 @@ private:
QCheckBox* m_gpu_texture_decoding;
// External Framebuffer
QCheckBox* m_disable_xfb;
QRadioButton* m_virtual_xfb;
QRadioButton* m_real_xfb;
QCheckBox* m_store_xfb_copies;
QCheckBox* m_immediate_xfb;
// Other
QCheckBox* m_fast_depth_calculation;

View File

@ -38,12 +38,10 @@ void SoftwareRendererWidget::CreateWidgets()
auto* rendering_box = new QGroupBox(tr("Rendering"));
auto* rendering_layout = new QGridLayout();
m_backend_combo = new QComboBox();
m_bypass_xfb = new GraphicsBool(tr("Bypass XFB"), Config::GFX_USE_XFB, true);
rendering_box->setLayout(rendering_layout);
rendering_layout->addWidget(new QLabel(tr("Backend:")), 1, 1);
rendering_layout->addWidget(m_backend_combo, 1, 2);
rendering_layout->addWidget(m_bypass_xfb, 2, 1);
for (const auto& backend : g_available_video_backends)
m_backend_combo->addItem(tr(backend->GetDisplayName().c_str()));
@ -156,11 +154,6 @@ void SoftwareRendererWidget::AddDescriptions()
"backend, so for the best emulation experience it's recommended to try both and "
"choose the one that's less problematic.\n\nIf unsure, select OpenGL.");
static const char* TR_BYPASS_XFB_DESCRIPTION = QT_TR_NOOP(
"Disable any XFB emulation.\nSpeeds up emulation a lot but causes heavy glitches in many "
"games "
"which rely on them (especially homebrew applications).\n\nIf unsure, leave this checked.");
static const char* TR_SHOW_STATISTICS_DESCRIPTION =
QT_TR_NOOP("Show various rendering statistics.\n\nIf unsure, leave this unchecked.");
@ -169,7 +162,6 @@ void SoftwareRendererWidget::AddDescriptions()
"this unchecked.");
AddDescription(m_backend_combo, TR_BACKEND_DESCRIPTION);
AddDescription(m_bypass_xfb, TR_BYPASS_XFB_DESCRIPTION);
AddDescription(m_enable_statistics, TR_SHOW_STATISTICS_DESCRIPTION);
AddDescription(m_dump_textures, TR_DUMP_TEXTURES_DESCRIPTION);
}

View File

@ -29,7 +29,6 @@ private:
void AddDescriptions();
QComboBox* m_backend_combo;
QCheckBox* m_bypass_xfb;
QCheckBox* m_enable_statistics;
QCheckBox* m_dump_textures;
QCheckBox* m_dump_objects;

View File

@ -224,6 +224,10 @@ void HotkeyScheduler::Run()
g_Config.iAspectRatio = (g_Config.iAspectRatio + 1) & 3;
if (IsHotkey(HK_TOGGLE_EFBCOPIES))
g_Config.bSkipEFBCopyToRam = !g_Config.bSkipEFBCopyToRam;
if (IsHotkey(HK_TOGGLE_XFBCOPIES))
g_Config.bSkipXFBCopyToRam = !g_Config.bSkipXFBCopyToRam;
if (IsHotkey(HK_TOGGLE_IMMEDIATE_XFB))
g_Config.bImmediateXFB = !g_Config.bImmediateXFB;
if (IsHotkey(HK_TOGGLE_FOG))
g_Config.bDisableFog = !g_Config.bDisableFog;
if (IsHotkey(HK_TOGGLE_DUMPTEXTURES))