diff options
author | Mark Janes <mark.a.janes@intel.com> | 2017-03-10 03:12:04 -0800 |
---|---|---|
committer | Mark Janes <mark.a.janes@intel.com> | 2017-06-19 14:04:50 -0700 |
commit | 8a7dc8ccfa0a10d93e53c1f0ab1c3dfd7b6dd9c9 (patch) | |
tree | 83c608983523af2c2559d9e8623a7e400cbde196 | |
parent | 21080f6a6dcf015110d689575ec795621e7fdc93 (diff) |
OpenFile: Display frame count during retrace
This information helps the user select an interesting frame for
analysis.
Requested-by: Eero Tamminen <eero.t.tamminen@intel.com>
-rw-r--r-- | retrace/daemon/glframe_retrace.cpp | 4 | ||||
-rw-r--r-- | retrace/daemon/glframe_retrace_interface.hpp | 2 | ||||
-rw-r--r-- | retrace/daemon/glframe_retrace_skeleton.cpp | 4 | ||||
-rw-r--r-- | retrace/daemon/glframe_retrace_skeleton.hpp | 2 | ||||
-rw-r--r-- | retrace/daemon/glframe_retrace_stub.cpp | 2 | ||||
-rw-r--r-- | retrace/daemon/playback.proto | 2 | ||||
-rw-r--r-- | retrace/daemon/test/retrace_daemon_test.cpp | 2 | ||||
-rw-r--r-- | retrace/daemon/test/retrace_file_transfer_test.cpp | 4 | ||||
-rw-r--r-- | retrace/daemon/test/retrace_metrics_test.cpp | 2 | ||||
-rw-r--r-- | retrace/daemon/ui/glframe_metrics_model.hpp | 2 | ||||
-rw-r--r-- | retrace/daemon/ui/glframe_retrace_model.cpp | 16 | ||||
-rw-r--r-- | retrace/daemon/ui/glframe_retrace_model.hpp | 10 | ||||
-rw-r--r-- | retrace/daemon/ui/qml/mainwin.qml | 23 |
13 files changed, 43 insertions, 32 deletions
diff --git a/retrace/daemon/glframe_retrace.cpp b/retrace/daemon/glframe_retrace.cpp index 105ddd4f..58929bb7 100644 --- a/retrace/daemon/glframe_retrace.cpp +++ b/retrace/daemon/glframe_retrace.cpp @@ -140,7 +140,7 @@ FrameRetrace::openFile(const std::string &filename, delete call; if (frame_boundary) { ++current_frame; - callback->onFileOpening(false, false, current_frame * 100 / framenumber); + callback->onFileOpening(false, false, current_frame); if (current_frame == framenumber) break; } @@ -178,7 +178,7 @@ FrameRetrace::openFile(const std::string &filename, // record the final render as ending a render target region render_target_regions.push_back(RenderId(m_renders.size() - 1)); - callback->onFileOpening(false, true, 100); + callback->onFileOpening(false, true, current_frame); } int diff --git a/retrace/daemon/glframe_retrace_interface.hpp b/retrace/daemon/glframe_retrace_interface.hpp index 9e50c593..5ef4e2d5 100644 --- a/retrace/daemon/glframe_retrace_interface.hpp +++ b/retrace/daemon/glframe_retrace_interface.hpp @@ -211,7 +211,7 @@ class OnFrameRetrace { typedef std::vector<unsigned char> uvec; virtual void onFileOpening(bool needUpload, bool finished, - uint32_t percent_complete) = 0; + uint32_t frame_count) = 0; virtual void onShaderAssembly(RenderId renderId, SelectionId selectionCount, const ShaderAssembly &vertex, diff --git a/retrace/daemon/glframe_retrace_skeleton.cpp b/retrace/daemon/glframe_retrace_skeleton.cpp index 3ae3835c..c3201e44 100644 --- a/retrace/daemon/glframe_retrace_skeleton.cpp +++ b/retrace/daemon/glframe_retrace_skeleton.cpp @@ -304,12 +304,12 @@ FrameRetraceSkeleton::Run() { void FrameRetraceSkeleton::onFileOpening(bool needUpload, bool finished, - uint32_t percent_complete) { + uint32_t frame_count) { RetraceResponse proto_response; auto status = proto_response.mutable_filestatus(); status->set_needs_upload(needUpload); status->set_finished(finished); - status->set_percent_complete(percent_complete); + status->set_frame_count(frame_count); writeResponse(m_socket, proto_response, &m_buf); } diff --git a/retrace/daemon/glframe_retrace_skeleton.hpp b/retrace/daemon/glframe_retrace_skeleton.hpp index b2d727cc..4a9015ab 100644 --- a/retrace/daemon/glframe_retrace_skeleton.hpp +++ b/retrace/daemon/glframe_retrace_skeleton.hpp @@ -64,7 +64,7 @@ class FrameRetraceSkeleton : public Thread, const ShaderAssembly &comp_shader); virtual void onFileOpening(bool needs_upload, bool finished, - uint32_t percent_complete); + uint32_t frame_count); virtual void onRenderTarget(SelectionId selectionCount, ExperimentId experimentCount, const uvec & pngImageData); diff --git a/retrace/daemon/glframe_retrace_stub.cpp b/retrace/daemon/glframe_retrace_stub.cpp index bdda0747..23f6a362 100644 --- a/retrace/daemon/glframe_retrace_stub.cpp +++ b/retrace/daemon/glframe_retrace_stub.cpp @@ -348,7 +348,7 @@ class RetraceOpenFileRequest: public IRetraceRequest { if (m_callback) m_callback->onFileOpening(status.needs_upload(), status.finished(), - status.percent_complete()); + status.frame_count()); if (status.finished()) break; } else if (response.has_error()) { diff --git a/retrace/daemon/playback.proto b/retrace/daemon/playback.proto index b0df73ca..c09b1adf 100644 --- a/retrace/daemon/playback.proto +++ b/retrace/daemon/playback.proto @@ -26,7 +26,7 @@ message OpenFileRequest { message OpenFileStatus { required bool needs_upload = 1; required bool finished = 2; - required uint32 percent_complete = 3; + required uint32 frame_count = 3; } message MetricsList { diff --git a/retrace/daemon/test/retrace_daemon_test.cpp b/retrace/daemon/test/retrace_daemon_test.cpp index 9c9ce837..62d8e147 100644 --- a/retrace/daemon/test/retrace_daemon_test.cpp +++ b/retrace/daemon/test/retrace_daemon_test.cpp @@ -62,7 +62,7 @@ class NullCallback : public OnFrameRetrace { public: void onFileOpening(bool needUpload, bool finished, - uint32_t percent_complete) {} + uint32_t frame_count) {} void onShaderAssembly(RenderId renderId, SelectionId selectionCount, const ShaderAssembly &vertex, diff --git a/retrace/daemon/test/retrace_file_transfer_test.cpp b/retrace/daemon/test/retrace_file_transfer_test.cpp index d457c76e..25aa62b3 100644 --- a/retrace/daemon/test/retrace_file_transfer_test.cpp +++ b/retrace/daemon/test/retrace_file_transfer_test.cpp @@ -63,7 +63,7 @@ class FileTransfer : public IFrameRetrace { uint64_t fileSize, uint32_t frameNumber, OnFrameRetrace *callback) { - callback->onFileOpening(false, true, 101); + callback->onFileOpening(false, true, frameNumber + 1); } void retraceRenderTarget(ExperimentId experimentCount, const RenderSelection &selection, @@ -96,7 +96,7 @@ class FileTransferCB : public OnFrameRetrace { FileTransferCB() : m_needUpload(false) {} void onFileOpening(bool needUpload, bool finished, - uint32_t percent_complete) { + uint32_t frame_count) { m_needUpload |= needUpload; } void onShaderAssembly(RenderId renderId, diff --git a/retrace/daemon/test/retrace_metrics_test.cpp b/retrace/daemon/test/retrace_metrics_test.cpp index ad5102b1..22aa4c25 100644 --- a/retrace/daemon/test/retrace_metrics_test.cpp +++ b/retrace/daemon/test/retrace_metrics_test.cpp @@ -42,7 +42,7 @@ class MetricsCallback : public OnFrameRetrace { public: void onFileOpening(bool needUpload, bool finished, - uint32_t percent_complete) {} + uint32_t frame_count) {} void onShaderAssembly(RenderId renderId, SelectionId sc, const ShaderAssembly &vertex, diff --git a/retrace/daemon/ui/glframe_metrics_model.hpp b/retrace/daemon/ui/glframe_metrics_model.hpp index 376e0d2d..4c17e15c 100644 --- a/retrace/daemon/ui/glframe_metrics_model.hpp +++ b/retrace/daemon/ui/glframe_metrics_model.hpp @@ -93,7 +93,7 @@ class QMetricsModel : public QObject, OnFrameRetrace, int render_count); void onFileOpening(bool needUpload, bool finished, - uint32_t percent_complete) { assert(false); } + uint32_t frame_count) { assert(false); } void onShaderAssembly(RenderId renderId, SelectionId selectionCount, const ShaderAssembly &vertex, diff --git a/retrace/daemon/ui/glframe_retrace_model.cpp b/retrace/daemon/ui/glframe_retrace_model.cpp index 770f87ad..1a18f45d 100644 --- a/retrace/daemon/ui/glframe_retrace_model.cpp +++ b/retrace/daemon/ui/glframe_retrace_model.cpp @@ -64,6 +64,7 @@ FrameRetraceModel::FrameRetraceModel() : m_state(NULL), m_selection(NULL), m_selection_count(0), m_open_percent(0), + m_frame_count(0), m_max_metric(0), m_clear_before_render(false), m_stop_at_render(false), @@ -158,6 +159,7 @@ FrameRetraceModel::setFrame(const QString &filename, int framenumber, // conforms better to the interfaces, but blocks the UI. std::vector<unsigned char> md5; + m_target_frame_number = framenumber; m_retrace.openFile(filename.toStdString(), md5, 0, framenumber, this); @@ -279,27 +281,29 @@ FrameRetraceModel::retrace_api() { void FrameRetraceModel::onFileOpening(bool needUpload, bool finished, - uint32_t percent_complete) { + uint32_t frame_count) { ScopedLock s(m_protect); if (finished) { + m_open_percent = 101; const int rcount = m_state->getRenderCount(); for (int i = 0; i < rcount; ++i) { m_renders_model.append(new QRenderBookmark(i)); } emit onRenders(); - m_open_percent = 101; - // trace initial metrics (GPU Time Elapsed, if available) std::vector<MetricId> t_metrics(1); t_metrics[0] = m_active_metrics[0]; m_retrace.retraceMetrics(t_metrics, ExperimentId(0), this); } - if (m_open_percent == percent_complete) + int percent = frame_count * 100 / m_target_frame_number; + if (m_open_percent == percent) + // do not update the progress bar return; - m_open_percent = percent_complete; - emit onOpenPercent(); + m_open_percent = percent; + m_frame_count = frame_count; + emit onFrameCount(); } void diff --git a/retrace/daemon/ui/glframe_retrace_model.hpp b/retrace/daemon/ui/glframe_retrace_model.hpp index a874df09..4d4431d4 100644 --- a/retrace/daemon/ui/glframe_retrace_model.hpp +++ b/retrace/daemon/ui/glframe_retrace_model.hpp @@ -100,7 +100,7 @@ class FrameRetraceModel : public QObject, READ selection WRITE setSelection); Q_PROPERTY(QString renderTargetImage READ renderTargetImage NOTIFY onRenderTarget) - Q_PROPERTY(int openPercent READ openPercent NOTIFY onOpenPercent) + Q_PROPERTY(int frameCount READ frameCount NOTIFY onFrameCount) Q_PROPERTY(float maxMetric READ maxMetric NOTIFY onMaxMetric) Q_PROPERTY(bool clearBeforeRender READ clearBeforeRender WRITE setClearBeforeRender) @@ -140,7 +140,7 @@ class FrameRetraceModel : public QObject, void setSelection(QSelection *s); void onFileOpening(bool needUpload, bool finished, - uint32_t percent_complete); + uint32_t frame_count); void onShaderAssembly(RenderId renderId, SelectionId selectionCount, const ShaderAssembly &vertex, @@ -168,7 +168,7 @@ class FrameRetraceModel : public QObject, void onError(ErrorSeverity s, const std::string &message); void onShadersChanged(); QString renderTargetImage() const; - int openPercent() const { ScopedLock s(m_protect); return m_open_percent; } + int frameCount() const { ScopedLock s(m_protect); return m_frame_count; } float maxMetric() const { ScopedLock s(m_protect); return m_max_metric; } QString apiCalls(); QRenderShadersList *shaders() { return &m_shaders; } @@ -201,7 +201,7 @@ class FrameRetraceModel : public QObject, void onQMetricData(QList<glretrace::BarMetrics> metrics); void onRenders(); void onRenderTarget(); - void onOpenPercent(); + void onFrameCount(); void onMaxMetric(); void onApiCalls(); void onShaderCompileError(); @@ -232,7 +232,7 @@ class FrameRetraceModel : public QObject, QString m_shader_compile_error; QString main_exe; // for path to frame_retrace_server - int m_open_percent; + int m_target_frame_number, m_open_percent, m_frame_count; // thread-safe storage for member data updated from the retrace // socket thread. diff --git a/retrace/daemon/ui/qml/mainwin.qml b/retrace/daemon/ui/qml/mainwin.qml index 9ab011fc..a94043fc 100644 --- a/retrace/daemon/ui/qml/mainwin.qml +++ b/retrace/daemon/ui/qml/mainwin.qml @@ -19,9 +19,9 @@ ApplicationWindow { id : frameRetrace selection: selection argvZero: Qt.application.arguments[0] - onOpenPercentChanged: { - if (openPercent < 100) { - progressBar.percentComplete = openPercent; + onFrameCountChanged: { + if (frameCount < progressBar.targetFrame) { + progressBar.frameCount = frameCount; return; } progressBar.visible = false; @@ -219,8 +219,9 @@ ApplicationWindow { text: "OK" onClicked: { if (frameRetrace.setFrame(textInput.text, frameInput.text, hostInput.text)) { - openfile.visible = false - progressBar.visible = true + openfile.visible = false; + progressBar.visible = true; + progressBar.targetFrame = parseInt(frameInput.text, 10); } else { fileError.text = "File not found:\n\t" + textInput.text; fileError.visible = true; @@ -253,9 +254,10 @@ ApplicationWindow { id: progressBar visible: false anchors.fill: parent - property int percentComplete - onPercentCompleteChanged: { - blueBar.width = percentComplete / 100 * progressBackground.width + property int frameCount + property int targetFrame + onFrameCountChanged: { + blueBar.width = frameCount / targetFrame * progressBackground.width } Rectangle { id: progressBackground @@ -273,6 +275,11 @@ ApplicationWindow { height: 20 z:1 } + Text { + anchors.left: progressBackground.left + anchors.top: progressBackground.bottom + text: "Playing frame: " + progressBar.frameCount.toString() + } } ColumnLayout { id: mainUI |