diff options
author | bunnei <bunneidev@gmail.com> | 2016-12-19 03:15:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-19 03:15:24 +0100 |
commit | 3a1eaf2efc4e5cb3358ab7451182711dfbaa061b (patch) | |
tree | 232894ae24bb16688f6e5f480baf9168e72edc62 | |
parent | Merge pull request #2351 from CaptV0rt3x/master (diff) | |
parent | VideoCore: Inline IsPicaTracing (diff) | |
download | yuzu-3a1eaf2efc4e5cb3358ab7451182711dfbaa061b.tar yuzu-3a1eaf2efc4e5cb3358ab7451182711dfbaa061b.tar.gz yuzu-3a1eaf2efc4e5cb3358ab7451182711dfbaa061b.tar.bz2 yuzu-3a1eaf2efc4e5cb3358ab7451182711dfbaa061b.tar.lz yuzu-3a1eaf2efc4e5cb3358ab7451182711dfbaa061b.tar.xz yuzu-3a1eaf2efc4e5cb3358ab7451182711dfbaa061b.tar.zst yuzu-3a1eaf2efc4e5cb3358ab7451182711dfbaa061b.zip |
-rw-r--r-- | src/video_core/command_processor.cpp | 5 | ||||
-rw-r--r-- | src/video_core/debug_utils/debug_utils.cpp | 20 | ||||
-rw-r--r-- | src/video_core/debug_utils/debug_utils.h | 6 |
3 files changed, 15 insertions, 16 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 04de3e6b1..408375230 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp @@ -59,7 +59,10 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { regs[id] = (old_value & ~write_mask) | (value & write_mask); - DebugUtils::OnPicaRegWrite({(u16)id, (u16)mask, regs[id]}); + // Double check for is_pica_tracing to avoid call overhead + if (DebugUtils::IsPicaTracing()) { + DebugUtils::OnPicaRegWrite({(u16)id, (u16)mask, regs[id]}); + } if (g_debug_context) g_debug_context->OnEvent(DebugContext::Event::PicaCommandLoaded, diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index 8806464d9..c44b3d95a 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp @@ -276,10 +276,10 @@ void DumpShader(const std::string& filename, const Regs::ShaderConfig& config, static std::unique_ptr<PicaTrace> pica_trace; static std::mutex pica_trace_mutex; -static int is_pica_tracing = false; +bool g_is_pica_tracing = false; void StartPicaTracing() { - if (is_pica_tracing) { + if (g_is_pica_tracing) { LOG_WARNING(HW_GPU, "StartPicaTracing called even though tracing already running!"); return; } @@ -287,34 +287,26 @@ void StartPicaTracing() { std::lock_guard<std::mutex> lock(pica_trace_mutex); pica_trace = std::make_unique<PicaTrace>(); - is_pica_tracing = true; -} - -bool IsPicaTracing() { - return is_pica_tracing != 0; + g_is_pica_tracing = true; } void OnPicaRegWrite(PicaTrace::Write write) { - // Double check for is_pica_tracing to avoid pointless locking overhead - if (!is_pica_tracing) - return; - std::lock_guard<std::mutex> lock(pica_trace_mutex); - if (!is_pica_tracing) + if (!g_is_pica_tracing) return; pica_trace->writes.push_back(write); } std::unique_ptr<PicaTrace> FinishPicaTracing() { - if (!is_pica_tracing) { + if (!g_is_pica_tracing) { LOG_WARNING(HW_GPU, "FinishPicaTracing called even though tracing isn't running!"); return {}; } // signalize that no further tracing should be performed - is_pica_tracing = false; + g_is_pica_tracing = false; // Wait until running tracing is finished std::lock_guard<std::mutex> lock(pica_trace_mutex); diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index 189c93abb..46ea8d9c7 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h @@ -196,8 +196,12 @@ struct PicaTrace { std::vector<Write> writes; }; +extern bool g_is_pica_tracing; + void StartPicaTracing(); -bool IsPicaTracing(); +inline bool IsPicaTracing() { + return g_is_pica_tracing; +} void OnPicaRegWrite(PicaTrace::Write write); std::unique_ptr<PicaTrace> FinishPicaTracing(); |