GPU/TextureCache: Display replacement info on game start

This commit is contained in:
Stenzek 2025-05-13 21:20:09 +10:00
parent 0483117c70
commit 2b280bddd0
No known key found for this signature in database
6 changed files with 23 additions and 14 deletions

View File

@ -299,7 +299,7 @@ bool GPU_HW::Initialize(bool upload_vram, Error* error)
else
{
// Still potentially have VRAM texture replacements.
GPUTextureCache::ReloadTextureReplacements(false);
GPUTextureCache::ReloadTextureReplacements(System::GetState() == System::State::Starting, false);
}
UpdateDownsamplingLevels();

View File

@ -27,6 +27,7 @@
#include "common/timer.h"
#include "IconsEmoji.h"
#include "IconsFontAwesome5.h"
#ifndef XXH_STATIC_LINKING_ONLY
#define XXH_STATIC_LINKING_ONLY
@ -599,8 +600,12 @@ bool GPUTextureCache::Initialize(GPU_HW* backend, Error* error)
s_state.hw_backend = backend;
SetHashCacheTextureFormat();
ReloadTextureReplacements(false);
// note: safe because the CPU thread is waiting for the GPU thread to finish initializing
ReloadTextureReplacements(System::GetState() == System::State::Starting, false);
UpdateVRAMTrackingState();
if (!CompilePipelines(error))
return false;
@ -639,7 +644,7 @@ bool GPUTextureCache::UpdateSettings(bool use_texture_cache, const GPUSettings&
}
}
ReloadTextureReplacements(false);
ReloadTextureReplacements(false, false);
}
UpdateVRAMTrackingState();
@ -2719,7 +2724,7 @@ size_t GPUTextureCache::DumpedTextureKeyHash::operator()(const DumpedTextureKey&
void GPUTextureCache::GameSerialChanged()
{
ReloadTextureReplacements(false);
ReloadTextureReplacements(false, false);
}
GPUTexture* GPUTextureCache::GetVRAMReplacement(u32 width, u32 height, const void* pixels)
@ -3618,7 +3623,7 @@ bool GPUTextureCache::LoadLocalConfiguration(bool load_vram_write_replacement_al
return (s_state.config != old_config);
}
void GPUTextureCache::ReloadTextureReplacements(bool show_info)
void GPUTextureCache::ReloadTextureReplacements(bool show_info, bool show_info_if_none)
{
s_state.dumped_textures.clear();
s_state.dumped_vram_writes.clear();
@ -3655,13 +3660,16 @@ void GPUTextureCache::ReloadTextureReplacements(bool show_info)
const int total =
static_cast<int>(s_state.vram_replacements.size() + s_state.vram_write_texture_replacements.size() +
s_state.texture_page_texture_replacements.size());
Host::AddIconOSDMessage("ReloadTextureReplacements", ICON_EMOJI_REFRESH,
if (total > 0 || show_info_if_none)
{
Host::AddIconOSDMessage("ReloadTextureReplacements", ICON_FA_IMAGES,
(total > 0) ? TRANSLATE_PLURAL_STR("GPU_HW", "%n replacement textures found.",
"Replacement texture count", total) :
TRANSLATE_STR("GPU_HW", "No replacement textures found."),
Host::OSD_INFO_DURATION);
}
}
}
void GPUTextureCache::PurgeUnreferencedTexturesFromCache()
{

View File

@ -130,7 +130,7 @@ bool AreSourcePagesDrawn(SourceKey key, const GSVector4i rect);
void Compact();
void GameSerialChanged();
void ReloadTextureReplacements(bool show_info);
void ReloadTextureReplacements(bool show_info, bool show_info_if_none);
// VRAM Write Replacements
GPUTexture* GetVRAMReplacement(u32 width, u32 height, const void* pixels);

View File

@ -1399,6 +1399,7 @@ void GPUThread::SetGameSerial(std::string serial)
s_state.game_serial = std::move(serial);
if (changed)
{
if (HasGPUBackend())
GPUTextureCache::GameSerialChanged();
if (SaveStateSelectorUI::IsOpen())
SaveStateSelectorUI::RefreshList();

View File

@ -464,7 +464,7 @@ DEFINE_HOTKEY("ReloadPostProcessingShaders", TRANSLATE_NOOP("Hotkeys", "Graphics
DEFINE_HOTKEY("ReloadTextureReplacements", TRANSLATE_NOOP("Hotkeys", "Graphics"),
TRANSLATE_NOOP("Hotkeys", "Reload Texture Replacements"), [](s32 pressed) {
if (!pressed && System::IsValid())
GPUThread::RunOnThread([]() { GPUTextureCache::ReloadTextureReplacements(true); });
GPUThread::RunOnThread([]() { GPUTextureCache::ReloadTextureReplacements(true, true); });
})
DEFINE_HOTKEY("IncreaseResolutionScale", TRANSLATE_NOOP("Hotkeys", "Graphics"),

View File

@ -1343,7 +1343,7 @@ void EmuThread::reloadTextureReplacements()
}
if (System::IsValid())
GPUThread::RunOnThread([]() { GPUTextureCache::ReloadTextureReplacements(true); });
GPUThread::RunOnThread([]() { GPUTextureCache::ReloadTextureReplacements(true, true); });
}
void EmuThread::captureGPUFrameDump()