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
}
r->d->debugMarkers = flags.testFlag(EnableDebugMarkers);
if (r->d->create(flags)) {
r->dtype = impl;
r->d->implType = impl;
r->d->implThread = QThread::currentThread();
return r.take();
}
}
......@@ -3566,7 +3567,15 @@ QRhi *QRhi::create(Implementation impl, QRhiInitParams *params, Flags flags, QRh
*/
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 @@
#include <QSize>
#include <QMatrix4x4>
#include <QVector>
#include <QThread>
#include <QImage>
#include <QtShaderTools/QBakedShader>
#include <functional>
......@@ -1279,6 +1280,7 @@ public:
QRhiNativeHandles *importDevice = nullptr);
Implementation backend() const;
QThread *thread() const;
QRhiGraphicsPipeline *newGraphicsPipeline();
QRhiShaderResourceBindings *newShaderResourceBindings();
......@@ -1342,7 +1344,6 @@ protected:
private:
Q_DISABLE_COPY(QRhi)
QRhiImplementation *d = nullptr;
QRhi::Implementation dtype;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QRhi::Flags)
......
......@@ -202,6 +202,8 @@ protected:
bool debugMarkers = false;
private:
QRhi::Implementation implType;
QThread *implThread;
QRhiProfiler profiler;
QVector<QRhiResourceUpdateBatch *> resUpdPool;
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