InputCommon / VideoCommon: remove dynamic input reloading the texture cache, this is no longer needed, assets reload automatically!

This commit is contained in:
iwubcode 2023-03-22 20:56:13 -05:00
parent ca8d6748d6
commit e831d7b6bb
3 changed files with 5 additions and 32 deletions

View File

@ -42,13 +42,9 @@ void DynamicInputTextureManager::Load()
void DynamicInputTextureManager::GenerateTextures(const Common::IniFile& file, void DynamicInputTextureManager::GenerateTextures(const Common::IniFile& file,
const std::vector<std::string>& controller_names) const std::vector<std::string>& controller_names)
{ {
bool any_dirty = false;
for (const auto& configuration : m_configuration) for (const auto& configuration : m_configuration)
{ {
any_dirty |= configuration.GenerateTextures(file, controller_names); (void)configuration.GenerateTextures(file, controller_names);
} }
if (any_dirty && g_texture_cache && Core::GetState() != Core::State::Starting)
g_texture_cache->ForceReloadTextures();
} }
} // namespace InputCommon } // namespace InputCommon

View File

@ -145,17 +145,6 @@ void TextureCacheBase::Invalidate()
texture_pool.clear(); texture_pool.clear();
} }
void TextureCacheBase::ForceReload()
{
Invalidate();
// Clear all current hires textures, they are invalid
HiresTexture::Clear();
// Load fresh
HiresTexture::Update();
}
void TextureCacheBase::OnConfigChanged(const VideoConfig& config) void TextureCacheBase::OnConfigChanged(const VideoConfig& config)
{ {
if (config.bHiresTextures != backup_config.hires_textures || if (config.bHiresTextures != backup_config.hires_textures ||
@ -781,17 +770,10 @@ void TextureCacheBase::DoLoadState(PointerWrap& p)
void TextureCacheBase::OnFrameEnd() void TextureCacheBase::OnFrameEnd()
{ {
if (m_force_reload_textures.TestAndClear()) // Flush any outstanding EFB copies to RAM, in case the game is running at an uncapped frame
{ // rate and not waiting for vblank. Otherwise, we'd end up with a huge list of pending
ForceReload(); // copies.
} FlushEFBCopies();
else
{
// Flush any outstanding EFB copies to RAM, in case the game is running at an uncapped frame
// rate and not waiting for vblank. Otherwise, we'd end up with a huge list of pending
// copies.
FlushEFBCopies();
}
Cleanup(g_presenter->FrameCount()); Cleanup(g_presenter->FrameCount());
} }

View File

@ -272,7 +272,6 @@ public:
void Shutdown(); void Shutdown();
void OnConfigChanged(const VideoConfig& config); void OnConfigChanged(const VideoConfig& config);
void ForceReload();
// Removes textures which aren't used for more than TEXTURE_KILL_THRESHOLD frames, // Removes textures which aren't used for more than TEXTURE_KILL_THRESHOLD frames,
// frameCount is the current frame number. // frameCount is the current frame number.
@ -313,9 +312,6 @@ public:
static bool AllCopyFilterCoefsNeeded(const std::array<u32, 3>& coefficients); static bool AllCopyFilterCoefsNeeded(const std::array<u32, 3>& coefficients);
static bool CopyFilterCanOverflow(const std::array<u32, 3>& coefficients); static bool CopyFilterCanOverflow(const std::array<u32, 3>& coefficients);
// Will forcibly reload all textures when the frame next ends
void ForceReloadTextures() { m_force_reload_textures.Set(); }
protected: protected:
// Decodes the specified data to the GPU texture specified by entry. // Decodes the specified data to the GPU texture specified by entry.
// Returns false if the configuration is not supported. // Returns false if the configuration is not supported.
@ -468,7 +464,6 @@ private:
void OnFrameEnd(); void OnFrameEnd();
Common::Flag m_force_reload_textures;
Common::EventHook m_frame_event = Common::EventHook m_frame_event =
AfterFrameEvent::Register([this] { OnFrameEnd(); }, "TextureCache"); AfterFrameEvent::Register([this] { OnFrameEnd(); }, "TextureCache");
}; };