diff options
| author | 2016-04-24 14:19:49 +0200 | |
|---|---|---|
| committer | 2016-04-24 14:19:49 +0200 | |
| commit | 01a1555b5d6d6b560c3168b76e5235175e7d081b (patch) | |
| tree | 967156d129f91b2887560028f17856f121bd25e3 /src/video_core | |
| parent | Merge pull request #1576 from smspillaz/fix-build-errors-03272016 (diff) | |
| download | yuzu-01a1555b5d6d6b560c3168b76e5235175e7d081b.tar.gz yuzu-01a1555b5d6d6b560c3168b76e5235175e7d081b.tar.xz yuzu-01a1555b5d6d6b560c3168b76e5235175e7d081b.zip | |
Replace std::map with std::array for graphics event breakpoints, and allow the compiler to inline. Saves 1%+ in vertex heavy situations.
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.h | 16 |
2 files changed, 14 insertions, 7 deletions
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 | ||