]> git.cworth.org Git - apitrace/blobdiff - gui/retracer.cpp
Preserve both D3D9 shader byte code, and disassembly.
[apitrace] / gui / retracer.cpp
index d0e07ef9f4d54066e56042ed8df7ae16fd036427..69dca6c6b26f542845b5857952177692210f19e7 100644 (file)
@@ -220,7 +220,7 @@ void Retracer::setCaptureThumbnails(bool enable)
  */
 void Retracer::run()
 {
-    QString msg;
+    QString msg = QLatin1String("Replay finished!");
 
     /*
      * Construct command line
@@ -229,11 +229,28 @@ void Retracer::run()
     QString prog;
     QStringList arguments;
 
-    if (m_api == trace::API_GL) {
+    switch (m_api) {
+    case trace::API_GL:
         prog = QLatin1String("glretrace");
-    } else if (m_api == trace::API_EGL) {
+        break;
+    case trace::API_EGL:
         prog = QLatin1String("eglretrace");
-    } else {
+        break;
+    case trace::API_DX:
+    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:
+#ifdef Q_OS_WIN
+        prog = QLatin1String("d3dretrace");
+#else
+        prog = QLatin1String("wine");
+        arguments << QLatin1String("d3dretrace.exe");
+#endif
+        break;
+    default:
         emit finished(QLatin1String("Unsupported API"));
         return;
     }
@@ -283,8 +300,6 @@ void Retracer::run()
             /*
              * Parse JSON from the output.
              *
-             * XXX: QJSON expects blocking IO.
-             *
              * XXX: QJSON's scanner is inneficient as it abuses single
              * character QIODevice::peek (not cheap), instead of maintaining a
              * lookahead character on its own.
@@ -292,7 +307,16 @@ void Retracer::run()
 
             bool ok = false;
             QJson::Parser jsonParser;
+#if 0
             parsedJson = jsonParser.parse(&io, &ok).toMap();
+#else
+            /*
+             * XXX: QJSON expects blocking IO, and it looks like
+             * BlockingIODevice does not work reliably in all cases.
+             */
+            process.waitForFinished(-1);
+            parsedJson = jsonParser.parse(&process, &ok).toMap();
+#endif
             if (!ok) {
                 msg = QLatin1String("failed to parse JSON");
             }
@@ -349,7 +373,9 @@ void Retracer::run()
         } else {
             QByteArray output;
             output = process.readAllStandardOutput();
-            msg = QString::fromUtf8(output);
+            if (output.length() < 80) {
+                msg = QString::fromUtf8(output);
+            }
         }
     }