diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-09-18 02:38:01 +0200 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-09-18 02:38:01 +0200 |
commit | dc8479928c5aee4c6ad6fe4f59006fb604cee701 (patch) | |
tree | 569a7f13128450bbab973236615587ff00bced5f /src/video_core/gpu_debugger.h | |
parent | Travis: Import Dolphin’s clang-format hook. (diff) | |
download | yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.gz yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.bz2 yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.lz yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.xz yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.tar.zst yuzu-dc8479928c5aee4c6ad6fe4f59006fb604cee701.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/gpu_debugger.h | 41 |
1 files changed, 16 insertions, 25 deletions
diff --git a/src/video_core/gpu_debugger.h b/src/video_core/gpu_debugger.h index a3aab216c..e3ba80d8f 100644 --- a/src/video_core/gpu_debugger.h +++ b/src/video_core/gpu_debugger.h @@ -10,17 +10,15 @@ #include "core/hle/service/gsp_gpu.h" -class GraphicsDebugger -{ +class GraphicsDebugger { public: // Base class for all objects which need to be notified about GPU events - class DebuggerObserver - { + class DebuggerObserver { public: - DebuggerObserver() : observed(nullptr) { } + DebuggerObserver() : observed(nullptr) { + } - virtual ~DebuggerObserver() - { + virtual ~DebuggerObserver() { if (observed) observed->UnregisterObserver(this); } @@ -31,15 +29,13 @@ public: * @param total_command_count Total number of commands in the GX history * @note All methods in this class are called from the GSP thread */ - virtual void GXCommandProcessed(int total_command_count) - { - const GSP_GPU::Command& cmd = observed->ReadGXCommandHistory(total_command_count-1); + virtual void GXCommandProcessed(int total_command_count) { + const GSP_GPU::Command& cmd = observed->ReadGXCommandHistory(total_command_count - 1); LOG_TRACE(Debug_GPU, "Received command: id=%x", (int)cmd.id.Value()); } protected: - const GraphicsDebugger* GetDebugger() const - { + const GraphicsDebugger* GetDebugger() const { return observed; } @@ -49,8 +45,7 @@ public: friend class GraphicsDebugger; }; - void GXCommandProcessed(u8* command_data) - { + void GXCommandProcessed(u8* command_data) { if (observers.empty()) return; @@ -60,33 +55,29 @@ public: memcpy(&cmd, command_data, sizeof(GSP_GPU::Command)); ForEachObserver([this](DebuggerObserver* observer) { - observer->GXCommandProcessed(static_cast<int>(this->gx_command_history.size())); - } ); + observer->GXCommandProcessed(static_cast<int>(this->gx_command_history.size())); + }); } - const GSP_GPU::Command& ReadGXCommandHistory(int index) const - { + const GSP_GPU::Command& ReadGXCommandHistory(int index) const { // TODO: Is this thread-safe? return gx_command_history[index]; } - void RegisterObserver(DebuggerObserver* observer) - { + void RegisterObserver(DebuggerObserver* observer) { // TODO: Check for duplicates observers.push_back(observer); observer->observed = this; } - void UnregisterObserver(DebuggerObserver* observer) - { + void UnregisterObserver(DebuggerObserver* observer) { observers.erase(std::remove(observers.begin(), observers.end(), observer), observers.end()); observer->observed = nullptr; } private: - void ForEachObserver(std::function<void (DebuggerObserver*)> func) - { - std::for_each(observers.begin(),observers.end(), func); + void ForEachObserver(std::function<void(DebuggerObserver*)> func) { + std::for_each(observers.begin(), observers.end(), func); } std::vector<DebuggerObserver*> observers; |