X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=gui%2Fretracer.cpp;h=b42446bdd6af2ca064f3b522466dc3b778105cc2;hb=beda4440ab82ed4e8f7568fd5a19d8d595b748a3;hp=6d743f70e72d04aab4cb7e181603e5597ea52f96;hpb=4647f208f5a2b87391281e0f1202f66c23943bd9;p=apitrace diff --git a/gui/retracer.cpp b/gui/retracer.cpp index 6d743f7..b42446b 100644 --- a/gui/retracer.cpp +++ b/gui/retracer.cpp @@ -3,7 +3,7 @@ #include "apitracecall.h" #include "thumbnail.h" -#include "image.hpp" +#include "image/image.hpp" #include "trace_profiler.hpp" @@ -130,6 +130,7 @@ Retracer::Retracer(QObject *parent) : QThread(parent), m_benchmarking(false), m_doubleBuffered(true), + m_singlethread(false), m_captureState(false), m_captureCall(0), m_profileGpu(false), @@ -137,19 +138,6 @@ Retracer::Retracer(QObject *parent) m_profilePixels(false) { qRegisterMetaType >(); - -#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 +150,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; @@ -187,6 +185,16 @@ void Retracer::setDoubleBuffered(bool db) m_doubleBuffered = db; } +bool Retracer::isSinglethread() const +{ + return m_singlethread; +} + +void Retracer::setSinglethread(bool singlethread) +{ + m_singlethread = singlethread; +} + bool Retracer::isProfilingGpu() const { return m_profileGpu; @@ -271,9 +279,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 @@ -286,6 +292,10 @@ void Retracer::run() return; } + if (m_singlethread) { + arguments << QLatin1String("--singlethread"); + } + if (m_captureState) { arguments << QLatin1String("-D"); arguments << QString::number(m_captureCall); @@ -294,21 +304,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 +328,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. */ @@ -375,9 +395,7 @@ void Retracer::run() */ while (!io.atEnd()) { - unsigned channels = 0; - unsigned width = 0; - unsigned height = 0; + image::PNMInfo info; char header[512]; qint64 headerSize = 0; @@ -394,14 +412,19 @@ void Retracer::run() headerSize += headerRead; } - const char *headerEnd = image::readPNMHeader(header, headerSize, &channels, &width, &height); + const char *headerEnd = image::readPNMHeader(header, headerSize, info); // if invalid PNM header was encountered, ... - if (header == headerEnd) { + if (headerEnd == NULL || + info.channelType != image::TYPE_UNORM8) { qDebug() << "error: invalid snapshot stream encountered"; break; } + unsigned channels = info.channels; + unsigned width = info.width; + unsigned height = info.height; + // qDebug() << "channels: " << channels << ", width: " << width << ", height: " << height"; QImage snapshot = QImage(width, height, channels == 1 ? QImage::Format_Mono : QImage::Format_RGB888); @@ -411,6 +434,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); @@ -486,7 +510,6 @@ void Retracer::run() if (m_captureState) { ApiTraceState *state = new ApiTraceState(parsedJson); emit foundState(state); - msg = QLatin1String("State fetched."); } if (m_captureThumbnails && !thumbnails.isEmpty()) {