diff options
| author | 2016-12-14 22:01:24 -0800 | |
|---|---|---|
| committer | 2016-12-14 22:06:40 -0800 | |
| commit | 945f554b849360405639efb6598afa2f18de64c2 (patch) | |
| tree | 4d534fd50d1094d3d3c8655cb2aa9afe9789b430 /src/video_core/debug_utils | |
| parent | Merge pull request #2317 from yuriks/vertex-copy (diff) | |
| download | yuzu-945f554b849360405639efb6598afa2f18de64c2.tar.gz yuzu-945f554b849360405639efb6598afa2f18de64c2.tar.xz yuzu-945f554b849360405639efb6598afa2f18de64c2.zip | |
VideoCore: Inline IsPicaTracing
Speeds up ALBW main menu slightly (~3%)
Diffstat (limited to 'src/video_core/debug_utils')
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.cpp | 20 | ||||
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.h | 6 |
2 files changed, 11 insertions, 15 deletions
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, | |||
| 276 | 276 | ||
| 277 | static std::unique_ptr<PicaTrace> pica_trace; | 277 | static std::unique_ptr<PicaTrace> pica_trace; |
| 278 | static std::mutex pica_trace_mutex; | 278 | static std::mutex pica_trace_mutex; |
| 279 | static int is_pica_tracing = false; | 279 | bool g_is_pica_tracing = false; |
| 280 | 280 | ||
| 281 | void StartPicaTracing() { | 281 | void StartPicaTracing() { |
| 282 | if (is_pica_tracing) { | 282 | if (g_is_pica_tracing) { |
| 283 | LOG_WARNING(HW_GPU, "StartPicaTracing called even though tracing already running!"); | 283 | LOG_WARNING(HW_GPU, "StartPicaTracing called even though tracing already running!"); |
| 284 | return; | 284 | return; |
| 285 | } | 285 | } |
| @@ -287,34 +287,26 @@ void StartPicaTracing() { | |||
| 287 | std::lock_guard<std::mutex> lock(pica_trace_mutex); | 287 | std::lock_guard<std::mutex> lock(pica_trace_mutex); |
| 288 | pica_trace = std::make_unique<PicaTrace>(); | 288 | pica_trace = std::make_unique<PicaTrace>(); |
| 289 | 289 | ||
| 290 | is_pica_tracing = true; | 290 | g_is_pica_tracing = true; |
| 291 | } | ||
| 292 | |||
| 293 | bool IsPicaTracing() { | ||
| 294 | return is_pica_tracing != 0; | ||
| 295 | } | 291 | } |
| 296 | 292 | ||
| 297 | void OnPicaRegWrite(PicaTrace::Write write) { | 293 | void OnPicaRegWrite(PicaTrace::Write write) { |
| 298 | // Double check for is_pica_tracing to avoid pointless locking overhead | ||
| 299 | if (!is_pica_tracing) | ||
| 300 | return; | ||
| 301 | |||
| 302 | std::lock_guard<std::mutex> lock(pica_trace_mutex); | 294 | std::lock_guard<std::mutex> lock(pica_trace_mutex); |
| 303 | 295 | ||
| 304 | if (!is_pica_tracing) | 296 | if (!g_is_pica_tracing) |
| 305 | return; | 297 | return; |
| 306 | 298 | ||
| 307 | pica_trace->writes.push_back(write); | 299 | pica_trace->writes.push_back(write); |
| 308 | } | 300 | } |
| 309 | 301 | ||
| 310 | std::unique_ptr<PicaTrace> FinishPicaTracing() { | 302 | std::unique_ptr<PicaTrace> FinishPicaTracing() { |
| 311 | if (!is_pica_tracing) { | 303 | if (!g_is_pica_tracing) { |
| 312 | LOG_WARNING(HW_GPU, "FinishPicaTracing called even though tracing isn't running!"); | 304 | LOG_WARNING(HW_GPU, "FinishPicaTracing called even though tracing isn't running!"); |
| 313 | return {}; | 305 | return {}; |
| 314 | } | 306 | } |
| 315 | 307 | ||
| 316 | // signalize that no further tracing should be performed | 308 | // signalize that no further tracing should be performed |
| 317 | is_pica_tracing = false; | 309 | g_is_pica_tracing = false; |
| 318 | 310 | ||
| 319 | // Wait until running tracing is finished | 311 | // Wait until running tracing is finished |
| 320 | std::lock_guard<std::mutex> lock(pica_trace_mutex); | 312 | 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 { | |||
| 196 | std::vector<Write> writes; | 196 | std::vector<Write> writes; |
| 197 | }; | 197 | }; |
| 198 | 198 | ||
| 199 | extern bool g_is_pica_tracing; | ||
| 200 | |||
| 199 | void StartPicaTracing(); | 201 | void StartPicaTracing(); |
| 200 | bool IsPicaTracing(); | 202 | inline bool IsPicaTracing() { |
| 203 | return g_is_pica_tracing; | ||
| 204 | } | ||
| 201 | void OnPicaRegWrite(PicaTrace::Write write); | 205 | void OnPicaRegWrite(PicaTrace::Write write); |
| 202 | std::unique_ptr<PicaTrace> FinishPicaTracing(); | 206 | std::unique_ptr<PicaTrace> FinishPicaTracing(); |
| 203 | 207 | ||