]> git.cworth.org Git - apitrace/blobdiff - gui/retracer.cpp
qapitrace: Support executing glretrace on a remote target host.
[apitrace] / gui / retracer.cpp
index 592c1a4215d66bf947294236c953bf71beb00d1a..2de9d23ee849de85f12c6cbf51461750ba7edf68 100644 (file)
@@ -3,7 +3,7 @@
 #include "apitracecall.h"
 #include "thumbnail.h"
 
-#include "image.hpp"
+#include "image/image.hpp"
 
 #include "trace_profiler.hpp"
 
@@ -137,19 +137,6 @@ Retracer::Retracer(QObject *parent)
       m_profilePixels(false)
 {
     qRegisterMetaType<QList<ApiTraceError> >();
-
-#ifdef Q_OS_WIN
-    QString format = QLatin1String("%1;");
-#else
-    QString format = QLatin1String("%1:");
-#endif
-    QString buildPath = format.arg(APITRACE_BINARY_DIR);
-    m_processEnvironment = QProcessEnvironment::systemEnvironment();
-    m_processEnvironment.insert("PATH", buildPath +
-                                m_processEnvironment.value("PATH"));
-
-    qputenv("PATH",
-            m_processEnvironment.value("PATH").toLatin1());
 }
 
 QString Retracer::fileName() const
@@ -162,6 +149,16 @@ void Retracer::setFileName(const QString &name)
     m_fileName = name;
 }
 
+QString Retracer::remoteTarget() const
+{
+    return m_remoteTarget;
+}
+
+void Retracer::setRemoteTarget(const QString &host)
+{
+    m_remoteTarget = host;
+}
+
 void Retracer::setAPI(trace::API api)
 {
     m_api = api;
@@ -271,9 +268,7 @@ void Retracer::run()
     case trace::API_D3D7:
     case trace::API_D3D8:
     case trace::API_D3D9:
-    case trace::API_D3D10:
-    case trace::API_D3D10_1:
-    case trace::API_D3D11:
+    case trace::API_DXGI:
 #ifdef Q_OS_WIN
         prog = QLatin1String("d3dretrace");
 #else
@@ -294,21 +289,21 @@ void Retracer::run()
         arguments << QLatin1String("-"); // emit to stdout
     } else if (isProfiling()) {
         if (m_profileGpu) {
-            arguments << QLatin1String("-pgpu");
+            arguments << QLatin1String("--pgpu");
         }
 
         if (m_profileCpu) {
-            arguments << QLatin1String("-pcpu");
+            arguments << QLatin1String("--pcpu");
         }
 
         if (m_profilePixels) {
-            arguments << QLatin1String("-ppd");
+            arguments << QLatin1String("--ppd");
         }
     } else {
         if (m_doubleBuffered) {
-            arguments << QLatin1String("-db");
+            arguments << QLatin1String("--db");
         } else {
-            arguments << QLatin1String("-sb");
+            arguments << QLatin1String("--sb");
         }
 
         if (m_benchmarking) {
@@ -318,6 +313,16 @@ void Retracer::run()
 
     arguments << m_fileName;
 
+    /*
+     * Support remote execution on a separate target.
+     */
+
+    if (m_remoteTarget.length() != 0) {
+        arguments.prepend(prog);
+        arguments.prepend(m_remoteTarget);
+        prog = QLatin1String("ssh");
+    }
+
     /*
      * Start the process.
      */
@@ -353,6 +358,9 @@ void Retracer::run()
 
             bool ok = false;
             QJson::Parser jsonParser;
+
+            // Allow Nan/Infinity
+            jsonParser.allowSpecialNumbers(true);
 #if 0
             parsedJson = jsonParser.parse(&io, &ok).toMap();
 #else
@@ -408,6 +416,7 @@ void Retracer::run()
                     unsigned char *scanLine = snapshot.scanLine(y);
                     qint64 readBytes = io.read((char *) scanLine, rowBytes);
                     Q_ASSERT(readBytes == rowBytes);
+                    (void)readBytes;
                 }
 
                 QImage thumb = thumbnail(snapshot);
@@ -483,7 +492,6 @@ void Retracer::run()
     if (m_captureState) {
         ApiTraceState *state = new ApiTraceState(parsedJson);
         emit foundState(state);
-        msg = QLatin1String("State fetched.");
     }
 
     if (m_captureThumbnails && !thumbnails.isEmpty()) {