Add analytics system - disabled for now

* This is a *very* light-touch analytics system that will track the
  simplest and most anonymous statistics that can be useful in
  determining which features are most used or perhaps underused, and
  where it's best to direct development attention.
* It is entirely implemented in the UI layer, no analytics-gathering
  code exists in the library that's injected into programs, and of
  course no capture data (screenshots, resource contents, shaders, etc
  etc) is transmitted.
* Once it's turned on, it will apply to both development and release
  builds. It tracks stats over a month, and then at the beginning of a
  new month it sends the previous data.
* When the user first starts up a build with analytics if there's no
  previous analytics database then they are informed of the new code and
  asked to approve it. They have the option of selecting to manually
  verify any sent reports, or just opt-ing out entirely.
This commit is contained in:
baldurk
2017-11-28 17:44:09 +00:00
parent 1d05177141
commit a6ebf09785
45 changed files with 1506 additions and 12 deletions
+15
View File
@@ -25,6 +25,7 @@
#include "CaptureContext.h"
#include <QApplication>
#include <QDir>
#include <QElapsedTimer>
#include <QFileInfo>
#include <QLabel>
#include <QMenu>
@@ -136,10 +137,20 @@ void CaptureContext::LoadCapture(const QString &captureFile, const QString &orig
thread->selfDelete(true);
thread->start();
QElapsedTimer loadTimer;
loadTimer.start();
ShowProgressDialog(m_MainWindow, tr("Loading Capture: %1").arg(origFilename),
[this]() { return !m_LoadInProgress; },
[this]() { return UpdateLoadProgress(); });
ANALYTIC_ADDAVG(LoadTime, double(loadTimer.nsecsElapsed() * 1.0e-9));
ANALYTIC_SET(CaptureFeatures.ShaderLinkage, m_APIProps.ShaderLinkage);
ANALYTIC_SET(CaptureFeatures.YUVTextures, m_APIProps.YUVTextures);
ANALYTIC_SET(CaptureFeatures.SparseResources, m_APIProps.SparseResources);
ANALYTIC_SET(CaptureFeatures.MultiGPU, m_APIProps.MultiGPU);
m_MainWindow->setProgress(-1.0f);
if(m_CaptureLoaded)
@@ -892,6 +903,8 @@ void CaptureContext::SetNotes(const QString &key, const QString &contents)
void CaptureContext::SetBookmark(const EventBookmark &mark)
{
ANALYTIC_SET(UIFeatures.Bookmarks, true);
int index = m_Bookmarks.indexOf(mark);
if(index >= 0)
{
@@ -1042,6 +1055,8 @@ void CaptureContext::SaveNotes()
props.type = SectionType::Notes;
props.version = 1;
ANALYTIC_SET(UIFeatures.CaptureComments, true);
Replay().GetCaptureAccess()->WriteSection(props, json.toUtf8());
}
+396
View File
@@ -0,0 +1,396 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2017 Baldur Karlsson
*
* 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.
******************************************************************************/
#include <QBuffer>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QUrlQuery>
#include "Windows/Dialogs/AnalyticsConfirmDialog.h"
#include "Windows/Dialogs/AnalyticsPromptDialog.h"
#include "QRDInterface.h"
#if RENDERDOC_ANALYTICS_ENABLE
namespace
{
enum class AnalyticsState
{
Nothing,
PromptFirstTime,
SubmitReport,
};
enum class AnalyticsSerialiseType
{
Loading,
Saving,
Reporting,
};
static AnalyticsState analyticsState = AnalyticsState::Nothing;
static Analytics actualDB;
static QString analyticsSaveLocation;
static const char *analyticsJSONMagic = "Analytics";
static const int analyticsJSONVersion = 1;
template <typename T>
QVariant analyticsToVar(const T &el, bool reporting)
{
return QVariant(el);
}
// annoying specialisation, but necessary
template <typename T>
QVariant analyticsToVar(const bool (&el)[32], bool reporting)
{
QVariantList l;
for(int i = 0; i < 32; i++)
l.push_back(QVariant(el[i]));
return l;
}
template <>
QVariant analyticsToVar(const AnalyticsAverage &el, bool reporting)
{
return el.toVariant(reporting);
}
template <typename T>
void analyticsFromVar(T &el, QVariant v)
{
el = v.value<T>();
}
template <>
void analyticsFromVar(bool (&el)[32], QVariant v)
{
QVariantList l = v.toList();
for(int i = 0; i < 32 && i < l.count(); i++)
el[i] = l[i].toBool();
}
template <>
void analyticsFromVar(AnalyticsAverage &el, QVariant v)
{
el = AnalyticsAverage(v);
}
// these functions will process a name like Foo.Bar into Foo being a QVariantMap and Bar being a
// member of it.
template <typename T>
void loadFrom(const QVariantMap &parent, const QString &name, T &el)
{
int idx = name.indexOf(QLatin1Char('.'));
if(idx > 0)
{
QString parentName = name.left(idx);
QString subname = name.mid(idx + 1);
if(parent.contains(parentName))
loadFrom(parent[parentName].toMap(), subname, el);
return;
}
if(parent.contains(name))
analyticsFromVar<T>(el, parent[name]);
}
template <typename T>
void saveTo(QVariantMap &parent, const QString &name, const T &el, bool reporting)
{
int idx = name.indexOf(QLatin1Char('.'));
if(idx > 0)
{
QString parentName = name.left(idx);
QString subname = name.mid(idx + 1);
// need to load-hit-store to change the contents :(.
{
QVariantMap map = parent[parentName].toMap();
saveTo(map, subname, el, reporting);
parent[parentName] = map;
}
return;
}
parent[name] = analyticsToVar<T>(el, reporting);
}
// add a macro to either load or save, depending on our state.
#define ANALYTIC_SERIALISE(varname) \
if(type == AnalyticsSerialiseType::Loading) \
{ \
loadFrom(values, lit(#varname), Analytics::db->varname); \
} \
else \
{ \
saveTo(values, lit(#varname), Analytics::db->varname, reporting); \
}
void AnalyticsSerialise(QVariantMap &values, AnalyticsSerialiseType type)
{
bool reporting = type == AnalyticsSerialiseType::Reporting;
if(!Analytics::db)
return;
static_assert(sizeof(Analytics) == 140, "Sizeof Analytics has changed - update serialisation.");
// Date
{
ANALYTIC_SERIALISE(Date.Year);
ANALYTIC_SERIALISE(Date.Month);
}
ANALYTIC_SERIALISE(Version);
// Environment
{
ANALYTIC_SERIALISE(Environment.RenderDocVersion);
ANALYTIC_SERIALISE(Environment.DistributionVersion);
ANALYTIC_SERIALISE(Environment.OSVersion);
ANALYTIC_SERIALISE(Environment.GPUVendors);
ANALYTIC_SERIALISE(Environment.Bitness);
ANALYTIC_SERIALISE(Environment.DevelBuildRun);
ANALYTIC_SERIALISE(Environment.OfficialBuildRun);
}
// A flag for each dat counting which unique days in the last month the program was run.
ANALYTIC_SERIALISE(Version);
// special handling for reporting DaysUsed, to flatten into a number
if(reporting)
{
int sum = 0;
for(bool day : Analytics::db->DaysUsed)
sum += day ? 1 : 0;
saveTo(values, lit("DaysUsed"), sum, reporting);
}
else
{
ANALYTIC_SERIALISE(DaysUsed);
}
ANALYTIC_SERIALISE(LoadTime);
ANALYTIC_SERIALISE(APIsUsed);
// UIFeatures
{
ANALYTIC_SERIALISE(UIFeatures.Bookmarks);
ANALYTIC_SERIALISE(UIFeatures.ResourceInspect);
ANALYTIC_SERIALISE(UIFeatures.ShaderEditing);
ANALYTIC_SERIALISE(UIFeatures.CallstackResolve);
ANALYTIC_SERIALISE(UIFeatures.PixelHistory);
ANALYTIC_SERIALISE(UIFeatures.DrawcallTimes);
ANALYTIC_SERIALISE(UIFeatures.PerformanceCounters);
ANALYTIC_SERIALISE(UIFeatures.PythonInterop);
ANALYTIC_SERIALISE(UIFeatures.CustomTextureVisualise);
ANALYTIC_SERIALISE(UIFeatures.ImageViewer);
ANALYTIC_SERIALISE(UIFeatures.CaptureComments);
// Export
{
ANALYTIC_SERIALISE(UIFeatures.Export.EventBrowser);
ANALYTIC_SERIALISE(UIFeatures.Export.PipelineState);
ANALYTIC_SERIALISE(UIFeatures.Export.MeshOutput);
ANALYTIC_SERIALISE(UIFeatures.Export.TextureSave);
ANALYTIC_SERIALISE(UIFeatures.Export.ShaderSave);
}
// ShaderDebug
{
ANALYTIC_SERIALISE(UIFeatures.ShaderDebug.Vertex);
ANALYTIC_SERIALISE(UIFeatures.ShaderDebug.Pixel);
ANALYTIC_SERIALISE(UIFeatures.ShaderDebug.Compute);
}
// TextureDebugOverlays
{
ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.Drawcall);
ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.Wireframe);
ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.Depth);
ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.Stencil);
ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.BackfaceCull);
ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.ViewportScissor);
ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.NaN);
ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.Clipping);
ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.ClearBeforePass);
ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.ClearBeforeDraw);
ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.QuadOverdrawPass);
ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.QuadOverdrawDraw);
ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.TriangleSizePass);
ANALYTIC_SERIALISE(UIFeatures.TextureDebugOverlays.TriangleSizeDraw);
}
// RemoteReplay
{
ANALYTIC_SERIALISE(UIFeatures.RemoteReplay.Android);
ANALYTIC_SERIALISE(UIFeatures.RemoteReplay.NonAndroid);
}
}
// CaptureFeatures
{
ANALYTIC_SERIALISE(CaptureFeatures.ShaderLinkage);
ANALYTIC_SERIALISE(CaptureFeatures.YUVTextures);
ANALYTIC_SERIALISE(CaptureFeatures.SparseResources);
ANALYTIC_SERIALISE(CaptureFeatures.MultiGPU);
}
}
}; // anonymous namespace
Analytics *Analytics::db = NULL;
void Analytics::Save()
{
if(analyticsSaveLocation.isEmpty())
return;
QVariantMap values;
// call to the serialise function to save into the 'values' map
AnalyticsSerialise(values, AnalyticsSerialiseType::Saving);
QFile f(analyticsSaveLocation);
if(f.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text))
SaveToJSON(values, f, analyticsJSONMagic, analyticsJSONVersion);
}
void Analytics::Load()
{
// allocate space for the Analytics singleton
Analytics::db = &actualDB;
// find the filename where the analytics will be saved
analyticsSaveLocation = configFilePath(lit("analytics.json"));
QFile f(analyticsSaveLocation);
// silently allow missing database
if(f.exists())
{
if(f.open(QIODevice::ReadOnly | QIODevice::Text))
{
QVariantMap values;
bool success = LoadFromJSON(values, f, analyticsJSONMagic, analyticsJSONVersion);
if(success)
AnalyticsSerialise(values, AnalyticsSerialiseType::Loading);
}
}
// if year is 0, this was uninitialised meaning there was no previous analytics database. We set
// the current month, and mark a flag that we need to prompt the user about opting out of
// analytics.
int currentYear = QDateTime::currentDateTime().date().year();
int currentMonth = QDateTime::currentDateTime().date().month();
if(Analytics::db->Date.Year == 0)
{
Analytics::db->Date.Year = currentYear;
Analytics::db->Date.Month = currentMonth;
analyticsState = AnalyticsState::PromptFirstTime;
}
else if(Analytics::db->Date.Year != currentYear || Analytics::db->Date.Month != currentMonth)
{
// if the analytics is not from this month, submit the report.
analyticsState = AnalyticsState::SubmitReport;
}
}
void Analytics::Prompt(ICaptureContext &ctx, PersistantConfig &config)
{
if(analyticsState == AnalyticsState::PromptFirstTime)
{
QWidget *mainWindow = ctx.GetMainWindow()->Widget();
AnalyticsPromptDialog prompt(config, mainWindow);
RDDialog::show(&prompt);
}
else if(analyticsState == AnalyticsState::SubmitReport)
{
QWidget *mainWindow = ctx.GetMainWindow()->Widget();
QVariantMap values;
AnalyticsSerialise(values, AnalyticsSerialiseType::Reporting);
QBuffer buf;
buf.open(QBuffer::WriteOnly);
SaveToJSON(values, buf, NULL, 0);
QString jsonReport = QString::fromUtf8(buf.buffer());
if(config.Analytics_ManualCheck)
{
AnalyticsConfirmDialog confirm(jsonReport, mainWindow);
int res = RDDialog::show(&confirm);
if(res == 0)
analyticsState = AnalyticsState::Nothing;
}
if(analyticsState == AnalyticsState::SubmitReport)
{
QNetworkAccessManager *mgr = new QNetworkAccessManager(mainWindow);
QUrlQuery postData;
postData.addQueryItem(lit("report"), jsonReport);
QNetworkRequest request(QUrl(lit("https://renderdoc.org/analytics")));
request.setHeader(QNetworkRequest::ContentTypeHeader,
lit("application/x-www-form-urlencoded"));
QByteArray dataText = postData.toString(QUrl::FullyEncoded).toUtf8();
mgr->post(request, dataText);
}
// reset the database now
*Analytics::db = Analytics();
Analytics::db->Date.Year = QDateTime::currentDateTime().date().year();
Analytics::db->Date.Month = QDateTime::currentDateTime().date().month();
}
}
#else // RENDERDOC_ANALYTICS_ENABLE
namespace Analytics
{
void Load()
{
}
void Prompt(ICaptureContext &ctx, PersistantConfig &config)
{
}
};
#endif
+308
View File
@@ -0,0 +1,308 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2017 Baldur Karlsson
*
* 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.
******************************************************************************/
#pragma once
// This file controls the telemetry/analytics functionality in RenderDoc.
//
// If you don't care about any details and just want to make sure this is turned off for your builds
// then go below to #define RENDERDOC_ANALYTICS_ENABLE and change it to 0. That will cease all
// recording and reporting of analytics data. It won't delete any previously recorded analytics and
// won't stop any other builds from working, since the code that knows about what the analytics is
// will be compiled out.
//
// -------------------------------------------------------------------------------------------------
//
// RenderDoc's analytics works in two phases: Data is recorded first to an internal database that
// can contain more information than will be sent, to allow for accurate tracking before
// aggregation. This isn't as scary as it sounds - e.g. consider the 'UsageLevel' stat that's
// reported, which is a number in the range 1 to 31 indicating how many days in the month the
// program was launched. In order to track that, we need to have a sticky flag for each day to count
// it, since given a number "20" it's impossible to know if we've counted today or not.
//
// Similar cases are found for averages that need to store the number of cases and a total, which is
// then flattened down into just an average for reporting.
//
// This database is stored internally and then converted to the report in the 'AnalyticsSerialise'
// function.
//
// Once the report is sent, the database is reset and begins the next period.
// this is the root switch that can turn off *all* analytics code globally
#define RENDERDOC_ANALYTICS_ENABLE 0
// we don't want any of this to be accessible to script, only code.
#if !defined(SWIG)
// We also compile out all of the code if analytics are disabled so there's not even a code
// reference to where the data is collected.
#if RENDERDOC_ANALYTICS_ENABLE
struct AnalyticsAverage
{
double Total = 0.0;
int Count = 0;
void Add(double Val)
{
Total += Val;
Count++;
}
AnalyticsAverage() = default;
AnalyticsAverage(QVariant v)
{
QVariantMap vmap = v.toMap();
Total = vmap[lit("Total")].toDouble();
Count = vmap[lit("Count")].toInt();
}
QVariant toVariant(bool reporting) const
{
if(reporting)
return Total / double(Count);
QVariantMap ret;
ret[lit("Total")] = Total;
ret[lit("Count")] = Count;
return ret;
}
};
class PersistantConfig;
struct ICaptureContext;
// we set this struct to byte-packing, so that any change will affect sizeof() and fail a
// static_assert in AnalyticsSerialise. This only has to be on one platform since it will block
// building when a commit is pushed. This struct isn't memcpy'd around and isn't performance
// sensitive, so there's no need to have perfectly aligned data.
#if defined(_MSC_VER)
#pragma pack(push, 1)
#endif
// we declare the analystics data struct here, this contains the information we're storing
// If you add anything to this struct, make sure to update AnalyticsSerialise.
struct Analytics
{
// utility function - loads the analytics from disk and initialise the Analytics::db member.
static void Load();
// utility function - performs any UI-level prompting, such as asking the user if they want to
// opt-out, or manually vetting a report for uploading.
static void Prompt(ICaptureContext &ctx, PersistantConfig &config);
// the singleton instance of analytics. May be NULL if analytics aren't initialised or have been
// opted-out from.
static Analytics *db;
// Function to save the analytics to disk, if it's been initialised. Every set macro below will
// call this after the data is set to flush it to disk.
void Save();
// book-keeping: contains the year/month where this database was started. Thus if current date !=
// saved date, then we should try to submit the analytics report.
struct
{
int Year = 0;
int Month = 0;
} Date;
// version number. Most data is opportunistically gathered, so if some data is missing then it
// just doesn't get included in the report so we can add new data, but we bump the version
// here if something more significant changes.
int Version = 1;
struct
{
// The version string (MAJOR_MINOR_VERSION_STRING) of this build.
QString RenderDocVersion;
// The distribution information (DISTRIBUTION_NAME) for this build.
QString DistributionVersion;
// A human readable name of the operating system.
QString OSVersion;
// A list of which GPU vendors have been used for replay
QStringList GPUVendors;
// Either 32 or 64 indicating which bit-depth the UI is running as
int Bitness = 0;
// whether a development build has been run - either a nightly build or a local build.
bool DevelBuildRun = false;
// whether an official build has been run - whether distributed from the RenderDoc website or
// through a linux distribution
bool OfficialBuildRun = false;
} Environment;
// Counts which unique days in the last month the program was run
bool DaysUsed[32] = {0};
// how long do captures take to load, on average
AnalyticsAverage LoadTime;
// which APIs have been used
QStringList APIsUsed;
// which UI features have been used, as a simple yes/no
struct
{
bool Bookmarks = false;
bool ResourceInspect = false;
bool ShaderEditing = false;
bool CallstackResolve = false;
bool PixelHistory = false;
bool DrawcallTimes = false;
bool PerformanceCounters = false;
bool PythonInterop = false;
bool CustomTextureVisualise = false;
bool ImageViewer = false;
bool CaptureComments = false;
struct
{
bool EventBrowser = false;
bool PipelineState = false;
bool MeshOutput = false;
bool RawBuffer = false;
bool TextureSave = false;
bool ShaderSave = false;
} Export;
struct
{
bool Vertex = false;
bool Pixel = false;
bool Compute = false;
} ShaderDebug;
struct
{
bool Drawcall = false;
bool Wireframe = false;
bool Depth = false;
bool Stencil = false;
bool BackfaceCull = false;
bool ViewportScissor = false;
bool NaN = false;
bool Clipping = false;
bool ClearBeforePass = false;
bool ClearBeforeDraw = false;
bool QuadOverdrawPass = false;
bool QuadOverdrawDraw = false;
bool TriangleSizePass = false;
bool TriangleSizeDraw = false;
} TextureDebugOverlays;
struct
{
bool Android = false;
bool NonAndroid = false;
} RemoteReplay;
} UIFeatures;
// If some particular API specific features are seen in a capture, as a simple yes/no. See
// APIProperties
struct
{
bool ShaderLinkage = false;
bool YUVTextures = false;
bool SparseResources = false;
bool MultiGPU = false;
} CaptureFeatures;
};
#if defined(_MSC_VER)
#pragma pack(pop)
#endif
// straightforward set of a value
#define ANALYTIC_SET(name, val) \
do \
{ \
if(Analytics::db) \
{ \
auto value = val; \
if(Analytics::db->name != value) \
{ \
Analytics::db->name = value; \
Analytics::db->Save(); \
} \
} \
} while(0);
// add a data point to an average
#define ANALYTIC_ADDAVG(name, val) \
do \
{ \
if(Analytics::db) \
{ \
Analytics::db->name.Add(val); \
Analytics::db->Save(); \
} \
} while(0);
// add an element to an array, if it's not already present
#define ANALYTIC_ADDUNIQ(name, val) \
do \
{ \
if(Analytics::db) \
{ \
bool found = false; \
for(auto &v : Analytics::db->name) \
{ \
if(v == val) \
{ \
found = true; \
break; \
} \
} \
\
if(!found) \
{ \
Analytics::db->name.push_back(val); \
Analytics::db->Save(); \
} \
} \
} while(0);
#else
// here we declare macro stubs that satisfy the use in the codebase.
#define ANALYTIC_SET(name, val) (void)val
#define ANALYTIC_ADDAVG(name, val) (void)val
#define ANALYTIC_ADDUNIQ(name, val) (void)val
class PersistantConfig;
struct ICaptureContext;
namespace Analytics
{
void Load();
void Prompt(ICaptureContext &ctx, PersistantConfig &config);
};
#endif
#endif
@@ -133,6 +133,10 @@ DECLARE_REFLECTION_STRUCT(SPIRVDisassembler);
\
CONFIG_SETTING(public, QVariantList, QList<SPIRVDisassembler>, SPIRVDisassemblers) \
\
CONFIG_SETTING_VAL(public, bool, bool, Analytics_TotalOptOut, false) \
\
CONFIG_SETTING_VAL(public, bool, bool, Analytics_ManualCheck, false) \
\
CONFIG_SETTING(private, QVariantMap, QStringMap, ConfigSettings) \
\
CONFIG_SETTING(private, QVariantList, QList<RemoteHost>, RemoteHostList)
@@ -422,6 +426,21 @@ For more information about some of these settings that are user-facing see
.. data:: RemoteHosts
A ``list`` of :class:`RemoteHost` handles to the currently configured remote hosts.
.. data:: Analytics_TotalOptOut
``True`` if the user has selected to completely opt-out from and disable all analytics collection
and reporting.
Defaults to ``False``.
.. data:: Analytics_ManualCheck
``True`` if the user has remained with analytics turned on, but has chosen to manually check each
report that is sent out.
Defaults to ``False``.
)");
class PersistantConfig
{
@@ -1,3 +1,26 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2017 Baldur Karlsson
*
* 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.
******************************************************************************/
#include "QRDInterface.h"
#include <QDir>
+1
View File
@@ -60,6 +60,7 @@ class QWidget;
#define RENDERDOC_QT_COMPAT
#include "renderdoc_replay.h"
#include "Analytics.h"
#include "CommonPipelineState.h"
#include "PersistantConfig.h"
#include "RemoteHost.h"
+2 -1
View File
@@ -729,7 +729,8 @@ void addStructuredObjects(RDTreeWidgetItem *parent, const StructuredObjectList &
bool SaveToJSON(QVariantMap &data, QIODevice &f, const char *magicIdentifier, uint32_t magicVersion)
{
// marker that this data is valid
data[QString::fromLatin1(magicIdentifier)] = magicVersion;
if(magicIdentifier)
data[QString::fromLatin1(magicIdentifier)] = magicVersion;
QJsonDocument doc = QJsonDocument::fromVariant(data);
+9
View File
@@ -302,6 +302,15 @@ ReplayStatus ReplayManager::ConnectToRemoteServer(RemoteHost *host)
ReplayStatus status =
RENDERDOC_CreateRemoteServerConnection(host->Hostname.toUtf8().data(), 0, &m_Remote);
if(host->IsHostADB())
{
ANALYTIC_SET(UIFeatures.RemoteReplay.Android, true);
}
else
{
ANALYTIC_SET(UIFeatures.RemoteReplay.NonAndroid, true);
}
m_RemoteHost = host;
if(status == ReplayStatus::Succeeded)
+24
View File
@@ -28,11 +28,13 @@
#include <QRegularExpression>
#include <QRegularExpressionMatch>
#include <QStandardPaths>
#include <QSysInfo>
#include "Code/CaptureContext.h"
#include "Code/QRDUtils.h"
#include "Code/Resources.h"
#include "Code/pyrenderdoc/PythonContext.h"
#include "Windows/MainWindow.h"
#include "version.h"
#if defined(Q_OS_WIN32)
extern "C" {
@@ -203,6 +205,9 @@ int main(int argc, char *argv[])
.arg(configFilename));
}
if(!config.Analytics_TotalOptOut)
Analytics::Load();
bool isDarkTheme = IsDarkTheme();
bool styleSet = config.SetStyle();
@@ -234,10 +239,29 @@ int main(int argc, char *argv[])
{
CaptureContext ctx(filename, remoteHost, remoteIdent, temp, config);
Analytics::Prompt(ctx, config);
ANALYTIC_SET(Environment.RenderDocVersion, lit(FULL_VERSION_STRING));
#if defined(DISTRIBUTION_VERSION)
ANALYTIC_SET(Environment.DistributionVersion, lit(DISTRIBUTION_NAME));
#endif
ANALYTIC_SET(Environment.Bitness, ((sizeof(void *) == sizeof(uint64_t)) ? 64 : 32));
ANALYTIC_SET(Environment.OSVersion, QSysInfo::prettyProductName());
#if RENDERDOC_STABLE_BUILD
ANALYTIC_SET(Environment.OfficialBuildRun, true);
#else
ANALYTIC_SET(Environment.DevelBuildRun, true);
#endif
ANALYTIC_SET(DaysUsed[QDateTime::currentDateTime().date().day()], true);
if(!pyscripts.isEmpty())
{
PythonContextHandle py;
ANALYTIC_SET(UIFeatures.PythonInterop, true);
py.ctx().setGlobal("pyrenderdoc", (ICaptureContext *)&ctx);
QObject::connect(&py.ctx(), &PythonContext::exception,
+9
View File
@@ -3063,6 +3063,15 @@ void BufferViewer::exportData(const BufferExport &params)
return;
}
if(m_MeshView)
{
ANALYTIC_SET(UIFeatures.Export.MeshOutput, true);
}
else
{
ANALYTIC_SET(UIFeatures.Export.RawBuffer, true);
}
BufferItemModel *model = (BufferItemModel *)m_CurView->model();
LambdaThread *exportThread = new LambdaThread([this, params, model, f]() {
@@ -0,0 +1,41 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2017 Baldur Karlsson
*
* 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.
******************************************************************************/
#include "AnalyticsConfirmDialog.h"
#include <QFontDatabase>
#include "ui_AnalyticsConfirmDialog.h"
AnalyticsConfirmDialog::AnalyticsConfirmDialog(QString report, QWidget *parent)
: QDialog(parent), ui(new Ui::AnalyticsConfirmDialog)
{
ui->setupUi(this);
ui->analyticsReport->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
ui->analyticsReport->setText(report);
}
AnalyticsConfirmDialog::~AnalyticsConfirmDialog()
{
delete ui;
}
@@ -0,0 +1,44 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2017 Baldur Karlsson
*
* 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.
******************************************************************************/
#pragma once
#include <QDialog>
namespace Ui
{
class AnalyticsConfirmDialog;
}
class AnalyticsConfirmDialog : public QDialog
{
Q_OBJECT
public:
explicit AnalyticsConfirmDialog(QString report, QWidget *parent = 0);
~AnalyticsConfirmDialog();
private:
Ui::AnalyticsConfirmDialog *ui;
};
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AnalyticsConfirmDialog</class>
<widget class="QDialog" name="AnalyticsConfirmDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>500</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Analytics Report</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:18pt; font-weight:600;&quot;&gt;Analytics Report Ready&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;RenderDoc has gathered analytics from your usage over the past month. This is now ready to send to the server for processing.&lt;/p&gt;&lt;p&gt;As requested, the full report is listed below where you can check the data and ensure you are happy with what's being sent.&lt;/p&gt;&lt;p&gt;When ready, click OK to send the report. Clicking Discard will throw away this report and begin again for next month.&lt;/p&gt;&lt;p&gt;If you want, you can manually copy-paste this report and send it through here: &lt;a href=&quot;https://renderdoc.org/analytics&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://renderdoc.org/analytics&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="analyticsReport">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Discard|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AnalyticsConfirmDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AnalyticsConfirmDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
@@ -0,0 +1,65 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2017 Baldur Karlsson
*
* 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.
******************************************************************************/
#include "AnalyticsPromptDialog.h"
#include "Code/Interface/QRDInterface.h"
#include "ui_AnalyticsPromptDialog.h"
AnalyticsPromptDialog::AnalyticsPromptDialog(PersistantConfig &cfg, QWidget *parent)
: QDialog(parent), ui(new Ui::AnalyticsPromptDialog), m_Config(cfg)
{
ui->setupUi(this);
}
AnalyticsPromptDialog::~AnalyticsPromptDialog()
{
delete ui;
}
void AnalyticsPromptDialog::on_autoSubmit_toggled(bool checked)
{
if(checked)
{
m_Config.Analytics_ManualCheck = false;
m_Config.Analytics_TotalOptOut = false;
}
}
void AnalyticsPromptDialog::on_manualCheck_toggled(bool checked)
{
if(checked)
{
m_Config.Analytics_ManualCheck = true;
m_Config.Analytics_TotalOptOut = false;
}
}
void AnalyticsPromptDialog::on_optOut_toggled(bool checked)
{
if(checked)
{
m_Config.Analytics_ManualCheck = false;
m_Config.Analytics_TotalOptOut = true;
}
}
@@ -0,0 +1,53 @@
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2017 Baldur Karlsson
*
* 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.
******************************************************************************/
#pragma once
#include <QDialog>
namespace Ui
{
class AnalyticsPromptDialog;
}
class PersistantConfig;
class AnalyticsPromptDialog : public QDialog
{
Q_OBJECT
public:
explicit AnalyticsPromptDialog(PersistantConfig &cfg, QWidget *parent = 0);
~AnalyticsPromptDialog();
private slots:
// automatic slots
void on_autoSubmit_toggled(bool checked);
void on_manualCheck_toggled(bool checked);
void on_optOut_toggled(bool checked);
private:
Ui::AnalyticsPromptDialog *ui;
PersistantConfig &m_Config;
};
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AnalyticsPromptDialog</class>
<widget class="QDialog" name="AnalyticsPromptDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>498</width>
<height>554</height>
</rect>
</property>
<property name="windowTitle">
<string>Analytics</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:18pt; font-weight:600;&quot;&gt;Anonymous Analytics&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;RenderDoc now has some very minimal analytics gathering in the UI, to help learn how RenderDoc is used and inform its future development. Here you can choose how to use it - if you have no problems with this, click OK to continue and you won't be prompted again.&lt;/p&gt;&lt;p&gt;The data gathered is &lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;not personally identifiable&lt;/span&gt; and contains &lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;absolutely no data from captures&lt;/span&gt;. It will store for example which API is captured, and what features in the UI are used. The source is freely available and auditable.&lt;/p&gt;&lt;p&gt;Analytics gathering only happens in the UI itself, no analytics code runs at capture time so there is no risk of leaking information from the target program.&lt;/p&gt;&lt;p&gt;Each month an anonymous report is generated and sent to securely the RenderDoc server. The aggregated statistics are visible publicly.&lt;/p&gt;&lt;p&gt;By default this happens behind the scenes and no user interaction is required. If you want, you can choose to manually approve each report before it's sent. That way you can see what information is stored.&lt;/p&gt;&lt;p&gt;If you wish, you can opt-out entirely and no statistics will be gathered or reported. However please consider this carefully as it will reduce the accuracy of the statistics and make it harder for me to reason about what features and work on RenderDoc to prioritise.&lt;/p&gt;&lt;p&gt;For more information (and to see what statistics are gathered) go to &lt;a href=&quot;https://renderdoc.org/analytics&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://renderdoc.org/analytics&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Thanks!&lt;br/&gt;Baldur Karlsson&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Select your preference</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QRadioButton" name="autoSubmit">
<property name="text">
<string>Gather anonymous low-detail statistics and submit automatically.</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="manualCheck">
<property name="text">
<string>Gather anonymous low-detail statistics, but manually verify before submitting.</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="optOut">
<property name="text">
<string>Do not gather or submit any statistics.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AnalyticsPromptDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AnalyticsPromptDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
+4
View File
@@ -390,6 +390,8 @@ void EventBrowser::on_bookmark_clicked()
void EventBrowser::on_timeDraws_clicked()
{
ANALYTIC_SET(UIFeatures.DrawcallTimes, true);
ui->events->header()->showSection(COL_DURATION);
m_Ctx.Replay().AsyncInvoke([this](IReplayController *r) {
@@ -563,6 +565,8 @@ void EventBrowser::on_exportDraws_clicked()
if(!filename.isEmpty())
{
ANALYTIC_SET(UIFeatures.Export.EventBrowser, true);
QDir dirinfo = QFileInfo(filename).dir();
if(dirinfo.exists())
{
+11
View File
@@ -569,6 +569,15 @@ void MainWindow::LoadCapture(const QString &filename, bool temporary, bool local
statusText->setText(tr("Loading %1...").arg(origFilename));
if(driver == lit("Image"))
{
ANALYTIC_SET(UIFeatures.ImageViewer, true);
}
else
{
ANALYTIC_ADDUNIQ(APIsUsed, driver);
}
m_Ctx.LoadCapture(fileToLoad, origFilename, temporary, local);
}
@@ -1641,6 +1650,8 @@ void MainWindow::on_action_Python_Shell_triggered()
void MainWindow::on_action_Resolve_Symbols_triggered()
{
ANALYTIC_SET(UIFeatures.CallstackResolve, true);
if(!m_Ctx.Replay().GetCaptureAccess())
{
RDDialog::critical(
@@ -191,6 +191,8 @@ void PerformanceCounterViewer::CaptureCounters()
return;
m_SelectedCounters = pcs.GetSelectedCounters();
ANALYTIC_SET(UIFeatures.PerformanceCounters, true);
bool done = false;
m_Ctx.Replay().AsyncInvoke([this, &done](IReplayController *controller) -> void {
rdcarray<GPUCounter> counters;
@@ -205,6 +205,8 @@ QXmlStreamWriter *PipelineStateViewer::beginHTMLExport()
if(!filename.isEmpty())
{
ANALYTIC_SET(UIFeatures.Export.PipelineState, true);
QDir dirinfo = QFileInfo(filename).dir();
if(dirinfo.exists())
{
@@ -718,6 +720,8 @@ void PipelineStateViewer::EditShader(ShaderStage shaderType, ResourceId id,
const ShaderReflection *shaderDetails, const QString &entryFunc,
const QStringMap &files, const QString &mainfile)
{
ANALYTIC_SET(UIFeatures.ShaderEditing, true);
IShaderViewer *sv = m_Ctx.EditShader(
false, entryFunc, files,
// save callback
@@ -882,6 +886,8 @@ bool PipelineStateViewer::SaveShaderFile(const ShaderReflection *shader)
if(!filename.isEmpty())
{
ANALYTIC_SET(UIFeatures.Export.ShaderSave, true);
QDir dirinfo = QFileInfo(filename).dir();
if(dirinfo.exists())
{
+4
View File
@@ -505,6 +505,8 @@ void PythonShell::on_execute_clicked()
{
QString command = ui->lineInput->text();
ANALYTIC_SET(UIFeatures.PythonInterop, true);
appendText(ui->interactiveOutput, command + lit("\n"));
history.push_front(command);
@@ -612,6 +614,8 @@ void PythonShell::on_runScript_clicked()
{
PythonContext *context = newContext();
ANALYTIC_SET(UIFeatures.PythonInterop, true);
ui->scriptOutput->clear();
QString script = QString::fromUtf8(scriptEditor->getText(scriptEditor->textLength() + 1));
+2
View File
@@ -213,6 +213,8 @@ void ResourceInspector::Inspect(ResourceId id)
if(desc)
{
ANALYTIC_SET(UIFeatures.ResourceInspect, true);
ui->resourceName->setText(m_Ctx.GetResourceName(id));
ui->relatedResources->beginUpdate();
+13
View File
@@ -335,6 +335,19 @@ void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderR
// suppress the built-in context menu and hook up our own
if(trace)
{
if(m_Stage == ShaderStage::Vertex)
{
ANALYTIC_SET(UIFeatures.ShaderDebug.Vertex, true);
}
else if(m_Stage == ShaderStage::Pixel)
{
ANALYTIC_SET(UIFeatures.ShaderDebug.Pixel, true);
}
else if(m_Stage == ShaderStage::Compute)
{
ANALYTIC_SET(UIFeatures.ShaderDebug.Compute, true);
}
m_DisassemblyView->usePopUp(SC_POPUP_NEVER);
m_DisassemblyFrame->layout()->removeWidget(m_DisassemblyToolbar);
+30
View File
@@ -2843,6 +2843,30 @@ void TextureViewer::on_overlay_currentIndexChanged(int index)
if(ui->overlay->currentIndex() > 0)
m_TexDisplay.overlay = (DebugOverlay)ui->overlay->currentIndex();
#define ANALYTICS_OVERLAY(name) \
case DebugOverlay::name: ANALYTIC_SET(UIFeatures.TextureDebugOverlays.name, true); break;
switch(m_TexDisplay.overlay)
{
ANALYTICS_OVERLAY(Drawcall);
ANALYTICS_OVERLAY(Wireframe);
ANALYTICS_OVERLAY(Depth);
ANALYTICS_OVERLAY(Stencil);
ANALYTICS_OVERLAY(BackfaceCull);
ANALYTICS_OVERLAY(ViewportScissor);
ANALYTICS_OVERLAY(NaN);
ANALYTICS_OVERLAY(Clipping);
ANALYTICS_OVERLAY(ClearBeforePass);
ANALYTICS_OVERLAY(ClearBeforeDraw);
ANALYTICS_OVERLAY(QuadOverdrawPass);
ANALYTICS_OVERLAY(QuadOverdrawDraw);
ANALYTICS_OVERLAY(TriangleSizePass);
ANALYTICS_OVERLAY(TriangleSizeDraw);
default: break;
}
#undef ANALYTICS_OVERLAY
INVOKE_MEMFN(RT_UpdateAndDisplay);
if(m_Output != NULL && m_PickedPoint.x() >= 0 && m_PickedPoint.y() >= 0)
{
@@ -3359,6 +3383,8 @@ void TextureViewer::on_saveTex_clicked()
if(res)
{
ANALYTIC_SET(UIFeatures.Export.TextureSave, true);
bool ret = false;
QString fn = saveDialog.filename();
@@ -3420,6 +3446,8 @@ void TextureViewer::on_pixelHistory_clicked()
if(!texptr || !m_Output)
return;
ANALYTIC_SET(UIFeatures.PixelHistory, true);
int x = m_PickedPoint.x() >> (int)m_TexDisplay.mip;
int y = m_PickedPoint.y() >> (int)m_TexDisplay.mip;
@@ -3583,6 +3611,8 @@ void TextureViewer::reloadCustomShaders(const QString &filter)
QTextStream stream(&fileHandle);
QString source = stream.readAll();
ANALYTIC_SET(UIFeatures.CustomTextureVisualise, true);
fileHandle.close();
m_CustomShaders[key] = ResourceId();
+12 -4
View File
@@ -4,7 +4,7 @@
#
#-------------------------------------------------
QT += core gui widgets svg
QT += core gui widgets svg network
CONFIG += silent
@@ -163,6 +163,7 @@ SOURCES += Code/qrenderdoc.cpp \
Code/Resources.cpp \
Code/pyrenderdoc/PythonContext.cpp \
Code/Interface/QRDInterface.cpp \
Code/Interface/Analytics.cpp \
Code/Interface/CommonPipelineState.cpp \
Code/Interface/PersistantConfig.cpp \
Code/Interface/RemoteHost.cpp \
@@ -220,7 +221,9 @@ SOURCES += Code/qrenderdoc.cpp \
Windows/PythonShell.cpp \
Windows/Dialogs/PerformanceCounterSelection.cpp \
Windows/PerformanceCounterViewer.cpp \
Windows/ResourceInspector.cpp
Windows/ResourceInspector.cpp \
Windows/Dialogs/AnalyticsConfirmDialog.cpp \
Windows/Dialogs/AnalyticsPromptDialog.cpp
HEADERS += Code/CaptureContext.h \
Code/qprocessinfo.h \
Code/ReplayManager.h \
@@ -231,6 +234,7 @@ HEADERS += Code/CaptureContext.h \
Code/pyrenderdoc/pyconversion.h \
Code/pyrenderdoc/document_check.h \
Code/Interface/QRDInterface.h \
Code/Interface/Analytics.h \
Code/Interface/CommonPipelineState.h \
Code/Interface/PersistantConfig.h \
Code/Interface/RemoteHost.h \
@@ -288,7 +292,9 @@ HEADERS += Code/CaptureContext.h \
Windows/PythonShell.h \
Windows/Dialogs/PerformanceCounterSelection.h \
Windows/PerformanceCounterViewer.h \
Windows/ResourceInspector.h
Windows/ResourceInspector.h \
Windows/Dialogs/AnalyticsConfirmDialog.h \
Windows/Dialogs/AnalyticsPromptDialog.h
FORMS += Windows/Dialogs/AboutDialog.ui \
Windows/MainWindow.ui \
Windows/EventBrowser.ui \
@@ -323,7 +329,9 @@ FORMS += Windows/Dialogs/AboutDialog.ui \
Windows/PythonShell.ui \
Windows/Dialogs/PerformanceCounterSelection.ui \
Windows/PerformanceCounterViewer.ui \
Windows/ResourceInspector.ui
Windows/ResourceInspector.ui \
Windows/Dialogs/AnalyticsConfirmDialog.ui \
Windows/Dialogs/AnalyticsPromptDialog.ui
RESOURCES += Resources/resources.qrc
+34 -2
View File
@@ -88,7 +88,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<SuppressStartupBanner>true</SuppressStartupBanner>
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
<AdditionalIncludeDirectories>$(ProjectDir);$(IntDir)generated\;$(SolutionDir)\renderdoc\api\replay;3rdparty\python\include;3rdparty\pyside\include\PySide2;3rdparty\pyside\include\PySide2\QtCore;3rdparty\pyside\include\PySide2\QtGui;3rdparty\pyside\include\PySide2\QtWidgets;3rdparty\pyside\include\shiboken2;3rdparty\qt\$(Platform)\include;3rdparty\qt\$(Platform)\include\QtWidgets;3rdparty\qt\$(Platform)\include\QtGui;3rdparty\qt\$(Platform)\include\QtCore;3rdparty\qt\$(Platform)\include\QtSvg;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir);$(IntDir)generated\;$(SolutionDir)\renderdoc\api\replay;3rdparty\python\include;3rdparty\pyside\include\PySide2;3rdparty\pyside\include\PySide2\QtCore;3rdparty\pyside\include\PySide2\QtGui;3rdparty\pyside\include\PySide2\QtWidgets;3rdparty\pyside\include\shiboken2;3rdparty\qt\$(Platform)\include;3rdparty\qt\$(Platform)\include\QtWidgets;3rdparty\qt\$(Platform)\include\QtGui;3rdparty\qt\$(Platform)\include\QtCore;3rdparty\qt\$(Platform)\include\QtSvg;3rdparty\qt\$(Platform)\include\QtNetwork;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/Zc:strictStrings /Zc:throwingNew %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>_WINDOWS;UNICODE;WIN32;WIN64;RENDERDOC_PLATFORM_WIN32;PYSIDE2_ENABLED=1;SCINTILLA_QT=1;MAKING_LIBRARY=1;SCI_LEXER=1;QT_NO_CAST_FROM_ASCII;QT_NO_CAST_TO_ASCII;QT_WIDGETS_LIB;QT_GUI_LIB;QT_CORE_LIB;QT_SVG_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level4</WarningLevel>
@@ -100,7 +100,7 @@
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>shiboken2.lib;python36.lib;qtmain.lib;Qt5Widgets.lib;Qt5Gui.lib;Qt5Core.lib;Qt5Svg.lib;shell32.lib</AdditionalDependencies>
<AdditionalDependencies>shiboken2.lib;python36.lib;qtmain.lib;Qt5Widgets.lib;Qt5Gui.lib;Qt5Core.lib;Qt5Svg.lib;Qt5Network.lib;shell32.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>3rdparty\pyside\$(Platform);3rdparty\python\$(Platform);3rdparty\qt\$(Platform)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<DataExecutionPrevention>true</DataExecutionPrevention>
<IgnoreImportLibrary>true</IgnoreImportLibrary>
@@ -561,6 +561,7 @@
</ForcedIncludeFiles>
</ClCompile>
<ClCompile Include="Code\FormatElement.cpp" />
<ClCompile Include="Code\Interface\Analytics.cpp" />
<ClCompile Include="Code\Interface\CommonPipelineState.cpp" />
<ClCompile Include="Code\Interface\PersistantConfig.cpp" />
<ClCompile Include="Code\Interface\QRDInterface.cpp" />
@@ -576,6 +577,8 @@
<ClCompile Include="$(IntDir)generated\moc_RDStyle.cpp" />
<ClCompile Include="$(IntDir)generated\moc_RDTweakedNativeStyle.cpp" />
<ClCompile Include="$(IntDir)generated\moc_AboutDialog.cpp" />
<ClCompile Include="$(IntDir)generated\moc_AnalyticsConfirmDialog.cpp" />
<ClCompile Include="$(IntDir)generated\moc_AnalyticsPromptDialog.cpp" />
<ClCompile Include="$(IntDir)generated\moc_APIInspector.cpp" />
<ClCompile Include="$(IntDir)generated\moc_ResourceInspector.cpp" />
<ClCompile Include="$(IntDir)generated\moc_BufferFormatSpecifier.cpp" />
@@ -685,6 +688,8 @@
<ClCompile Include="Windows\DebugMessageView.cpp" />
<ClCompile Include="Windows\CommentView.cpp" />
<ClCompile Include="Windows\Dialogs\AboutDialog.cpp" />
<ClCompile Include="Windows\Dialogs\AnalyticsConfirmDialog.cpp" />
<ClCompile Include="Windows\Dialogs\AnalyticsPromptDialog.cpp" />
<ClCompile Include="Windows\Dialogs\CaptureDialog.cpp" />
<ClCompile Include="Windows\Dialogs\LiveCapture.cpp" />
<ClCompile Include="Windows\Dialogs\EnvironmentEditor.cpp" />
@@ -866,6 +871,7 @@
<Outputs>$(IntDir)generated\moc_%(Filename).cpp</Outputs>
</CustomBuild>
<ClInclude Include="3rdparty\flowlayout\FlowLayout.h" />
<ClInclude Include="Code\Interface\Analytics.h" />
<ClInclude Include="Code\Interface\CommonPipelineState.h" />
<ClInclude Include="Code\Interface\PersistantConfig.h" />
<ClInclude Include="Code\Interface\QRDInterface.h" />
@@ -879,6 +885,8 @@
<ClInclude Include="Code\pyrenderdoc\structured_conversion.h" />
<ClInclude Include="Code\Resources.h" />
<ClInclude Include="$(IntDir)generated\ui_AboutDialog.h" />
<ClInclude Include="$(IntDir)generated\ui_AnalyticsConfirmDialog.h" />
<ClInclude Include="$(IntDir)generated\ui_AnalyticsPromptDialog.h" />
<ClInclude Include="$(IntDir)generated\ui_APIInspector.h" />
<ClInclude Include="$(IntDir)generated\ui_ResourceInspector.h" />
<ClInclude Include="$(IntDir)generated\ui_BufferFormatSpecifier.h" />
@@ -1111,6 +1119,18 @@
<Message>MOC %(Filename).h</Message>
<Outputs>$(IntDir)generated\moc_%(Filename).cpp</Outputs>
</CustomBuild>
<CustomBuild Include="Windows\Dialogs\AnalyticsConfirmDialog.h">
<AdditionalInputs>%(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs)</AdditionalInputs>
<Command>"$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp"</Command>
<Message>MOC %(Filename).h</Message>
<Outputs>$(IntDir)generated\moc_%(Filename).cpp</Outputs>
</CustomBuild>
<CustomBuild Include="Windows\Dialogs\AnalyticsPromptDialog.h">
<AdditionalInputs>%(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs)</AdditionalInputs>
<Command>"$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp"</Command>
<Message>MOC %(Filename).h</Message>
<Outputs>$(IntDir)generated\moc_%(Filename).cpp</Outputs>
</CustomBuild>
<CustomBuild Include="Windows\Dialogs\CaptureDialog.h">
<AdditionalInputs>%(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe;%(AdditionalInputs)</AdditionalInputs>
<Command>"$(ProjectDir)3rdparty\qt\$(Platform)\bin\moc.exe" -DUNICODE -DWIN32 -DWIN64 -D_WIN32 -D_WIN64 -DRENDERDOC_PLATFORM_WIN32 -DSCINTILLA_QT=1 -DSCI_LEXER=1 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -D_MSC_VER=1900 -I"$(ProjectDir)." -I"$(SolutionDir)\renderdoc\api\replay" -I"$(ProjectDir)3rdparty\qt\$(Platform)\mkspecs/win32-msvc2015" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtWidgets" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtGui" -I"$(ProjectDir)3rdparty\qt\$(Platform)\include\QtCore" "%(Fullpath)" -o "$(IntDir)generated\moc_%(Filename).cpp"</Command>
@@ -1339,6 +1359,18 @@
<Message>UIC %(Filename).ui</Message>
<Outputs>$(IntDir)generated\ui_%(Filename).h</Outputs>
</CustomBuild>
<CustomBuild Include="Windows\Dialogs\AnalyticsConfirmDialog.ui">
<AdditionalInputs>%(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Command>"$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h"</Command>
<Message>UIC %(Filename).ui</Message>
<Outputs>$(IntDir)generated\ui_%(Filename).h</Outputs>
</CustomBuild>
<CustomBuild Include="Windows\Dialogs\AnalyticsPromptDialog.ui">
<AdditionalInputs>%(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Command>"$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h"</Command>
<Message>UIC %(Filename).ui</Message>
<Outputs>$(IntDir)generated\ui_%(Filename).h</Outputs>
</CustomBuild>
<CustomBuild Include="Windows\Dialogs\CaptureDialog.ui">
<AdditionalInputs>%(Fullpath);$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe;%(AdditionalInputs)</AdditionalInputs>
<Command>"$(ProjectDir)3rdparty\qt\$(Platform)\bin\uic.exe" "%(Fullpath)" -o "$(IntDir)generated\ui_%(Filename).h"</Command>
@@ -675,6 +675,21 @@
<ClCompile Include="Windows\ResourceInspector.cpp">
<Filter>Windows</Filter>
</ClCompile>
<ClCompile Include="$(IntDir)generated\moc_AnalyticsConfirmDialog.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="Windows\Dialogs\AnalyticsConfirmDialog.cpp">
<Filter>Windows\Dialogs</Filter>
</ClCompile>
<ClCompile Include="$(IntDir)generated\moc_AnalyticsPromptDialog.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="Windows\Dialogs\AnalyticsPromptDialog.cpp">
<Filter>Windows\Dialogs</Filter>
</ClCompile>
<ClCompile Include="Code\Interface\Analytics.cpp">
<Filter>Code\Interface</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="3rdparty\flowlayout\FlowLayout.h">
@@ -1016,6 +1031,15 @@
<ClInclude Include="$(IntDir)generated\ui_ResourceInspector.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="Code\Interface\Analytics.h">
<Filter>Code\Interface</Filter>
</ClInclude>
<ClInclude Include="$(IntDir)generated\ui_AnalyticsConfirmDialog.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="$(IntDir)generated\ui_AnalyticsPromptDialog.h">
<Filter>Generated Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="Resources\128.png">
@@ -1538,5 +1562,17 @@
<CustomBuild Include="Windows\ResourceInspector.h">
<Filter>Windows</Filter>
</CustomBuild>
<CustomBuild Include="Windows\Dialogs\AnalyticsConfirmDialog.ui">
<Filter>Windows\Dialogs</Filter>
</CustomBuild>
<CustomBuild Include="Windows\Dialogs\AnalyticsConfirmDialog.h">
<Filter>Windows\Dialogs</Filter>
</CustomBuild>
<CustomBuild Include="Windows\Dialogs\AnalyticsPromptDialog.h">
<Filter>Windows\Dialogs</Filter>
</CustomBuild>
<CustomBuild Include="Windows\Dialogs\AnalyticsPromptDialog.ui">
<Filter>Windows\Dialogs</Filter>
</CustomBuild>
</ItemGroup>
</Project>
+8
View File
@@ -947,6 +947,14 @@ Currently this is only true for OpenGL where the superfluous indirect in the bin
worked around by re-sorting bindings.
)");
bool shadersMutable = false;
#if !defined(SWIG)
// flags about edge-case parts of the APIs that might be used in the capture.
bool ShaderLinkage = false;
bool YUVTextures = false;
bool SparseResources = false;
bool MultiGPU = false;
#endif
};
DECLARE_REFLECTION_STRUCT(APIProperties);
+2
View File
@@ -426,6 +426,8 @@ public:
////////////////////////////////////////////////////////////////
// non wrapping interface
APIProperties APIProps;
ID3D11Device *GetReal() { return m_pDevice; }
static std::string GetChunkName(uint32_t idx);
D3D11DebugManager *GetDebugManager() { return m_DebugManager; }
@@ -380,6 +380,8 @@ bool WrappedID3D11Device::Serialise_CreateTexture1D(SerialiserType &ser,
else
hr = m_pDevice->CreateTexture1D(&Descriptor, NULL, &ret);
APIProps.YUVTextures |= IsYUVFormat(Descriptor.Format);
if(FAILED(hr))
{
RDCERR("Failed on resource serialise-creation, HRESULT: %s", ToStr(hr).c_str());
@@ -499,6 +501,8 @@ bool WrappedID3D11Device::Serialise_CreateTexture2D(SerialiserType &ser,
TextureDisplayType dispType = DispTypeForTexture(Descriptor);
APIProps.YUVTextures |= IsYUVFormat(Descriptor.Format);
// unset flags that are unimportant/problematic in replay
Descriptor.MiscFlags &=
~(D3D11_RESOURCE_MISC_SHARED | D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX |
@@ -628,6 +632,8 @@ bool WrappedID3D11Device::Serialise_CreateTexture3D(SerialiserType &ser,
TextureDisplayType dispType = DispTypeForTexture(Descriptor);
APIProps.YUVTextures |= IsYUVFormat(Descriptor.Format);
// unset flags that are unimportant/problematic in replay
Descriptor.MiscFlags &=
~(D3D11_RESOURCE_MISC_SHARED | D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX |
@@ -767,6 +773,9 @@ bool WrappedID3D11Device::Serialise_CreateShaderResourceView(
pSRVDesc->Format = tex2d->m_RealDescriptor->Format;
}
if(pSRVDesc)
APIProps.YUVTextures |= IsYUVFormat(pSRVDesc->Format);
HRESULT hr = m_pDevice->CreateShaderResourceView(
GetResourceManager()->UnwrapResource(pResource), pSRVDesc, &ret);
@@ -1962,6 +1971,8 @@ bool WrappedID3D11Device::Serialise_CreateClassInstance(SerialiserType &ser, LPC
->CreateClassInstance(pClassTypeName, ConstantBufferOffset,
ConstantVectorOffset, TextureOffset, SamplerOffset, &real);
APIProps.ShaderLinkage = true;
if(FAILED(hr))
{
RDCERR("Failed on resource serialise-creation, HRESULT: %s", ToStr(hr).c_str());
@@ -2030,6 +2041,8 @@ bool WrappedID3D11Device::Serialise_GetClassInstance(SerialiserType &ser, LPCSTR
HRESULT hr = UNWRAP(WrappedID3D11ClassLinkage, pClassLinkage)
->GetClassInstance(pClassInstanceName, InstanceIndex, &real);
APIProps.ShaderLinkage = true;
if(FAILED(hr))
{
RDCERR("Failed on resource serialise-creation, HRESULT: %s", ToStr(hr).c_str());
+1 -1
View File
@@ -317,7 +317,7 @@ vector<DebugMessage> D3D11Replay::GetDebugMessages()
APIProperties D3D11Replay::GetAPIProperties()
{
APIProperties ret;
APIProperties ret = m_pDevice->APIProps;
ret.pipelineType = GraphicsAPI::D3D11;
ret.localRenderer = GraphicsAPI::D3D11;
+2
View File
@@ -365,6 +365,8 @@ public:
////////////////////////////////////////////////////////////////
// non wrapping interface
APIProperties APIProps;
WriteSerialiser &GetThreadSerialiser();
ID3D12Device *GetReal() { return m_pDevice; }
@@ -1176,6 +1176,8 @@ bool WrappedID3D12Device::Serialise_CreateCommittedResource(
}
}
APIProps.YUVTextures |= IsYUVFormat(desc.Format);
// always allow SRVs on replay so we can inspect resources
desc.Flags &= ~D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE;
@@ -1423,6 +1425,8 @@ bool WrappedID3D12Device::Serialise_CreatePlacedResource(
m_GPUAddresses.AddTo(range);
}
APIProps.YUVTextures |= IsYUVFormat(Descriptor.Format);
// always allow SRVs on replay so we can inspect resources
Descriptor.Flags &= ~D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE;
@@ -1564,6 +1568,7 @@ bool WrappedID3D12Device::Serialise_CreateReservedResource(
const D3D12_CLEAR_VALUE *pOptimizedClearValue, REFIID riid, void **ppvResource)
{
D3D12NOTIMP("Tiled Resources");
APIProps.SparseResources = true;
return true;
}
+1 -1
View File
@@ -66,7 +66,7 @@ ReplayStatus D3D12Replay::ReadLogInitialisation(RDCFile *rdc, bool storeStructur
APIProperties D3D12Replay::GetAPIProperties()
{
APIProperties ret;
APIProperties ret = m_pDevice->APIProps;
ret.pipelineType = GraphicsAPI::D3D12;
ret.localRenderer = GraphicsAPI::D3D12;
+28
View File
@@ -479,6 +479,34 @@ bool IsSRGBFormat(DXGI_FORMAT f)
return false;
}
bool IsYUVFormat(DXGI_FORMAT f)
{
switch(f)
{
case DXGI_FORMAT_AYUV:
case DXGI_FORMAT_Y410:
case DXGI_FORMAT_Y416:
case DXGI_FORMAT_NV12:
case DXGI_FORMAT_P010:
case DXGI_FORMAT_P016:
case DXGI_FORMAT_420_OPAQUE:
case DXGI_FORMAT_YUY2:
case DXGI_FORMAT_Y210:
case DXGI_FORMAT_Y216:
case DXGI_FORMAT_NV11:
case DXGI_FORMAT_AI44:
case DXGI_FORMAT_IA44:
case DXGI_FORMAT_P8:
case DXGI_FORMAT_A8P8:
case DXGI_FORMAT_P208:
case DXGI_FORMAT_V208:
case DXGI_FORMAT_V408: return true;
default: break;
}
return false;
}
DXGI_FORMAT GetDepthTypedFormat(DXGI_FORMAT f)
{
switch(f)
+1
View File
@@ -55,6 +55,7 @@ bool IsUIntFormat(DXGI_FORMAT f);
bool IsTypelessFormat(DXGI_FORMAT f);
bool IsIntFormat(DXGI_FORMAT f);
bool IsSRGBFormat(DXGI_FORMAT f);
bool IsYUVFormat(DXGI_FORMAT f);
// not technically DXGI, but makes more sense to have it here common between D3D versions
Topology MakePrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY Topo);
+2
View File
@@ -529,6 +529,8 @@ public:
WrappedOpenGL(const GLHookSet &funcs, GLPlatform &platform);
virtual ~WrappedOpenGL();
APIProperties APIProps;
uint64_t GetLogVersion() { return m_SectionVersion; }
static std::string GetChunkName(uint32_t idx);
GLResourceManager *GetResourceManager() { return m_ResourceManager; }
+1 -1
View File
@@ -137,7 +137,7 @@ ResourceId GLReplay::GetLiveID(ResourceId id)
APIProperties GLReplay::GetAPIProperties()
{
APIProperties ret;
APIProperties ret = m_pDriver->APIProps;
ret.pipelineType = GraphicsAPI::OpenGL;
ret.localRenderer = GraphicsAPI::OpenGL;
@@ -892,8 +892,12 @@ bool WrappedOpenGL::Serialise_glUniformSubroutinesuiv(SerialiserType &ser, GLenu
SERIALISE_CHECK_READ_ERRORS();
if(IsReplayingAndReading())
{
m_Real.glUniformSubroutinesuiv(shadertype, count, indices);
APIProps.ShaderLinkage = true;
}
return true;
}
+2
View File
@@ -748,6 +748,8 @@ public:
WrappedVulkan();
virtual ~WrappedVulkan();
APIProperties APIProps;
ResourceId GetContextResourceID() { return m_FrameCaptureRecord->GetResourceID(); }
static std::string GetChunkName(uint32_t idx);
VulkanResourceManager *GetResourceManager() { return m_ResourceManager; }
+1 -1
View File
@@ -649,7 +649,7 @@ void VulkanReplay::Shutdown()
APIProperties VulkanReplay::GetAPIProperties()
{
APIProperties ret;
APIProperties ret = m_pDriver->APIProps;
ret.pipelineType = GraphicsAPI::Vulkan;
ret.localRenderer = GraphicsAPI::Vulkan;
+44
View File
@@ -372,6 +372,50 @@ bool IsSIntFormat(VkFormat f)
return false;
}
bool IsYUVFormat(VkFormat f)
{
switch(f)
{
case VK_FORMAT_G8B8G8R8_422_UNORM_KHR:
case VK_FORMAT_B8G8R8G8_422_UNORM_KHR:
case VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR:
case VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR:
case VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR:
case VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR:
case VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR:
case VK_FORMAT_R10X6_UNORM_PACK16_KHR:
case VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR:
case VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR:
case VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR:
case VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR:
case VK_FORMAT_R12X4_UNORM_PACK16_KHR:
case VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR:
case VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR:
case VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR:
case VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR:
case VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR:
case VK_FORMAT_G16B16G16R16_422_UNORM_KHR:
case VK_FORMAT_B16G16R16G16_422_UNORM_KHR:
case VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR:
case VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR:
case VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR:
case VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR:
case VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR: return true;
default: break;
}
return false;
}
VkFormat GetDepthOnlyFormat(VkFormat f)
{
switch(f)
+1
View File
@@ -1172,6 +1172,7 @@ bool IsStencilOnlyFormat(VkFormat f);
bool IsSRGBFormat(VkFormat f);
bool IsUIntFormat(VkFormat f);
bool IsSIntFormat(VkFormat f);
bool IsYUVFormat(VkFormat f);
VkFormat GetDepthOnlyFormat(VkFormat f);
VkFormat GetUIntTypedFormat(VkFormat f);
@@ -1108,6 +1108,12 @@ bool WrappedVulkan::Serialise_vkCreateBuffer(SerialiserType &ser, VkDevice devic
VkResult ret = ObjDisp(device)->CreateBuffer(Unwrap(device), &CreateInfo, NULL, &buf);
if(CreateInfo.flags &
(VK_BUFFER_CREATE_SPARSE_BINDING_BIT | VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT))
{
APIProps.SparseResources = true;
}
CreateInfo.usage = origusage;
if(ret != VK_SUCCESS)
@@ -1355,6 +1361,13 @@ bool WrappedVulkan::Serialise_vkCreateImage(SerialiserType &ser, VkDevice device
}
}
APIProps.YUVTextures |= IsYUVFormat(CreateInfo.format);
if(CreateInfo.flags & (VK_IMAGE_CREATE_SPARSE_BINDING_BIT | VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT))
{
APIProps.SparseResources = true;
}
VkResult ret = ObjDisp(device)->CreateImage(Unwrap(device), &CreateInfo, NULL, &img);
CreateInfo.usage = origusage;
@@ -1645,6 +1658,8 @@ bool WrappedVulkan::Serialise_vkCreateImageView(SerialiserType &ser, VkDevice de
unwrappedInfo.image = Unwrap(unwrappedInfo.image);
VkResult ret = ObjDisp(device)->CreateImageView(Unwrap(device), &unwrappedInfo, NULL, &view);
APIProps.YUVTextures |= IsYUVFormat(CreateInfo.format);
if(ret != VK_SUCCESS)
{
RDCERR("Failed on resource serialise-creation, VkResult: %s", ToStr(ret).c_str());
+6 -1
View File
@@ -399,7 +399,12 @@ void DoSerialise(SerialiserType &ser, APIProperties &el)
SERIALISE_MEMBER(localRenderer);
SERIALISE_MEMBER(degraded);
SIZE_CHECK(12);
SERIALISE_MEMBER(ShaderLinkage);
SERIALISE_MEMBER(YUVTextures);
SERIALISE_MEMBER(SparseResources);
SERIALISE_MEMBER(MultiGPU);
SIZE_CHECK(16);
}
template <typename SerialiserType>