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();
}
else if (m_use_texture_cache)
{
GPUTextureCache::UpdateSettings(old_settings);
}
GPUTextureCache::UpdateSettings(m_use_texture_cache, old_settings);
if (g_settings.gpu_downsample_mode != old_settings.gpu_downsample_mode ||
(g_settings.gpu_downsample_mode == GPUDownsampleMode::Box &&

View File

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

View File

@ -103,7 +103,7 @@ struct Source
};
bool Initialize();
void UpdateSettings(const Settings& old_settings);
void UpdateSettings(bool use_texture_cache, const Settings& old_settings);
bool DoState(StateWrapper& sw, bool skip);
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.rewind_enable != old_settings.rewind_enable ||
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_gpu->UpdateSettings(old_settings);