]> git.cworth.org Git - apitrace/commitdiff
Allow to retrace with EGL too.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 27 Nov 2011 15:16:34 +0000 (15:16 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sun, 27 Nov 2011 15:16:34 +0000 (15:16 +0000)
common/trace_api.hpp [new file with mode: 0644]
common/trace_tools.hpp
gui/mainwindow.cpp
gui/mainwindow.h
gui/retracer.cpp
gui/retracer.h
gui/settingsdialog.cpp
gui/settingsdialog.h
gui/ui/settings.ui

diff --git a/common/trace_api.hpp b/common/trace_api.hpp
new file mode 100644 (file)
index 0000000..612a8f1
--- /dev/null
@@ -0,0 +1,46 @@
+/**************************************************************************
+ *
+ * Copyright 2011 Jose Fonseca
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ **************************************************************************/
+
+#ifndef _TRACE_API_HPP_
+#define _TRACE_API_HPP_
+
+
+#include <stdlib.h>
+
+#include "os_string.hpp"
+
+
+namespace trace {
+
+
+enum API {
+    API_GL, // GL + GLX/WGL/CGL
+    API_EGL, // GL/GLES1/GLES2/VG + EGL
+};
+
+
+} /* namespace trace */
+
+#endif /* _TRACE_API_HPP_ */
index 7ca908af60c6a3f4e614bd8dc29dc00ce90bd0cf..b568a0de83642080d80e63875e53981427385ab6 100644 (file)
 #include <stdlib.h>
 
 #include "os_string.hpp"
+#include "trace_api.hpp"
 
 
 namespace trace {
 
 
-enum API {
-    API_GL, // GL + GLX/WGL/CGL
-    API_EGL, // GL/GLES1/GLES2/VG + EGL
-};
-
-
 os::String
 findFile(const char *relPath, // path relative to the current program
          const char *absPath, // absolute path
index 4c525428f67cbaaf74e1a784f16634a3f641dcdd..d37162ba7e227c10df01cedc1fc5e0310586ae8a 100644 (file)
@@ -36,6 +36,7 @@
 
 MainWindow::MainWindow()
     : QMainWindow(),
+      m_api(trace::API_GL),
       m_initalCallNum(-1),
       m_selectedEvent(0),
       m_stateEvent(0),
@@ -269,6 +270,7 @@ void MainWindow::replayTrace(bool dumpState)
     }
 
     m_retracer->setFileName(m_trace->fileName());
+    m_retracer->setAPI(m_api);
     m_retracer->setCaptureState(dumpState);
     if (m_retracer->captureState() && m_selectedEvent) {
         int index = 0;
@@ -569,9 +571,12 @@ void MainWindow::fillStateForFrame()
 void MainWindow::showSettings()
 {
     SettingsDialog dialog;
+    dialog.setAPI(m_api);
     dialog.setFilterModel(m_proxyModel);
 
     dialog.exec();
+
+    m_api = dialog.getAPI();
 }
 
 void MainWindow::openHelp(const QUrl &url)
index 644f14e7c085cdb54af8aee3866b013414fa4a54..59c9ba78010f6bcd0e0ab9a5f2b43d4d19062daf 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "ui_mainwindow.h"
 
+#include "trace_api.hpp"
 #include "apitrace.h"
 
 #include <QMainWindow>
@@ -101,6 +102,8 @@ private:
     Ui_MainWindow m_ui;
     ShadersSourceWidget *m_sourcesWidget;
 
+    trace::API m_api;
+
     ApiTrace *m_trace;
     ApiTraceModel *m_model;
     ApiTraceFilter *m_proxyModel;
index 073361718c82bd7f88eca2f5a99b3a9dd4d3e5f7..17ac14d7d8d13a97da4f2e1a61455770e9b1104d 100644 (file)
@@ -38,6 +38,11 @@ void Retracer::setFileName(const QString &name)
     m_fileName = name;
 }
 
+void Retracer::setAPI(trace::API api)
+{
+    m_api = api;
+}
+
 bool Retracer::isBenchmarking() const
 {
     return m_benchmarking;
@@ -85,6 +90,7 @@ void Retracer::run()
     retrace->process()->setProcessEnvironment(m_processEnvironment);
 
     retrace->setFileName(m_fileName);
+    retrace->setAPI(m_api);
     retrace->setBenchmarking(m_benchmarking);
     retrace->setDoubleBuffered(m_doubleBuffered);
     retrace->setCaptureState(m_captureState);
@@ -118,8 +124,18 @@ void Retracer::run()
 
 void RetraceProcess::start()
 {
+    QString prog;
     QStringList arguments;
 
+    if (m_api == trace::API_GL) {
+        prog = QLatin1String("glretrace");
+    } else if (m_api == trace::API_EGL) {
+        prog = QLatin1String("eglretrace");
+    } else {
+        assert(0);
+        return;
+    }
+
     if (m_doubleBuffered) {
         arguments << QLatin1String("-db");
     } else {
@@ -137,7 +153,7 @@ void RetraceProcess::start()
 
     arguments << m_fileName;
 
-    m_process->start(QLatin1String("glretrace"), arguments);
+    m_process->start(prog, arguments);
 }
 
 
@@ -234,6 +250,11 @@ void RetraceProcess::setFileName(const QString &name)
     m_fileName = name;
 }
 
+void RetraceProcess::setAPI(trace::API api)
+{
+    m_api = api;
+}
+
 bool RetraceProcess::isBenchmarking() const
 {
     return m_benchmarking;
index 127c9ab55cb9d414c760c4bf274821ded899ec3c..e5c391bcb23e91a7b5169601910589dac3d54770 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef RETRACER_H
 #define RETRACER_H
 
+#include "trace_api.hpp"
 #include "apitracecall.h"
 
 #include <QThread>
@@ -25,6 +26,8 @@ public:
     QString fileName() const;
     void setFileName(const QString &name);
 
+    void setAPI(trace::API api);
+
     bool isBenchmarking() const;
     void setBenchmarking(bool bench);
 
@@ -53,6 +56,7 @@ private slots:
 
 private:
     QString m_fileName;
+    trace::API m_api;
     bool m_benchmarking;
     bool m_doubleBuffered;
     bool m_captureState;
@@ -71,6 +75,8 @@ public:
     QString fileName() const;
     void setFileName(const QString &name);
 
+    void setAPI(trace::API api);
+
     bool isBenchmarking() const;
     void setBenchmarking(bool bench);
 
@@ -96,6 +102,7 @@ private slots:
     void cleanup();
 private:
     QString m_fileName;
+    trace::API m_api;
     bool m_benchmarking;
     bool m_doubleBuffered;
     bool m_captureState;
index c44b10740ec97d9f4e631b4acfd23ad7b27f6970..42d8d83fff1e30c827cb2bc684382445ff6e043e 100644 (file)
@@ -145,4 +145,15 @@ void SettingsDialog::setFilterModel(ApiTraceFilter *filter)
     filtersFromModel(m_filter);
 }
 
+void SettingsDialog::setAPI(trace::API api)
+{
+    apiComboBox->setCurrentIndex(static_cast<int>(api));
+}
+
+trace::API SettingsDialog::getAPI(void)
+{
+    return static_cast<trace::API>(apiComboBox->currentIndex());
+
+}
+
 #include "settingsdialog.moc"
index 85cb9bbc8f6f2fc5a1abadb1b4861a17266490ab..768398220a60282ed185619f2a573b23f0ea5b71 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef SETTINGSDIALOG_H
 #define SETTINGSDIALOG_H
 
+#include "trace_api.hpp"
 #include "apitracefilter.h"
 #include "ui_settings.h"
 #include <QDialog>
@@ -15,6 +16,8 @@ public:
     void accept();
 
     void setFilterModel(ApiTraceFilter *filter);
+    void setAPI(trace::API api);
+    trace::API getAPI(void);
 private slots:
     void changeRegexp(const QString &name);
     void regexpChanged(const QString &pattern);
index 1d2da3e9c4dace78a2aaee5cd49d7b4e5b90bc14..683557d62e826e6305ecb59d7b4d1105d71d48ef 100644 (file)
    <string>QApiTrace Settings</string>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QGroupBox" name="apiGroupBox">
+     <property name="title">
+      <string>API</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_4">
+      <item>
+       <widget class="QComboBox" name="apiComboBox">
+        <item>
+         <property name="text">
+          <string>GL</string>
+         </property>
+        </item>
+        <item>
+         <property name="text">
+          <string>EGL</string>
+         </property>
+        </item>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
    <item>
     <widget class="QGroupBox" name="groupBox">
      <property name="sizePolicy">