Skip to content

Commit

Permalink
InputCommon / VideoCommon: remove dynamic input reloading the texture…
Browse files Browse the repository at this point in the history
… cache, this is no longer needed, assets reload automatically!
  • Loading branch information
iwubcode committed Jun 5, 2023
1 parent 4ed67c4 commit 533caf7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 32 deletions.
6 changes: 1 addition & 5 deletions Source/Core/InputCommon/DynamicInputTextureManager.cpp
Expand Up @@ -42,13 +42,9 @@ void DynamicInputTextureManager::Load()
void DynamicInputTextureManager::GenerateTextures(const Common::IniFile& file,
const std::vector<std::string>& controller_names)
{
bool any_dirty = false;
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
26 changes: 4 additions & 22 deletions Source/Core/VideoCommon/TextureCacheBase.cpp
Expand Up @@ -145,17 +145,6 @@ void TextureCacheBase::Invalidate()
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)
{
if (config.bHiresTextures != backup_config.hires_textures ||
Expand Down Expand Up @@ -781,17 +770,10 @@ void TextureCacheBase::DoLoadState(PointerWrap& p)

void TextureCacheBase::OnFrameEnd()
{
if (m_force_reload_textures.TestAndClear())
{
ForceReload();
}
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();
}
// 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());
}
Expand Down
5 changes: 0 additions & 5 deletions Source/Core/VideoCommon/TextureCacheBase.h
Expand Up @@ -272,7 +272,6 @@ class TextureCacheBase
void Shutdown();

void OnConfigChanged(const VideoConfig& config);
void ForceReload();

// Removes textures which aren't used for more than TEXTURE_KILL_THRESHOLD frames,
// frameCount is the current frame number.
Expand Down Expand Up @@ -313,9 +312,6 @@ class TextureCacheBase
static bool AllCopyFilterCoefsNeeded(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:
// Decodes the specified data to the GPU texture specified by entry.
// Returns false if the configuration is not supported.
Expand Down Expand Up @@ -468,7 +464,6 @@ class TextureCacheBase

void OnFrameEnd();

Common::Flag m_force_reload_textures;
Common::EventHook m_frame_event =
AfterFrameEvent::Register([this] { OnFrameEnd(); }, "TextureCache");
};
Expand Down

0 comments on commit 533caf7

Please sign in to comment.