--- /dev/null
+/**************************************************************************
+ *
+ * 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_ */
#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
MainWindow::MainWindow()
: QMainWindow(),
+ m_api(trace::API_GL),
m_initalCallNum(-1),
m_selectedEvent(0),
m_stateEvent(0),
}
m_retracer->setFileName(m_trace->fileName());
+ m_retracer->setAPI(m_api);
m_retracer->setCaptureState(dumpState);
if (m_retracer->captureState() && m_selectedEvent) {
int index = 0;
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)
#include "ui_mainwindow.h"
+#include "trace_api.hpp"
#include "apitrace.h"
#include <QMainWindow>
Ui_MainWindow m_ui;
ShadersSourceWidget *m_sourcesWidget;
+ trace::API m_api;
+
ApiTrace *m_trace;
ApiTraceModel *m_model;
ApiTraceFilter *m_proxyModel;
m_fileName = name;
}
+void Retracer::setAPI(trace::API api)
+{
+ m_api = api;
+}
+
bool Retracer::isBenchmarking() const
{
return m_benchmarking;
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);
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 {
arguments << m_fileName;
- m_process->start(QLatin1String("glretrace"), arguments);
+ m_process->start(prog, arguments);
}
m_fileName = name;
}
+void RetraceProcess::setAPI(trace::API api)
+{
+ m_api = api;
+}
+
bool RetraceProcess::isBenchmarking() const
{
return m_benchmarking;
#ifndef RETRACER_H
#define RETRACER_H
+#include "trace_api.hpp"
#include "apitracecall.h"
#include <QThread>
QString fileName() const;
void setFileName(const QString &name);
+ void setAPI(trace::API api);
+
bool isBenchmarking() const;
void setBenchmarking(bool bench);
private:
QString m_fileName;
+ trace::API m_api;
bool m_benchmarking;
bool m_doubleBuffered;
bool m_captureState;
QString fileName() const;
void setFileName(const QString &name);
+ void setAPI(trace::API api);
+
bool isBenchmarking() const;
void setBenchmarking(bool bench);
void cleanup();
private:
QString m_fileName;
+ trace::API m_api;
bool m_benchmarking;
bool m_doubleBuffered;
bool m_captureState;
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"
#ifndef SETTINGSDIALOG_H
#define SETTINGSDIALOG_H
+#include "trace_api.hpp"
#include "apitracefilter.h"
#include "ui_settings.h"
#include <QDialog>
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);
<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">