diff --git a/qrenderdoc/Code/Interface/QRDInterface.h b/qrenderdoc/Code/Interface/QRDInterface.h index e1860826f..14f76185f 100644 --- a/qrenderdoc/Code/Interface/QRDInterface.h +++ b/qrenderdoc/Code/Interface/QRDInterface.h @@ -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 diff --git a/qrenderdoc/Code/Interface/RemoteHost.cpp b/qrenderdoc/Code/Interface/RemoteHost.cpp index 255216ee8..5082333c8 100644 --- a/qrenderdoc/Code/Interface/RemoteHost.cpp +++ b/qrenderdoc/Code/Interface/RemoteHost.cpp @@ -26,7 +26,6 @@ #include #include "Code/QRDUtils.h" #include "QRDInterface.h" -#include "renderdoc_replay.h" RemoteHost::RemoteHost() { diff --git a/qrenderdoc/Code/QRDUtils.h b/qrenderdoc/Code/QRDUtils.h index 11ce54817..e0361fb78 100644 --- a/qrenderdoc/Code/QRDUtils.h +++ b/qrenderdoc/Code/QRDUtils.h @@ -33,7 +33,6 @@ #include #include #include "Code/Interface/QRDInterface.h" -#include "renderdoc_replay.h" template inline T AlignUp(T x, T a) diff --git a/qrenderdoc/Code/ReplayManager.h b/qrenderdoc/Code/ReplayManager.h index 52034c533..3eb681de7 100644 --- a/qrenderdoc/Code/ReplayManager.h +++ b/qrenderdoc/Code/ReplayManager.h @@ -34,7 +34,6 @@ #include #include "Interface/QRDInterface.h" #include "QRDUtils.h" -#include "renderdoc_replay.h" struct IReplayController; class LambdaThread; diff --git a/qrenderdoc/Code/pyrenderdoc/PythonContext.cpp b/qrenderdoc/Code/pyrenderdoc/PythonContext.cpp index 2a1945903..a6c17fdf9 100644 --- a/qrenderdoc/Code/pyrenderdoc/PythonContext.cpp +++ b/qrenderdoc/Code/pyrenderdoc/PythonContext.cpp @@ -57,7 +57,6 @@ PyTypeObject **SbkPySide2_QtWidgetsTypes = NULL; #include #include "Code/QRDUtils.h" #include "PythonContext.h" -#include "renderdoc_replay.h" // defined in SWIG-generated renderdoc_python.cpp extern "C" PyObject *PyInit__renderdoc(void); diff --git a/qrenderdoc/Code/pyrenderdoc/PythonContext.h b/qrenderdoc/Code/pyrenderdoc/PythonContext.h index 45ac84ebc..233d33965 100644 --- a/qrenderdoc/Code/pyrenderdoc/PythonContext.h +++ b/qrenderdoc/Code/pyrenderdoc/PythonContext.h @@ -30,7 +30,6 @@ #include #include #include "Code/QRDUtils.h" -#include "renderdoc_replay.h" class QThread; diff --git a/qrenderdoc/Code/pyrenderdoc/renderdoc.i b/qrenderdoc/Code/pyrenderdoc/renderdoc.i index af387464b..0bfee7103 100644 --- a/qrenderdoc/Code/pyrenderdoc/renderdoc.i +++ b/qrenderdoc/Code/pyrenderdoc/renderdoc.i @@ -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"; diff --git a/qrenderdoc/Styles/StyleData.cpp b/qrenderdoc/Styles/StyleData.cpp index 1a24899c0..4659093d2 100644 --- a/qrenderdoc/Styles/StyleData.cpp +++ b/qrenderdoc/Styles/StyleData.cpp @@ -24,6 +24,7 @@ #include "StyleData.h" #include +#include "Code/QRDUtils.h" #include "RDStyle/RDStyle.h" #include "RDTweakedNativeStyle/RDTweakedNativeStyle.h" diff --git a/qrenderdoc/Widgets/CustomPaintWidget.cpp b/qrenderdoc/Widgets/CustomPaintWidget.cpp index 7d516f188..177f21593 100644 --- a/qrenderdoc/Widgets/CustomPaintWidget.cpp +++ b/qrenderdoc/Widgets/CustomPaintWidget.cpp @@ -26,7 +26,6 @@ #include #include #include "Code/CaptureContext.h" -#include "renderdoc_replay.h" CustomPaintWidget::CustomPaintWidget(QWidget *parent) : QWidget(parent) { diff --git a/qrenderdoc/Windows/Dialogs/TextureSaveDialog.h b/qrenderdoc/Windows/Dialogs/TextureSaveDialog.h index ba3a5e7e6..5dad109e0 100644 --- a/qrenderdoc/Windows/Dialogs/TextureSaveDialog.h +++ b/qrenderdoc/Windows/Dialogs/TextureSaveDialog.h @@ -26,7 +26,7 @@ #include #include -#include "renderdoc_replay.h" +#include "Code/Interface/QRDInterface.h" namespace Ui { diff --git a/qrenderdoc/Windows/Dialogs/VirtualFileDialog.cpp b/qrenderdoc/Windows/Dialogs/VirtualFileDialog.cpp index d3b375be2..a6699f0dc 100644 --- a/qrenderdoc/Windows/Dialogs/VirtualFileDialog.cpp +++ b/qrenderdoc/Windows/Dialogs/VirtualFileDialog.cpp @@ -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 &files) { - QString homeDir = QString::fromUtf8(path); + Renderer.GetHomeFolder(true, [this](const rdctype::str &path, + const rdctype::array &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 &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 &files) { + Renderer.ListFolder(makePath(node), true, [this, node](const rdctype::str &path, + const rdctype::array &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 sortedFiles; - sortedFiles.reserve(files.count); - for(const PathEntry &f : files) - sortedFiles.push_back(f); + QVector 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); + } + }); } }; diff --git a/renderdoc/api/replay/basic_types.h b/renderdoc/api/replay/basic_types.h index 6ac2b7d98..68590c883 100644 --- a/renderdoc/api/replay/basic_types.h +++ b/renderdoc/api/replay/basic_types.h @@ -262,8 +262,11 @@ struct str : public rdctype::array } } - 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 : ""; } }; diff --git a/renderdoc/driver/ihv/amd/amd_counters.cpp b/renderdoc/driver/ihv/amd/amd_counters.cpp index a0d4879fd..d3d408068 100644 --- a/renderdoc/driver/ihv/amd/amd_counters.cpp +++ b/renderdoc/driver/ihv/amd/amd_counters.cpp @@ -219,7 +219,7 @@ vector 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; }