From 923314aef5e25fe1a976e9f8b6bf1e015d75dc3e Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Fri, 24 Aug 2018 17:38:17 +0300 Subject: [PATCH] Rewrite texture_cache::emit_once Also trying to workaround MSVC bug --- rpcs3/Emu/RSX/Common/texture_cache.h | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index bb7419941d..6555f7e877 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -449,7 +449,7 @@ namespace rsx std::unordered_map m_cache_miss_statistics_table; //Map of messages to only emit once - std::unordered_map m_once_only_messages_map; + std::unordered_set m_once_only_messages_set; //Set when a shader read-only texture data suddenly becomes contested, usually by fbo memory bool read_only_tex_invalidate = false; @@ -494,31 +494,29 @@ namespace rsx m_cache_update_tag++; } - template - void emit_once(bool error, const char* fmt, Args&&... params) + template + void emit_once(bool error, const char* fmt, const Args&... params) { - const std::string message = fmt::format(fmt, std::forward(params)...); - if (m_once_only_messages_map.find(message) != m_once_only_messages_map.end()) + const auto result = m_once_only_messages_set.emplace(fmt::format(fmt, params...)); + if (!result.second) return; if (error) - logs::RSX.error(message.c_str()); + LOG_ERROR(RSX, "%s", *result.first); else - logs::RSX.warning(message.c_str()); - - m_once_only_messages_map[message] = true; + LOG_WARNING(RSX, "%s", *result.first); } - template - void err_once(const char* fmt, Args&&... params) + template + void err_once(const char* fmt, const Args&... params) { - emit_once(true, fmt, std::forward(params)...); + emit_once(true, fmt, params...); } - template - void warn_once(const char* fmt, Args&&... params) + template + void warn_once(const char* fmt, const Args&... params) { - emit_once(false, fmt, std::forward(params)...); + emit_once(false, fmt, params...); } private: