diff options
author | Mark Janes <mark.a.janes@intel.com> | 2017-09-18 16:17:12 -0700 |
---|---|---|
committer | Mark Janes <mark.a.janes@intel.com> | 2017-09-18 16:17:12 -0700 |
commit | 2a039171d780f7d3df7bd9adabc4c08ef9a9bdc7 (patch) | |
tree | ae9646454d9e97da67154c87b9a230afefe90f4f /retrace | |
parent | d10810eb71b635705c3d3cf79b540a1302930573 (diff) |
Retrace: Order retrace operations based on the visible tab
Reduces UI latency for long duration frames.
Diffstat (limited to 'retrace')
-rw-r--r-- | retrace/daemon/ui/glframe_metrics_model.cpp | 4 | ||||
-rw-r--r-- | retrace/daemon/ui/glframe_retrace_model.cpp | 67 | ||||
-rw-r--r-- | retrace/daemon/ui/glframe_retrace_model.hpp | 15 | ||||
-rw-r--r-- | retrace/daemon/ui/qml/mainwin.qml | 5 |
4 files changed, 77 insertions, 14 deletions
diff --git a/retrace/daemon/ui/glframe_metrics_model.cpp b/retrace/daemon/ui/glframe_metrics_model.cpp index 6ba3597b..f8623147 100644 --- a/retrace/daemon/ui/glframe_metrics_model.cpp +++ b/retrace/daemon/ui/glframe_metrics_model.cpp @@ -107,10 +107,6 @@ QMetricsModel::init(IFrameRetrace *r, s.id = m_current_selection_count; s.series.push_back(RenderSequence(RenderId(0), RenderId(render_count))); m_retrace->retraceAllMetrics(s, m_experiment_count, this); - connect(qs, &QSelection::onSelect, - this, &QMetricsModel::onSelect); - connect(qs, &QSelection::onExperiment, - this, &QMetricsModel::onExperiment); emit onMetricsChanged(); } diff --git a/retrace/daemon/ui/glframe_retrace_model.cpp b/retrace/daemon/ui/glframe_retrace_model.cpp index 2d9efd1d..6890265a 100644 --- a/retrace/daemon/ui/glframe_retrace_model.cpp +++ b/retrace/daemon/ui/glframe_retrace_model.cpp @@ -425,11 +425,34 @@ FrameRetraceModel::onSelect(SelectionId id, QList<int> selection) { ScopedLock s(m_protect); m_cached_selection = selection; m_selection_count = id; - retraceRendertarget(); - retrace_shader_assemblies(); - retrace_api(); - retrace_batch(); - retrace_uniforms(); + + // refresh currently visible tab + if (m_current_tab == kRenderTarget) + retraceRendertarget(); + if (m_current_tab == kShaders) + retrace_shader_assemblies(); + if (m_current_tab == kApiCalls) + retrace_api(); + if (m_current_tab == kBatch) + retrace_batch(); + if (m_current_tab == kUniforms) + retrace_uniforms(); + if (m_current_tab == kMetrics) + m_metrics_table.onSelect(id, selection); + + // refresh other tabs + if (m_current_tab != kRenderTarget) + retraceRendertarget(); + if (m_current_tab != kShaders) + retrace_shader_assemblies(); + if (m_current_tab != kApiCalls) + retrace_api(); + if (m_current_tab != kBatch) + retrace_batch(); + if (m_current_tab != kUniforms) + retrace_uniforms(); + if (m_current_tab != kMetrics) + m_metrics_table.onSelect(id, selection); } void @@ -531,11 +554,32 @@ void FrameRetraceModel::onExperiment(ExperimentId experiment_count) { ScopedLock s(m_protect); m_experiment_count = experiment_count; - retraceRendertarget(); + refreshBarMetrics(); - retrace_shader_assemblies(); - retrace_batch(); - retrace_uniforms(); + + // refresh the currently shown tab + if (m_current_tab == kRenderTarget) + retraceRendertarget(); + if (m_current_tab == kShaders) + retrace_shader_assemblies(); + if (m_current_tab == kBatch) + retrace_batch(); + if (m_current_tab == kUniforms) + retrace_uniforms(); + if (m_current_tab == kMetrics) + m_metrics_table.onExperiment(experiment_count); + + // refresh the rest of the tabs + if (m_current_tab != kRenderTarget) + retraceRendertarget(); + if (m_current_tab != kShaders) + retrace_shader_assemblies(); + if (m_current_tab != kBatch) + retrace_batch(); + if (m_current_tab != kUniforms) + retrace_uniforms(); + if (m_current_tab != kMetrics) + m_metrics_table.onExperiment(experiment_count); } void @@ -559,3 +603,8 @@ FrameRetraceModel::retrace_uniforms() { m_uniforms->clear(); m_retrace.retraceUniform(sel, m_experiment_count, this); } + +void +FrameRetraceModel::setTab(const int index) { + m_current_tab = static_cast<TabIndex>(index); +} diff --git a/retrace/daemon/ui/glframe_retrace_model.hpp b/retrace/daemon/ui/glframe_retrace_model.hpp index c23e5b32..07579e4c 100644 --- a/retrace/daemon/ui/glframe_retrace_model.hpp +++ b/retrace/daemon/ui/glframe_retrace_model.hpp @@ -136,6 +136,8 @@ class FrameRetraceModel : public QObject, Q_INVOKABLE void refreshMetrics(); Q_INVOKABLE void filterMetrics(const QString &f); Q_INVOKABLE QString urlToFilePath(const QUrl &url); + Q_INVOKABLE void setTab(const int index); + QQmlListProperty<QRenderBookmark> renders(); QQmlListProperty<QMetric> metricList(); QSelection *selection(); @@ -227,6 +229,16 @@ class FrameRetraceModel : public QObject, void retrace_uniforms(); void refreshBarMetrics(); + enum TabIndex { + kShaders = 0, + kRenderTarget, + kApiCalls, + kBatch, + kMetrics, + kExperiments, + kUniforms + }; + mutable std::mutex m_protect; FrameRetraceStub m_retrace; QMetricsModel m_metrics_table; @@ -246,7 +258,7 @@ class FrameRetraceModel : public QObject, QRenderShadersList m_shaders; QString m_shader_compile_error; - QString main_exe; // for path to frame_retrace_server + QString main_exe; // for path to frameretrace_server int m_target_frame_number, m_open_percent, m_frame_count; @@ -259,6 +271,7 @@ class FrameRetraceModel : public QObject, float m_max_metric; QString m_general_error, m_general_error_details; Severity m_severity; + TabIndex m_current_tab; }; } // namespace glretrace diff --git a/retrace/daemon/ui/qml/mainwin.qml b/retrace/daemon/ui/qml/mainwin.qml index f270c15b..6ef554a8 100644 --- a/retrace/daemon/ui/qml/mainwin.qml +++ b/retrace/daemon/ui/qml/mainwin.qml @@ -324,6 +324,11 @@ ApplicationWindow { Layout.alignment: Qt.AlignTop Layout.fillWidth: true Layout.fillHeight: true + + onCurrentIndexChanged: { + frameRetrace.setTab(currentIndex); + } + Tab { title: "Shaders" anchors.fill: parent |