GPU/TextureCache: Add 'Always Track Uploads' option
This commit is contained in:
parent
a8361f985e
commit
9e04b0bf55
|
@ -4640,21 +4640,23 @@ void FullscreenUI::DrawGraphicsSettingsPage()
|
|||
|
||||
MenuHeading(FSUI_CSTR("Texture Replacements"));
|
||||
|
||||
ActiveButton(FSUI_CSTR("The texture cache is currently experimental, and may cause rendering errors in some games."),
|
||||
false, false, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, UIStyle.LargeFont);
|
||||
|
||||
const bool texture_cache_enabled = GetEffectiveBoolSetting(bsi, "GPU", "EnableTextureCache", false);
|
||||
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_ID_BADGE, "Enable Texture Cache"),
|
||||
FSUI_CSTR("Enables caching of guest textures, required for texture replacement."), "GPU",
|
||||
"EnableTextureCache", false);
|
||||
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_VIDEO, "Use Old MDEC Routines"),
|
||||
FSUI_CSTR("Enables the older, less accurate MDEC decoding routines. May be required for old "
|
||||
"replacement backgrounds to match/load."),
|
||||
"Hacks", "UseOldMDECRoutines", false);
|
||||
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_TASKS, "Preload Replacement Textures"),
|
||||
FSUI_CSTR("Loads all replacement texture to RAM, reducing stuttering at runtime."),
|
||||
"TextureReplacements", "PreloadTextures", false,
|
||||
((texture_cache_enabled &&
|
||||
GetEffectiveBoolSetting(bsi, "TextureReplacements", "EnableTextureReplacements", false)) ||
|
||||
GetEffectiveBoolSetting(bsi, "TextureReplacements", "EnableVRAMWriteReplacements", false)));
|
||||
|
||||
const bool texture_cache_enabled = GetEffectiveBoolSetting(bsi, "GPU", "EnableTextureCache", false);
|
||||
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_FILE_IMPORT, "Enable Texture Replacements"),
|
||||
FSUI_CSTR("Enables loading of replacement textures. Not compatible with all games."),
|
||||
"TextureReplacements", "EnableTextureReplacements", false, texture_cache_enabled);
|
||||
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_LIST, "Always Track Uploads"),
|
||||
FSUI_CSTR("Forces texture upload tracking to be enabled regardless of whether it is needed."),
|
||||
"TextureReplacements", "AlwaysTrackUploads", false, texture_cache_enabled);
|
||||
DrawToggleSetting(
|
||||
bsi, FSUI_ICONSTR(ICON_FA_FILE_EXPORT, "Enable Texture Dumping"),
|
||||
FSUI_CSTR("Enables dumping of textures to image files, which can be replaced. Not compatible with all games."),
|
||||
|
@ -4667,17 +4669,13 @@ void FullscreenUI::DrawGraphicsSettingsPage()
|
|||
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_FILE_ALT, "Enable VRAM Write Replacement"),
|
||||
FSUI_CSTR("Enables the replacement of background textures in supported games."),
|
||||
"TextureReplacements", "EnableVRAMWriteReplacements", false);
|
||||
|
||||
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_FILE_INVOICE, "Enable VRAM Write Dumping"),
|
||||
FSUI_CSTR("Writes backgrounds that can be replaced to the dump directory."), "TextureReplacements",
|
||||
"DumpVRAMWrites", false);
|
||||
|
||||
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_TASKS, "Preload Replacement Textures"),
|
||||
FSUI_CSTR("Loads all replacement texture to RAM, reducing stuttering at runtime."),
|
||||
"TextureReplacements", "PreloadTextures", false,
|
||||
((texture_cache_enabled &&
|
||||
GetEffectiveBoolSetting(bsi, "TextureReplacements", "EnableTextureReplacements", false)) ||
|
||||
GetEffectiveBoolSetting(bsi, "TextureReplacements", "EnableVRAMWriteReplacements", false)));
|
||||
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_VIDEO, "Use Old MDEC Routines"),
|
||||
FSUI_CSTR("Enables the older, less accurate MDEC decoding routines. May be required for old "
|
||||
"replacement backgrounds to match/load."),
|
||||
"Hacks", "UseOldMDECRoutines", false);
|
||||
|
||||
DrawFolderSetting(bsi, FSUI_ICONSTR(ICON_FA_FOLDER, "Textures Directory"), "Folders", "Textures",
|
||||
EmuFolders::Textures);
|
||||
|
|
|
@ -564,6 +564,9 @@ bool GPUTextureCache::ShouldTrackVRAMWrites()
|
|||
if (!g_gpu_settings.gpu_texture_cache)
|
||||
return false;
|
||||
|
||||
if (g_gpu_settings.texture_replacements.always_track_uploads)
|
||||
return true;
|
||||
|
||||
#ifdef ALWAYS_TRACK_VRAM_WRITES
|
||||
return true;
|
||||
#else
|
||||
|
@ -592,20 +595,7 @@ bool GPUTextureCache::Initialize(GPU_HW* backend)
|
|||
|
||||
void GPUTextureCache::UpdateSettings(bool use_texture_cache, const GPUSettings& old_settings)
|
||||
{
|
||||
if (use_texture_cache)
|
||||
{
|
||||
UpdateVRAMTrackingState();
|
||||
|
||||
if (g_gpu_settings.texture_replacements.enable_texture_replacements !=
|
||||
old_settings.texture_replacements.enable_texture_replacements)
|
||||
{
|
||||
Invalidate();
|
||||
|
||||
DestroyPipelines();
|
||||
if (!CompilePipelines()) [[unlikely]]
|
||||
Panic("Failed to compile pipelines on TC settings change");
|
||||
}
|
||||
}
|
||||
const bool prev_tracking_state = s_state.track_vram_writes;
|
||||
|
||||
// Reload textures if configuration changes.
|
||||
const bool old_replacement_scale_linear_filter = s_state.config.replacement_scale_linear_filter;
|
||||
|
@ -617,8 +607,11 @@ void GPUTextureCache::UpdateSettings(bool use_texture_cache, const GPUSettings&
|
|||
{
|
||||
if (use_texture_cache)
|
||||
{
|
||||
if (s_state.config.replacement_scale_linear_filter != old_replacement_scale_linear_filter)
|
||||
if (g_gpu_settings.texture_replacements.enable_texture_replacements !=
|
||||
old_settings.texture_replacements.enable_texture_replacements ||
|
||||
s_state.config.replacement_scale_linear_filter != old_replacement_scale_linear_filter)
|
||||
{
|
||||
DestroyPipelines();
|
||||
if (!CompilePipelines()) [[unlikely]]
|
||||
Panic("Failed to compile pipelines on TC replacement settings change");
|
||||
}
|
||||
|
@ -626,6 +619,11 @@ void GPUTextureCache::UpdateSettings(bool use_texture_cache, const GPUSettings&
|
|||
|
||||
ReloadTextureReplacements(false);
|
||||
}
|
||||
|
||||
UpdateVRAMTrackingState();
|
||||
|
||||
if (s_state.track_vram_writes != prev_tracking_state)
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
bool GPUTextureCache::GetStateSize(StateWrapper& sw, u32* size)
|
||||
|
|
|
@ -438,6 +438,7 @@ void Settings::Load(const SettingsInterface& si, const SettingsInterface& contro
|
|||
si.GetBoolValue("TextureReplacements", "EnableTextureReplacements", false);
|
||||
texture_replacements.enable_vram_write_replacements =
|
||||
si.GetBoolValue("TextureReplacements", "EnableVRAMWriteReplacements", false);
|
||||
texture_replacements.always_track_uploads = si.GetBoolValue("TextureReplacements", "AlwaysTrackUploads", false);
|
||||
texture_replacements.preload_textures = si.GetBoolValue("TextureReplacements", "PreloadTextures", false);
|
||||
texture_replacements.dump_textures = si.GetBoolValue("TextureReplacements", "DumpTextures", false);
|
||||
texture_replacements.dump_replaced_textures = si.GetBoolValue("TextureReplacements", "DumpReplacedTextures", true);
|
||||
|
@ -713,6 +714,7 @@ void Settings::Save(SettingsInterface& si, bool ignore_base) const
|
|||
si.SetBoolValue("TextureReplacements", "EnableTextureReplacements", texture_replacements.enable_texture_replacements);
|
||||
si.SetBoolValue("TextureReplacements", "EnableVRAMWriteReplacements",
|
||||
texture_replacements.enable_vram_write_replacements);
|
||||
si.SetBoolValue("TextureReplacements", "AlwaysTrackUploads", texture_replacements.always_track_uploads);
|
||||
si.SetBoolValue("TextureReplacements", "PreloadTextures", texture_replacements.preload_textures);
|
||||
si.SetBoolValue("TextureReplacements", "DumpVRAMWrites", texture_replacements.dump_vram_writes);
|
||||
si.SetBoolValue("TextureReplacements", "DumpTextures", texture_replacements.dump_textures);
|
||||
|
@ -819,9 +821,9 @@ bool Settings::TextureReplacementSettings::operator==(const TextureReplacementSe
|
|||
{
|
||||
return (enable_texture_replacements == rhs.enable_texture_replacements &&
|
||||
enable_vram_write_replacements == rhs.enable_vram_write_replacements &&
|
||||
preload_textures == rhs.preload_textures && dump_textures == rhs.dump_textures &&
|
||||
dump_replaced_textures == rhs.dump_replaced_textures && dump_vram_writes == rhs.dump_vram_writes &&
|
||||
config == rhs.config);
|
||||
always_track_uploads == rhs.always_track_uploads && preload_textures == rhs.preload_textures &&
|
||||
dump_textures == rhs.dump_textures && dump_replaced_textures == rhs.dump_replaced_textures &&
|
||||
dump_vram_writes == rhs.dump_vram_writes && config == rhs.config);
|
||||
}
|
||||
|
||||
bool Settings::TextureReplacementSettings::operator!=(const TextureReplacementSettings& rhs) const
|
||||
|
|
|
@ -192,6 +192,7 @@ struct GPUSettings
|
|||
|
||||
bool enable_texture_replacements : 1 = false;
|
||||
bool enable_vram_write_replacements : 1 = false;
|
||||
bool always_track_uploads : 1 = false;
|
||||
bool preload_textures : 1 = false;
|
||||
|
||||
bool dump_textures : 1 = false;
|
||||
|
|
|
@ -4431,6 +4431,8 @@ void System::CheckForSettingsChanges(const Settings& old_settings)
|
|||
old_settings.texture_replacements.enable_texture_replacements ||
|
||||
g_settings.texture_replacements.enable_vram_write_replacements !=
|
||||
old_settings.texture_replacements.enable_vram_write_replacements ||
|
||||
g_settings.texture_replacements.always_track_uploads !=
|
||||
old_settings.texture_replacements.always_track_uploads ||
|
||||
g_settings.texture_replacements.dump_textures != old_settings.texture_replacements.dump_textures ||
|
||||
g_settings.texture_replacements.config != old_settings.texture_replacements.config)
|
||||
{
|
||||
|
|
|
@ -244,13 +244,13 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget*
|
|||
// Texture Replacements Tab
|
||||
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableTextureCache, "GPU", "EnableTextureCache", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.useOldMDECRoutines, "Hacks", "UseOldMDECRoutines", false);
|
||||
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableTextureReplacements, "TextureReplacements",
|
||||
"EnableTextureReplacements", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.preloadTextureReplacements, "TextureReplacements",
|
||||
"PreloadTextures", false);
|
||||
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableTextureReplacements, "TextureReplacements",
|
||||
"EnableTextureReplacements", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.alwaysTrackUploads, "TextureReplacements",
|
||||
"AlwaysTrackUploads", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableTextureDumping, "TextureReplacements", "DumpTextures",
|
||||
false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.dumpReplacedTextures, "TextureReplacements",
|
||||
|
@ -259,6 +259,7 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget*
|
|||
"EnableVRAMWriteReplacements", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.vramWriteDumping, "TextureReplacements", "DumpVRAMWrites",
|
||||
false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.useOldMDECRoutines, "Hacks", "UseOldMDECRoutines", false);
|
||||
|
||||
if (!m_dialog->isPerGameSettings())
|
||||
{
|
||||
|
@ -587,16 +588,20 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget*
|
|||
"separate two pairs from each other.</b><br>For example: \"compression_level = 4 : joint_stereo = 1\""));
|
||||
|
||||
// Texture Replacements Tab
|
||||
dialog->registerWidgetHelp(m_ui.enableTextureCache, tr("Enable Texture Cache"), tr("Unchecked"),
|
||||
tr("Enables caching of guest textures, required for texture replacement."));
|
||||
dialog->registerWidgetHelp(m_ui.useOldMDECRoutines, tr("Use Old MDEC Routines"), tr("Unchecked"),
|
||||
tr("Enables the older, less accurate MDEC decoding routines. May be required for old "
|
||||
"replacement backgrounds to match/load."));
|
||||
dialog->registerWidgetHelp(
|
||||
m_ui.enableTextureCache, tr("Enable Texture Cache"), tr("Unchecked"),
|
||||
tr("Enables caching of guest textures, required for texture replacement. <strong>The texture cache is currently "
|
||||
"experimental, and may cause rendering errors in some games.</strong>"));
|
||||
dialog->registerWidgetHelp(m_ui.preloadTextureReplacements, tr("Preload Texture Replacements"), tr("Unchecked"),
|
||||
tr("Loads all replacement texture to RAM, reducing stuttering at runtime."));
|
||||
|
||||
dialog->registerWidgetHelp(m_ui.enableTextureReplacements, tr("Enable Texture Replacements"), tr("Unchecked"),
|
||||
tr("Enables loading of replacement textures. Not compatible with all games."));
|
||||
dialog->registerWidgetHelp(m_ui.preloadTextureReplacements, tr("Preload Texture Replacements"), tr("Unchecked"),
|
||||
tr("Loads all replacement texture to RAM, reducing stuttering at runtime."));
|
||||
dialog->registerWidgetHelp(
|
||||
m_ui.alwaysTrackUploads, tr("Always Track Uploads"), tr("Unchecked"),
|
||||
tr("Forces texture upload tracking to be enabled regardless of whether it is needed. Reduces performance, but "
|
||||
"allows toggling replacements on and off. <strong>Not required for replacements to load, </strong>normally "
|
||||
"tracking is automatically enabled when needed."));
|
||||
dialog->registerWidgetHelp(
|
||||
m_ui.enableTextureDumping, tr("Enable Texture Dumping"), tr("Unchecked"),
|
||||
tr("Enables dumping of textures to image files, which can be replaced. Not compatible with all games."));
|
||||
|
@ -607,6 +612,9 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsWindow* dialog, QWidget*
|
|||
tr("Enables the replacement of background textures in supported games."));
|
||||
dialog->registerWidgetHelp(m_ui.vramWriteDumping, tr("Enable VRAM Write Dumping"), tr("Unchecked"),
|
||||
tr("Writes backgrounds that can be replaced to the dump directory."));
|
||||
dialog->registerWidgetHelp(m_ui.useOldMDECRoutines, tr("Use Old MDEC Routines"), tr("Unchecked"),
|
||||
tr("Enables the older, less accurate MDEC decoding routines. May be required for old "
|
||||
"replacement backgrounds to match/load."));
|
||||
|
||||
// Debugging Tab
|
||||
|
||||
|
@ -1162,6 +1170,7 @@ void GraphicsSettingsWidget::onEnableTextureCacheChanged()
|
|||
const bool tc_enabled = m_dialog->getEffectiveBoolValue("GPU", "EnableTextureCache", false);
|
||||
m_ui.enableTextureReplacements->setEnabled(tc_enabled);
|
||||
m_ui.enableTextureDumping->setEnabled(tc_enabled);
|
||||
m_ui.alwaysTrackUploads->setEnabled(tc_enabled);
|
||||
onEnableTextureDumpingChanged();
|
||||
onEnableAnyTextureReplacementsChanged();
|
||||
}
|
||||
|
|
|
@ -1089,27 +1089,17 @@
|
|||
<string>General Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_9">
|
||||
<item row="1" column="0">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="enableTextureCache">
|
||||
<property name="text">
|
||||
<string>Enable Texture Cache</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="preloadTextureReplacements">
|
||||
<property name="text">
|
||||
<string>The texture cache is currently experimental, and may cause rendering errors in some games.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="useOldMDECRoutines">
|
||||
<property name="text">
|
||||
<string>Use Old MDEC Routines</string>
|
||||
<string>Preload Texture Replacements</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1123,22 +1113,8 @@
|
|||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_8">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<layout class="QGridLayout" name="gridLayout_6" columnstretch="1,1">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="enableTextureReplacements">
|
||||
<property name="text">
|
||||
<string>Enable Texture Replacement</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="preloadTextureReplacements">
|
||||
<property name="text">
|
||||
<string>Preload Texture Replacements</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
|
@ -1159,6 +1135,13 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="enableTextureReplacements">
|
||||
<property name="text">
|
||||
<string>Enable Texture Replacement</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="dumpReplacedTextures">
|
||||
<property name="text">
|
||||
|
@ -1166,6 +1149,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="alwaysTrackUploads">
|
||||
<property name="text">
|
||||
<string>Always Track Uploads</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -1186,6 +1176,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="useOldMDECRoutines">
|
||||
<property name="text">
|
||||
<string>Use Old MDEC Routines</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="vramWriteDumping">
|
||||
<property name="text">
|
||||
|
|
Loading…
Reference in New Issue