summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2016-04-26 03:37:43 +0200
committerbunnei <bunneidev@gmail.com>2016-04-26 03:37:43 +0200
commit15c907317c269e06fcfeddbf98abdcb1e5e135c8 (patch)
tree91a2463392ed42a39513df149d321ba7183b6b51 /src
parentMerge pull request #1714 from smspillaz/fix-1711 (diff)
parentReplace std::map with std::array for graphics event breakpoints, and allow the compiler to inline. Saves 1%+ in vertex heavy situations. (diff)
downloadyuzu-15c907317c269e06fcfeddbf98abdcb1e5e135c8.tar
yuzu-15c907317c269e06fcfeddbf98abdcb1e5e135c8.tar.gz
yuzu-15c907317c269e06fcfeddbf98abdcb1e5e135c8.tar.bz2
yuzu-15c907317c269e06fcfeddbf98abdcb1e5e135c8.tar.lz
yuzu-15c907317c269e06fcfeddbf98abdcb1e5e135c8.tar.xz
yuzu-15c907317c269e06fcfeddbf98abdcb1e5e135c8.tar.zst
yuzu-15c907317c269e06fcfeddbf98abdcb1e5e135c8.zip
Diffstat (limited to 'src')
-rw-r--r--src/citra_qt/debugger/graphics_breakpoints.cpp4
-rw-r--r--src/video_core/debug_utils/debug_utils.cpp5
-rw-r--r--src/video_core/debug_utils/debug_utils.h16
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
case Role_IsEnabled:
{
auto context = context_weak.lock();
- return context && context->breakpoints[event].enabled;
+ return context && context->breakpoints[(int)event].enabled;
}
default:
@@ -110,7 +110,7 @@ bool BreakPointModel::setData(const QModelIndex& index, const QVariant& value, i
if (!context)
return false;
- context->breakpoints[event].enabled = value == Qt::Checked;
+ context->breakpoints[(int)event].enabled = value == Qt::Checked;
QModelIndex changed_index = createIndex(index.row(), 0);
emit dataChanged(changed_index, changed_index);
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;
namespace Pica {
-void DebugContext::OnEvent(Event event, void* data) {
- if (!breakpoints[event].enabled)
- return;
-
+void DebugContext::DoOnEvent(Event event, void* data) {
{
std::unique_lock<std::mutex> lock(breakpoint_mutex);
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:
* @param event Event which has happened
* @param data Optional data pointer (pass nullptr if unused). Needs to remain valid until Resume() is called.
*/
- void OnEvent(Event event, void* data);
+ void OnEvent(Event event, void* data) {
+ // This check is left in the header to allow the compiler to inline it.
+ if (!breakpoints[(int)event].enabled)
+ return;
+ // For the rest of event handling, call a separate function.
+ DoOnEvent(event, data);
+ }
+
+ void DoOnEvent(Event event, void *data);
/**
* Resume from the current breakpoint.
@@ -126,12 +134,14 @@ public:
* Delete all set breakpoints and resume emulation.
*/
void ClearBreakpoints() {
- breakpoints.clear();
+ for (auto &bp : breakpoints) {
+ bp.enabled = false;
+ }
Resume();
}
// TODO: Evaluate if access to these members should be hidden behind a public interface.
- std::map<Event, BreakPoint> breakpoints;
+ std::array<BreakPoint, (int)Event::NumEvents> breakpoints;
Event active_breakpoint;
bool at_breakpoint = false;