mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 09:00:44 +00:00
Add a macro that enables qt-compatibility in the renderdoc replay API
* This will be used to remove the ToQStr everywhere (where it's not used for actual stringification of enums/structs)
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#define QFormatStr(fmt) QStringLiteral(fmt)
|
||||
|
||||
// we depend on the internal RenderDoc API, but the bindings for that are imported entirely
|
||||
#define RENDERDOC_QT_COMPAT
|
||||
#include "renderdoc_replay.h"
|
||||
|
||||
// this is pre-declared as an opaque type as we only support converting to QWidget* via PySide
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <QThread>
|
||||
#include "Code/QRDUtils.h"
|
||||
#include "QRDInterface.h"
|
||||
#include "renderdoc_replay.h"
|
||||
|
||||
RemoteHost::RemoteHost()
|
||||
{
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <QSemaphore>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include "Code/Interface/QRDInterface.h"
|
||||
#include "renderdoc_replay.h"
|
||||
|
||||
template <typename T>
|
||||
inline T AlignUp(T x, T a)
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <functional>
|
||||
#include "Interface/QRDInterface.h"
|
||||
#include "QRDUtils.h"
|
||||
#include "renderdoc_replay.h"
|
||||
|
||||
struct IReplayController;
|
||||
class LambdaThread;
|
||||
|
||||
@@ -57,7 +57,6 @@ PyTypeObject **SbkPySide2_QtWidgetsTypes = NULL;
|
||||
#include <QTimer>
|
||||
#include "Code/QRDUtils.h"
|
||||
#include "PythonContext.h"
|
||||
#include "renderdoc_replay.h"
|
||||
|
||||
// defined in SWIG-generated renderdoc_python.cpp
|
||||
extern "C" PyObject *PyInit__renderdoc(void);
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <QWidget>
|
||||
#include <typeinfo>
|
||||
#include "Code/QRDUtils.h"
|
||||
#include "renderdoc_replay.h"
|
||||
|
||||
class QThread;
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ CONTAINER_TYPEMAPS(rdctype::array)
|
||||
%ignore rdctype::array::operator=;
|
||||
%ignore rdctype::array::operator[];
|
||||
%ignore rdctype::str::operator=;
|
||||
%ignore rdctype::str::operator const char *;
|
||||
%ignore rdctype::str::operator std::string;
|
||||
|
||||
// add __str__ functions
|
||||
%feature("python:tp_str") ResourceId "resid_str";
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "StyleData.h"
|
||||
#include <QApplication>
|
||||
#include "Code/QRDUtils.h"
|
||||
#include "RDStyle/RDStyle.h"
|
||||
#include "RDTweakedNativeStyle/RDTweakedNativeStyle.h"
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <math.h>
|
||||
#include <QPainter>
|
||||
#include "Code/CaptureContext.h"
|
||||
#include "renderdoc_replay.h"
|
||||
|
||||
CustomPaintWidget::CustomPaintWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include <QDialog>
|
||||
#include <QTimer>
|
||||
#include "renderdoc_replay.h"
|
||||
#include "Code/Interface/QRDInterface.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
||||
@@ -55,15 +55,16 @@ public:
|
||||
makeIconStates(exeIcon, Pixmaps::page_white_code(parent));
|
||||
makeIconStates(dirIcon, Pixmaps::folder(parent));
|
||||
|
||||
Renderer.GetHomeFolder(true, [this](const char *path, const rdctype::array<PathEntry> &files) {
|
||||
QString homeDir = QString::fromUtf8(path);
|
||||
Renderer.GetHomeFolder(true, [this](const rdctype::str &path,
|
||||
const rdctype::array<PathEntry> &files) {
|
||||
QString homeDir = path;
|
||||
|
||||
if(QChar(QLatin1Char(path[0])).isLetter() && path[1] == ':')
|
||||
{
|
||||
NTPaths = true;
|
||||
|
||||
// NT paths
|
||||
Renderer.ListFolder(lit("/"), true, [this, homeDir](const char *path,
|
||||
Renderer.ListFolder(lit("/"), true, [this, homeDir](const rdctype::str &path,
|
||||
const rdctype::array<PathEntry> &files) {
|
||||
for(int i = 0; i < files.count; i++)
|
||||
{
|
||||
@@ -448,37 +449,37 @@ private:
|
||||
if(!(node->file.flags & PathProperty::Directory))
|
||||
return;
|
||||
|
||||
Renderer.ListFolder(
|
||||
makePath(node), true, [this, node](const char *path, const rdctype::array<PathEntry> &files) {
|
||||
Renderer.ListFolder(makePath(node), true, [this, node](const rdctype::str &path,
|
||||
const rdctype::array<PathEntry> &files) {
|
||||
|
||||
if(files.count == 1 && (files[0].flags & PathProperty::ErrorAccessDenied))
|
||||
{
|
||||
node->file.flags |= PathProperty::ErrorAccessDenied;
|
||||
return;
|
||||
}
|
||||
if(files.count == 1 && (files[0].flags & PathProperty::ErrorAccessDenied))
|
||||
{
|
||||
node->file.flags |= PathProperty::ErrorAccessDenied;
|
||||
return;
|
||||
}
|
||||
|
||||
QVector<PathEntry> sortedFiles;
|
||||
sortedFiles.reserve(files.count);
|
||||
for(const PathEntry &f : files)
|
||||
sortedFiles.push_back(f);
|
||||
QVector<PathEntry> sortedFiles;
|
||||
sortedFiles.reserve(files.count);
|
||||
for(const PathEntry &f : files)
|
||||
sortedFiles.push_back(f);
|
||||
|
||||
qSort(sortedFiles.begin(), sortedFiles.end(), [](const PathEntry &a, const PathEntry &b) {
|
||||
// sort greater than so that files with the flag are sorted before those without
|
||||
if((a.flags & PathProperty::Directory) != (b.flags & PathProperty::Directory))
|
||||
return (a.flags & PathProperty::Directory) > (b.flags & PathProperty::Directory);
|
||||
qSort(sortedFiles.begin(), sortedFiles.end(), [](const PathEntry &a, const PathEntry &b) {
|
||||
// sort greater than so that files with the flag are sorted before those without
|
||||
if((a.flags & PathProperty::Directory) != (b.flags & PathProperty::Directory))
|
||||
return (a.flags & PathProperty::Directory) > (b.flags & PathProperty::Directory);
|
||||
|
||||
return strcmp(a.filename.c_str(), b.filename.c_str()) < 0;
|
||||
});
|
||||
return strcmp(a.filename.c_str(), b.filename.c_str()) < 0;
|
||||
});
|
||||
|
||||
for(int i = 0; i < sortedFiles.count(); i++)
|
||||
{
|
||||
FSNode *child = new FSNode();
|
||||
child->parent = node;
|
||||
child->parentIndex = i;
|
||||
child->file = sortedFiles[i];
|
||||
node->children.push_back(child);
|
||||
}
|
||||
});
|
||||
for(int i = 0; i < sortedFiles.count(); i++)
|
||||
{
|
||||
FSNode *child = new FSNode();
|
||||
child->parent = node;
|
||||
child->parentIndex = i;
|
||||
child->file = sortedFiles[i];
|
||||
node->children.push_back(child);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -262,8 +262,11 @@ struct str : public rdctype::array<char>
|
||||
}
|
||||
}
|
||||
|
||||
operator const char *() const { return elems ? elems : ""; }
|
||||
DOCUMENT("");
|
||||
#if defined(RENDERDOC_QT_COMPAT)
|
||||
operator QString() const { return QString::fromUtf8(elems, count); }
|
||||
#endif
|
||||
|
||||
operator std::string() const { return std::string(elems, elems + count); }
|
||||
const char *c_str() const { return elems ? elems : ""; }
|
||||
};
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ vector<AMDCounters::InternalCounterDescription> AMDCounters::EnumerateCounters()
|
||||
internalDesc.desc = InternalGetCounterDescription(i);
|
||||
|
||||
// We ignore any D3D11 counters, as those are handled elsewhere
|
||||
if(strncmp(internalDesc.desc.description, "#D3D11#", 7) == 0)
|
||||
if(strncmp(internalDesc.desc.description.c_str(), "#D3D11#", 7) == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user