Commit 0426af6d authored by Laszlo Agocs's avatar Laszlo Agocs

Add a QThread getter to QRhi

parent 7873f256
...@@ -3553,7 +3553,8 @@ QRhi *QRhi::create(Implementation impl, QRhiInitParams *params, Flags flags, QRh ...@@ -3553,7 +3553,8 @@ QRhi *QRhi::create(Implementation impl, QRhiInitParams *params, Flags flags, QRh
} }
r->d->debugMarkers = flags.testFlag(EnableDebugMarkers); r->d->debugMarkers = flags.testFlag(EnableDebugMarkers);
if (r->d->create(flags)) { if (r->d->create(flags)) {
r->dtype = impl; r->d->implType = impl;
r->d->implThread = QThread::currentThread();
return r.take(); return r.take();
} }
} }
...@@ -3566,7 +3567,15 @@ QRhi *QRhi::create(Implementation impl, QRhiInitParams *params, Flags flags, QRh ...@@ -3566,7 +3567,15 @@ QRhi *QRhi::create(Implementation impl, QRhiInitParams *params, Flags flags, QRh
*/ */
QRhi::Implementation QRhi::backend() const QRhi::Implementation QRhi::backend() const
{ {
return dtype; return d->implType;
}
/*!
\return the thread on which the QRhi was \l{QRhi::create()}{initialized}.
*/
QThread *QRhi::thread() const
{
return d->implThread;
} }
/*! /*!
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <QSize> #include <QSize>
#include <QMatrix4x4> #include <QMatrix4x4>
#include <QVector> #include <QVector>
#include <QThread>
#include <QImage> #include <QImage>
#include <QtShaderTools/QBakedShader> #include <QtShaderTools/QBakedShader>
#include <functional> #include <functional>
...@@ -1279,6 +1280,7 @@ public: ...@@ -1279,6 +1280,7 @@ public:
QRhiNativeHandles *importDevice = nullptr); QRhiNativeHandles *importDevice = nullptr);
Implementation backend() const; Implementation backend() const;
QThread *thread() const;
QRhiGraphicsPipeline *newGraphicsPipeline(); QRhiGraphicsPipeline *newGraphicsPipeline();
QRhiShaderResourceBindings *newShaderResourceBindings(); QRhiShaderResourceBindings *newShaderResourceBindings();
...@@ -1342,7 +1344,6 @@ protected: ...@@ -1342,7 +1344,6 @@ protected:
private: private:
Q_DISABLE_COPY(QRhi) Q_DISABLE_COPY(QRhi)
QRhiImplementation *d = nullptr; QRhiImplementation *d = nullptr;
QRhi::Implementation dtype;
}; };
Q_DECLARE_OPERATORS_FOR_FLAGS(QRhi::Flags) Q_DECLARE_OPERATORS_FOR_FLAGS(QRhi::Flags)
......
...@@ -202,6 +202,8 @@ protected: ...@@ -202,6 +202,8 @@ protected:
bool debugMarkers = false; bool debugMarkers = false;
private: private:
QRhi::Implementation implType;
QThread *implThread;
QRhiProfiler profiler; QRhiProfiler profiler;
QVector<QRhiResourceUpdateBatch *> resUpdPool; QVector<QRhiResourceUpdateBatch *> resUpdPool;
QBitArray resUpdPoolMap; QBitArray resUpdPoolMap;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment