diff options
| author | 2015-08-16 13:34:45 +0200 | |
|---|---|---|
| committer | 2015-08-16 13:34:45 +0200 | |
| commit | f5144e6c10a5e0e0e6a267ca7ef8451f84194ffd (patch) | |
| tree | e74eb17add0b6e0c33f79b95f95d7561cad7eeae /src/video_core/debug_utils | |
| parent | Merge pull request #933 from neobrain/shader_debugger (diff) | |
| parent | citra-qt/debug_utils: Use lock_guard everywhere (diff) | |
| download | yuzu-f5144e6c10a5e0e0e6a267ca7ef8451f84194ffd.tar.gz yuzu-f5144e6c10a5e0e0e6a267ca7ef8451f84194ffd.tar.xz yuzu-f5144e6c10a5e0e0e6a267ca7ef8451f84194ffd.zip | |
Merge pull request #997 from Lectem/cmdlist_full_debug
citra-qt: Improve pica command list widget (add mask, fix some issues)
Diffstat (limited to 'src/video_core/debug_utils')
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.cpp | 15 | ||||
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.h | 14 |
2 files changed, 12 insertions, 17 deletions
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index ac071790a..e4b397303 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp | |||
| @@ -64,7 +64,7 @@ void DebugContext::OnEvent(Event event, void* data) { | |||
| 64 | 64 | ||
| 65 | void DebugContext::Resume() { | 65 | void DebugContext::Resume() { |
| 66 | { | 66 | { |
| 67 | std::unique_lock<std::mutex> lock(breakpoint_mutex); | 67 | std::lock_guard<std::mutex> lock(breakpoint_mutex); |
| 68 | 68 | ||
| 69 | // Tell all observers that we are about to resume | 69 | // Tell all observers that we are about to resume |
| 70 | for (auto& breakpoint_observer : breakpoint_observers) { | 70 | for (auto& breakpoint_observer : breakpoint_observers) { |
| @@ -312,11 +312,10 @@ void StartPicaTracing() | |||
| 312 | return; | 312 | return; |
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | pica_trace_mutex.lock(); | 315 | std::lock_guard<std::mutex> lock(pica_trace_mutex); |
| 316 | pica_trace = std::unique_ptr<PicaTrace>(new PicaTrace); | 316 | pica_trace = std::unique_ptr<PicaTrace>(new PicaTrace); |
| 317 | 317 | ||
| 318 | is_pica_tracing = true; | 318 | is_pica_tracing = true; |
| 319 | pica_trace_mutex.unlock(); | ||
| 320 | } | 319 | } |
| 321 | 320 | ||
| 322 | bool IsPicaTracing() | 321 | bool IsPicaTracing() |
| @@ -324,18 +323,18 @@ bool IsPicaTracing() | |||
| 324 | return is_pica_tracing != 0; | 323 | return is_pica_tracing != 0; |
| 325 | } | 324 | } |
| 326 | 325 | ||
| 327 | void OnPicaRegWrite(u32 id, u32 value) | 326 | void OnPicaRegWrite(PicaTrace::Write write) |
| 328 | { | 327 | { |
| 329 | // Double check for is_pica_tracing to avoid pointless locking overhead | 328 | // Double check for is_pica_tracing to avoid pointless locking overhead |
| 330 | if (!is_pica_tracing) | 329 | if (!is_pica_tracing) |
| 331 | return; | 330 | return; |
| 332 | 331 | ||
| 333 | std::unique_lock<std::mutex> lock(pica_trace_mutex); | 332 | std::lock_guard<std::mutex> lock(pica_trace_mutex); |
| 334 | 333 | ||
| 335 | if (!is_pica_tracing) | 334 | if (!is_pica_tracing) |
| 336 | return; | 335 | return; |
| 337 | 336 | ||
| 338 | pica_trace->writes.emplace_back(id, value); | 337 | pica_trace->writes.push_back(write); |
| 339 | } | 338 | } |
| 340 | 339 | ||
| 341 | std::unique_ptr<PicaTrace> FinishPicaTracing() | 340 | std::unique_ptr<PicaTrace> FinishPicaTracing() |
| @@ -349,9 +348,9 @@ std::unique_ptr<PicaTrace> FinishPicaTracing() | |||
| 349 | is_pica_tracing = false; | 348 | is_pica_tracing = false; |
| 350 | 349 | ||
| 351 | // Wait until running tracing is finished | 350 | // Wait until running tracing is finished |
| 352 | pica_trace_mutex.lock(); | 351 | std::lock_guard<std::mutex> lock(pica_trace_mutex); |
| 353 | std::unique_ptr<PicaTrace> ret(std::move(pica_trace)); | 352 | std::unique_ptr<PicaTrace> ret(std::move(pica_trace)); |
| 354 | pica_trace_mutex.unlock(); | 353 | |
| 355 | return std::move(ret); | 354 | return std::move(ret); |
| 356 | } | 355 | } |
| 357 | 356 | ||
diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index 0b30d7ffa..85762f5b4 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h | |||
| @@ -187,21 +187,17 @@ void DumpShader(const std::string& filename, const Regs::ShaderConfig& config, | |||
| 187 | 187 | ||
| 188 | // Utility class to log Pica commands. | 188 | // Utility class to log Pica commands. |
| 189 | struct PicaTrace { | 189 | struct PicaTrace { |
| 190 | struct Write : public std::pair<u32,u32> { | 190 | struct Write { |
| 191 | Write(u32 id, u32 value) : std::pair<u32,u32>(id, value) {} | 191 | u16 cmd_id; |
| 192 | 192 | u16 mask; | |
| 193 | u32& Id() { return first; } | 193 | u32 value; |
| 194 | const u32& Id() const { return first; } | ||
| 195 | |||
| 196 | u32& Value() { return second; } | ||
| 197 | const u32& Value() const { return second; } | ||
| 198 | }; | 194 | }; |
| 199 | std::vector<Write> writes; | 195 | std::vector<Write> writes; |
| 200 | }; | 196 | }; |
| 201 | 197 | ||
| 202 | void StartPicaTracing(); | 198 | void StartPicaTracing(); |
| 203 | bool IsPicaTracing(); | 199 | bool IsPicaTracing(); |
| 204 | void OnPicaRegWrite(u32 id, u32 value); | 200 | void OnPicaRegWrite(PicaTrace::Write write); |
| 205 | std::unique_ptr<PicaTrace> FinishPicaTracing(); | 201 | std::unique_ptr<PicaTrace> FinishPicaTracing(); |
| 206 | 202 | ||
| 207 | struct TextureInfo { | 203 | struct TextureInfo { |