summaryrefslogtreecommitdiffstats
path: root/src/video_core/debug_utils/debug_utils.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-03-25 22:28:24 +0200
committerGitHub <noreply@github.com>2018-03-25 22:28:24 +0200
commite9315ace9f7f541d251a995ff2d4d3513ddc16c4 (patch)
treeba32de7358ed98e1230c1f522a5c7ba35d7ab19e /src/video_core/debug_utils/debug_utils.cpp
parentMerge pull request #281 from mailwl/sockets-services (diff)
parentGPU: Make the debug_context variable a member of the frontend instead of a global. (diff)
downloadyuzu-e9315ace9f7f541d251a995ff2d4d3513ddc16c4.tar
yuzu-e9315ace9f7f541d251a995ff2d4d3513ddc16c4.tar.gz
yuzu-e9315ace9f7f541d251a995ff2d4d3513ddc16c4.tar.bz2
yuzu-e9315ace9f7f541d251a995ff2d4d3513ddc16c4.tar.lz
yuzu-e9315ace9f7f541d251a995ff2d4d3513ddc16c4.tar.xz
yuzu-e9315ace9f7f541d251a995ff2d4d3513ddc16c4.tar.zst
yuzu-e9315ace9f7f541d251a995ff2d4d3513ddc16c4.zip
Diffstat (limited to 'src/video_core/debug_utils/debug_utils.cpp')
-rw-r--r--src/video_core/debug_utils/debug_utils.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp
new file mode 100644
index 000000000..22d44aab2
--- /dev/null
+++ b/src/video_core/debug_utils/debug_utils.cpp
@@ -0,0 +1,64 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#include <algorithm>
+#include <condition_variable>
+#include <cstdint>
+#include <cstring>
+#include <fstream>
+#include <map>
+#include <mutex>
+#include <string>
+
+#include "common/assert.h"
+#include "common/bit_field.h"
+#include "common/color.h"
+#include "common/common_types.h"
+#include "common/file_util.h"
+#include "common/logging/log.h"
+#include "common/math_util.h"
+#include "common/vector_math.h"
+#include "video_core/debug_utils/debug_utils.h"
+
+namespace Tegra {
+
+void DebugContext::DoOnEvent(Event event, void* data) {
+ {
+ std::unique_lock<std::mutex> lock(breakpoint_mutex);
+
+ // TODO(Subv): Commit the rasterizer's caches so framebuffers, render targets, etc. will
+ // show on debug widgets
+
+ // TODO: Should stop the CPU thread here once we multithread emulation.
+
+ active_breakpoint = event;
+ at_breakpoint = true;
+
+ // Tell all observers that we hit a breakpoint
+ for (auto& breakpoint_observer : breakpoint_observers) {
+ breakpoint_observer->OnMaxwellBreakPointHit(event, data);
+ }
+
+ // Wait until another thread tells us to Resume()
+ resume_from_breakpoint.wait(lock, [&] { return !at_breakpoint; });
+ }
+}
+
+void DebugContext::Resume() {
+ {
+ std::lock_guard<std::mutex> lock(breakpoint_mutex);
+
+ // Tell all observers that we are about to resume
+ for (auto& breakpoint_observer : breakpoint_observers) {
+ breakpoint_observer->OnMaxwellResume();
+ }
+
+ // Resume the waiting thread (i.e. OnEvent())
+ at_breakpoint = false;
+ }
+
+ resume_from_breakpoint.notify_one();
+}
+
+} // namespace Tegra