copy node graph before rendering

Previous iterations would use mutexes to prevent changing of the graph
mid-render, however several user actions would need to capture these mutexes
causing the main thread to hang until the current render job (frame/range of
samples) was complete. We now copy the nodes necessary as part of the "compile"
process so that the main thread shouldn't need nearly as much blocking while
caching occurs.
This commit is contained in:
itsmattkc
2019-11-23 08:53:52 +09:00
parent b233aa5319
commit 2cfccbfbef
7 changed files with 87 additions and 23 deletions
+16
View File
@@ -4,6 +4,7 @@
#include <QLinkedList>
#include "decodercache.h"
#include "node/graph.h"
#include "node/output/viewer/viewer.h"
#include "renderworker.h"
@@ -45,6 +46,8 @@ protected:
virtual void DecompileInternal() = 0;
rational SequenceLength();
const QVector<QThread*>& threads();
/**
@@ -76,6 +79,8 @@ protected:
ViewerOutput* viewer_node() const;
bool ViewerIsConnected() const;
DecoderCache* decoder_cache();
const QString& cache_id() const;
@@ -104,6 +109,11 @@ private:
*/
ViewerOutput* viewer_node_;
/**
* @brief Internal reference to the copied viewer node we made in the compilation process
*/
ViewerOutput* copied_viewer_node_;
/**
* @brief Error string that can be set in SetError() to handle failures
*/
@@ -115,9 +125,15 @@ private:
qint64 cache_time_;
QString cache_id_;
NodeGraph copied_graph_;
bool recompile_queued_;
private slots:
void ThreadRequestedSibling(NodeDependency dep);
void QueueRecompile();
};
#endif // RENDERBACKEND_H