renderer: ensure offscreen surface is created in main thread

Fixes render crash on some platforms.
This commit is contained in:
itsmattkc
2020-05-27 04:05:01 +10:00
parent 14ac1ada6e
commit a0dec75f2b
4 changed files with 23 additions and 29 deletions
+9 -15
View File
@@ -25,10 +25,17 @@
OLIVE_NAMESPACE_ENTER
OpenGLBackend::OpenGLBackend(QObject* parent) :
RenderBackend(parent),
proxy_(nullptr)
RenderBackend(parent)
{
proxy_ = new OpenGLProxy();
QThread* proxy_thread = new QThread();
proxy_thread->start(QThread::IdlePriority);
proxy_->moveToThread(proxy_thread);
if (!proxy_->Init()) {
ClearProxy();
}
}
OpenGLBackend::~OpenGLBackend()
@@ -40,19 +47,6 @@ OpenGLBackend::~OpenGLBackend()
RenderWorker *OpenGLBackend::CreateNewWorker()
{
if (!proxy_) {
proxy_ = new OpenGLProxy();
QThread* proxy_thread = new QThread();
proxy_thread->start(QThread::IdlePriority);
proxy_->moveToThread(proxy_thread);
if (!proxy_->Init()) {
ClearProxy();
return nullptr;
}
}
return new OpenGLWorker(this, proxy_);
}
+2 -2
View File
@@ -41,6 +41,8 @@ public:
virtual ~RenderBackend() override;
void Close();
void SetViewerNode(ViewerOutput* viewer_node);
void SetUpdateWithGraph(bool e);
@@ -76,8 +78,6 @@ public slots:
protected:
virtual RenderWorker* CreateNewWorker() = 0;
void Close();
private:
void CopyNodeInputValue(NodeInput* input);
Node *CopyNodeConnections(Node *src_node);