diff options
| author | iwubcode <iwubcode@users.noreply.github.com> | 2019-08-17 14:40:58 -0500 |
|---|---|---|
| committer | iwubcode <iwubcode@users.noreply.github.com> | 2020-10-03 17:10:35 -0500 |
| commit | fd3af4c5d32a34b27c45b478c74fa1127b6438b9 (patch) | |
| tree | df55a2548a01e0cd0578abb41f2c9ad78d1db544 /Source/Core/VideoCommon | |
| parent | 8a1539f9487cff0b5785e2d341663e4d7136e2a3 (diff) | |
InputCommon: Introducing the "Dynamic Input Texture". Configuration links an emulated input action to an image based on what host key is defined for that emulated input. Specific regions are called out in configuration that mark where to replace an input button with a host key image.
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/HiresTextures.cpp | 9 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/HiresTextures.h | 1 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/RenderBase.cpp | 19 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/RenderBase.h | 5 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/TextureCacheBase.cpp | 11 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/TextureCacheBase.h | 1 |
6 files changed, 41 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/HiresTextures.cpp b/Source/Core/VideoCommon/HiresTextures.cpp index 92ba7ff9e6..d1ced9e307 100644 --- a/Source/Core/VideoCommon/HiresTextures.cpp +++ b/Source/Core/VideoCommon/HiresTextures.cpp @@ -76,8 +76,7 @@ void HiresTexture::Update() if (!g_ActiveConfig.bHiresTextures) { - s_textureMap.clear(); - s_textureCache.clear(); + Clear(); return; } @@ -146,6 +145,12 @@ void HiresTexture::Update() } } +void HiresTexture::Clear() +{ + s_textureMap.clear(); + s_textureCache.clear(); +} + void HiresTexture::Prefetch() { Common::SetCurrentThreadName("Prefetcher"); diff --git a/Source/Core/VideoCommon/HiresTextures.h b/Source/Core/VideoCommon/HiresTextures.h index 2112218f98..7adabbf94e 100644 --- a/Source/Core/VideoCommon/HiresTextures.h +++ b/Source/Core/VideoCommon/HiresTextures.h @@ -22,6 +22,7 @@ class HiresTexture public: static void Init(); static void Update(); + static void Clear(); static void Shutdown(); static std::shared_ptr<HiresTexture> Search(const u8* texture, size_t texture_size, diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index a60f9b9f91..4777314194 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -1138,6 +1138,11 @@ void Renderer::EndUIFrame() BeginImGuiFrame(); } +void Renderer::ForceReloadTextures() +{ + m_force_reload_textures.Set(); +} + // Heuristic to detect if a GameCube game is in 16:9 anamorphic widescreen mode. void Renderer::UpdateWidescreenHeuristic() { @@ -1302,9 +1307,17 @@ void Renderer::Swap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u6 // state changes the specialized shader will not take over. g_vertex_manager->InvalidatePipelineObject(); - // 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. - g_texture_cache->FlushEFBCopies(); + if (m_force_reload_textures.TestAndClear()) + { + g_texture_cache->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. + g_texture_cache->FlushEFBCopies(); + } if (!is_duplicate_frame) { diff --git a/Source/Core/VideoCommon/RenderBase.h b/Source/Core/VideoCommon/RenderBase.h index 3b6de06fd8..4044af8e0b 100644 --- a/Source/Core/VideoCommon/RenderBase.h +++ b/Source/Core/VideoCommon/RenderBase.h @@ -259,6 +259,9 @@ public: void BeginUIFrame(); void EndUIFrame(); + // Will forcibly reload all textures on the next swap + void ForceReloadTextures(); + protected: // Bitmask containing information about which configuration has changed for the backend. enum ConfigChangeBits : u32 @@ -410,6 +413,8 @@ private: void FinishFrameData(); std::unique_ptr<NetPlayChatUI> m_netplay_chat_ui; + + Common::Flag m_force_reload_textures; }; extern std::unique_ptr<Renderer> g_renderer; diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index fdf3c0e6b3..ec54f59d9a 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -137,6 +137,17 @@ 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 || diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index e8ecf5b6fe..9245f7bf3f 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -205,6 +205,7 @@ public: bool Initialize(); 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. |
