GPU/HW: Fix toggling texture replacement settings

This commit is contained in:
Stenzek 2024-10-05 13:50:33 +10:00
parent 71bb953253
commit 08bdffac64
No known key found for this signature in database
4 changed files with 31 additions and 18 deletions

View File

@ -557,10 +557,8 @@ void GPU_HW::UpdateSettings(const Settings& old_settings)
{ {
GPUTextureCache::Shutdown(); GPUTextureCache::Shutdown();
} }
else if (m_use_texture_cache)
{ GPUTextureCache::UpdateSettings(m_use_texture_cache, old_settings);
GPUTextureCache::UpdateSettings(old_settings);
}
if (g_settings.gpu_downsample_mode != old_settings.gpu_downsample_mode || if (g_settings.gpu_downsample_mode != old_settings.gpu_downsample_mode ||
(g_settings.gpu_downsample_mode == GPUDownsampleMode::Box && (g_settings.gpu_downsample_mode == GPUDownsampleMode::Box &&

View File

@ -561,28 +561,38 @@ bool GPUTextureCache::Initialize()
return true; return true;
} }
void GPUTextureCache::UpdateSettings(const Settings& old_settings) void GPUTextureCache::UpdateSettings(bool use_texture_cache, const Settings& old_settings)
{ {
UpdateVRAMTrackingState(); if (use_texture_cache)
if (g_settings.texture_replacements.enable_texture_replacements !=
old_settings.texture_replacements.enable_texture_replacements)
{ {
Invalidate(); UpdateVRAMTrackingState();
DestroyPipelines(); if (g_settings.texture_replacements.enable_texture_replacements !=
if (!CompilePipelines()) [[unlikely]] old_settings.texture_replacements.enable_texture_replacements)
Panic("Failed to compile pipelines on TC settings change"); {
Invalidate();
DestroyPipelines();
if (!CompilePipelines()) [[unlikely]]
Panic("Failed to compile pipelines on TC settings change");
}
} }
// Reload textures if configuration changes. // Reload textures if configuration changes.
const bool old_replacement_scale_linear_filter = s_config.replacement_scale_linear_filter; const bool old_replacement_scale_linear_filter = s_config.replacement_scale_linear_filter;
if (LoadLocalConfiguration(false, false)) if (LoadLocalConfiguration(false, false) ||
g_settings.texture_replacements.enable_texture_replacements !=
old_settings.texture_replacements.enable_texture_replacements ||
g_settings.texture_replacements.enable_vram_write_replacements !=
old_settings.texture_replacements.enable_vram_write_replacements)
{ {
if (s_config.replacement_scale_linear_filter != old_replacement_scale_linear_filter) if (use_texture_cache)
{ {
if (!CompilePipelines()) [[unlikely]] if (s_config.replacement_scale_linear_filter != old_replacement_scale_linear_filter)
Panic("Failed to compile pipelines on TC replacement settings change"); {
if (!CompilePipelines()) [[unlikely]]
Panic("Failed to compile pipelines on TC replacement settings change");
}
} }
ReloadTextureReplacements(false); ReloadTextureReplacements(false);

View File

@ -103,7 +103,7 @@ struct Source
}; };
bool Initialize(); bool Initialize();
void UpdateSettings(const Settings& old_settings); void UpdateSettings(bool use_texture_cache, const Settings& old_settings);
bool DoState(StateWrapper& sw, bool skip); bool DoState(StateWrapper& sw, bool skip);
void Shutdown(); void Shutdown();

View File

@ -4418,6 +4418,11 @@ void System::CheckForSettingsChanges(const Settings& old_settings)
g_settings.display_line_end_offset != old_settings.display_line_end_offset || g_settings.display_line_end_offset != old_settings.display_line_end_offset ||
g_settings.rewind_enable != old_settings.rewind_enable || g_settings.rewind_enable != old_settings.rewind_enable ||
g_settings.runahead_frames != old_settings.runahead_frames || g_settings.runahead_frames != old_settings.runahead_frames ||
g_settings.texture_replacements.enable_texture_replacements !=
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.dump_textures != old_settings.texture_replacements.dump_textures ||
g_settings.texture_replacements.config != old_settings.texture_replacements.config) g_settings.texture_replacements.config != old_settings.texture_replacements.config)
{ {
g_gpu->UpdateSettings(old_settings); g_gpu->UpdateSettings(old_settings);