diff options
| author | 2016-04-25 21:37:43 -0400 | |
|---|---|---|
| committer | 2016-04-25 21:37:43 -0400 | |
| commit | 15c907317c269e06fcfeddbf98abdcb1e5e135c8 (patch) | |
| tree | 91a2463392ed42a39513df149d321ba7183b6b51 | |
| parent | Merge pull request #1714 from smspillaz/fix-1711 (diff) | |
| parent | Replace std::map with std::array for graphics event breakpoints, and allow th... (diff) | |
| download | yuzu-15c907317c269e06fcfeddbf98abdcb1e5e135c8.tar.gz yuzu-15c907317c269e06fcfeddbf98abdcb1e5e135c8.tar.xz yuzu-15c907317c269e06fcfeddbf98abdcb1e5e135c8.zip | |
Merge pull request #1710 from hrydgard/optimize-event-breakpoints
Replace std::map with std::array for graphics event breakpoints
Diffstat (limited to '')
| -rw-r--r-- | src/citra_qt/debugger/graphics_breakpoints.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.h | 16 |
3 files changed, 16 insertions, 9 deletions
diff --git a/src/citra_qt/debugger/graphics_breakpoints.cpp b/src/citra_qt/debugger/graphics_breakpoints.cpp index 819ec7707..c8510128a 100644 --- a/src/citra_qt/debugger/graphics_breakpoints.cpp +++ b/src/citra_qt/debugger/graphics_breakpoints.cpp | |||
| @@ -75,7 +75,7 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const | |||
| 75 | case Role_IsEnabled: | 75 | case Role_IsEnabled: |
| 76 | { | 76 | { |
| 77 | auto context = context_weak.lock(); | 77 | auto context = context_weak.lock(); |
| 78 | return context && context->breakpoints[event].enabled; | 78 | return context && context->breakpoints[(int)event].enabled; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | default: | 81 | default: |
| @@ -110,7 +110,7 @@ bool BreakPointModel::setData(const QModelIndex& index, const QVariant& value, i | |||
| 110 | if (!context) | 110 | if (!context) |
| 111 | return false; | 111 | return false; |
| 112 | 112 | ||
| 113 | context->breakpoints[event].enabled = value == Qt::Checked; | 113 | context->breakpoints[(int)event].enabled = value == Qt::Checked; |
| 114 | QModelIndex changed_index = createIndex(index.row(), 0); | 114 | QModelIndex changed_index = createIndex(index.row(), 0); |
| 115 | emit dataChanged(changed_index, changed_index); | 115 | emit dataChanged(changed_index, changed_index); |
| 116 | return true; | 116 | return true; |
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index 1f058c4e2..178a566f7 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp | |||
| @@ -40,10 +40,7 @@ using nihstro::DVLPHeader; | |||
| 40 | 40 | ||
| 41 | namespace Pica { | 41 | namespace Pica { |
| 42 | 42 | ||
| 43 | void DebugContext::OnEvent(Event event, void* data) { | 43 | void DebugContext::DoOnEvent(Event event, void* data) { |
| 44 | if (!breakpoints[event].enabled) | ||
| 45 | return; | ||
| 46 | |||
| 47 | { | 44 | { |
| 48 | std::unique_lock<std::mutex> lock(breakpoint_mutex); | 45 | std::unique_lock<std::mutex> lock(breakpoint_mutex); |
| 49 | 46 | ||
diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index 7df941619..56f9bd958 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h | |||
| @@ -114,7 +114,15 @@ public: | |||
| 114 | * @param event Event which has happened | 114 | * @param event Event which has happened |
| 115 | * @param data Optional data pointer (pass nullptr if unused). Needs to remain valid until Resume() is called. | 115 | * @param data Optional data pointer (pass nullptr if unused). Needs to remain valid until Resume() is called. |
| 116 | */ | 116 | */ |
| 117 | void OnEvent(Event event, void* data); | 117 | void OnEvent(Event event, void* data) { |
| 118 | // This check is left in the header to allow the compiler to inline it. | ||
| 119 | if (!breakpoints[(int)event].enabled) | ||
| 120 | return; | ||
| 121 | // For the rest of event handling, call a separate function. | ||
| 122 | DoOnEvent(event, data); | ||
| 123 | } | ||
| 124 | |||
| 125 | void DoOnEvent(Event event, void *data); | ||
| 118 | 126 | ||
| 119 | /** | 127 | /** |
| 120 | * Resume from the current breakpoint. | 128 | * Resume from the current breakpoint. |
| @@ -126,12 +134,14 @@ public: | |||
| 126 | * Delete all set breakpoints and resume emulation. | 134 | * Delete all set breakpoints and resume emulation. |
| 127 | */ | 135 | */ |
| 128 | void ClearBreakpoints() { | 136 | void ClearBreakpoints() { |
| 129 | breakpoints.clear(); | 137 | for (auto &bp : breakpoints) { |
| 138 | bp.enabled = false; | ||
| 139 | } | ||
| 130 | Resume(); | 140 | Resume(); |
| 131 | } | 141 | } |
| 132 | 142 | ||
| 133 | // TODO: Evaluate if access to these members should be hidden behind a public interface. | 143 | // TODO: Evaluate if access to these members should be hidden behind a public interface. |
| 134 | std::map<Event, BreakPoint> breakpoints; | 144 | std::array<BreakPoint, (int)Event::NumEvents> breakpoints; |
| 135 | Event active_breakpoint; | 145 | Event active_breakpoint; |
| 136 | bool at_breakpoint = false; | 146 | bool at_breakpoint = false; |
| 137 | 147 | ||