From: José Fonseca Date: Sun, 27 Nov 2011 15:16:34 +0000 (+0000) Subject: Allow to retrace with EGL too. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=62997b470d9d35058a7c4d3d2c5ef9c1e2d7dbeb;p=apitrace Allow to retrace with EGL too. --- diff --git a/common/trace_api.hpp b/common/trace_api.hpp new file mode 100644 index 0000000..612a8f1 --- /dev/null +++ b/common/trace_api.hpp @@ -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 + +#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_ */ diff --git a/common/trace_tools.hpp b/common/trace_tools.hpp index 7ca908a..b568a0d 100644 --- a/common/trace_tools.hpp +++ b/common/trace_tools.hpp @@ -30,17 +30,12 @@ #include #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 diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 4c52542..d37162b 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -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) diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 644f14e..59c9ba7 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -3,6 +3,7 @@ #include "ui_mainwindow.h" +#include "trace_api.hpp" #include "apitrace.h" #include @@ -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; diff --git a/gui/retracer.cpp b/gui/retracer.cpp index 0733617..17ac14d 100644 --- a/gui/retracer.cpp +++ b/gui/retracer.cpp @@ -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; diff --git a/gui/retracer.h b/gui/retracer.h index 127c9ab..e5c391b 100644 --- a/gui/retracer.h +++ b/gui/retracer.h @@ -1,6 +1,7 @@ #ifndef RETRACER_H #define RETRACER_H +#include "trace_api.hpp" #include "apitracecall.h" #include @@ -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; diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index c44b107..42d8d83 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -145,4 +145,15 @@ void SettingsDialog::setFilterModel(ApiTraceFilter *filter) filtersFromModel(m_filter); } +void SettingsDialog::setAPI(trace::API api) +{ + apiComboBox->setCurrentIndex(static_cast(api)); +} + +trace::API SettingsDialog::getAPI(void) +{ + return static_cast(apiComboBox->currentIndex()); + +} + #include "settingsdialog.moc" diff --git a/gui/settingsdialog.h b/gui/settingsdialog.h index 85cb9bb..7683982 100644 --- a/gui/settingsdialog.h +++ b/gui/settingsdialog.h @@ -1,6 +1,7 @@ #ifndef SETTINGSDIALOG_H #define SETTINGSDIALOG_H +#include "trace_api.hpp" #include "apitracefilter.h" #include "ui_settings.h" #include @@ -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); diff --git a/gui/ui/settings.ui b/gui/ui/settings.ui index 1d2da3e..683557d 100644 --- a/gui/ui/settings.ui +++ b/gui/ui/settings.ui @@ -17,6 +17,29 @@ QApiTrace Settings + + + + API + + + + + + + GL + + + + + EGL + + + + + + +