renderer: ensure offscreen surface is created in main thread
Fixes render crash on some platforms.
This commit is contained in:
@@ -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_);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user