summaryrefslogtreecommitdiffstats
path: root/src/video_core/gpu_debugger.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/video_core/gpu_debugger.h41
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;