fixed various caching issues

This commit is contained in:
itsmattkc
2019-09-02 22:58:44 +10:00
parent 3a9af58344
commit 12bc5839a6
19 changed files with 196 additions and 61 deletions
+4
View File
@@ -98,6 +98,8 @@ QVariant RendererProcessor::Value(NodeOutput* output, const rational& time)
// Find frame in map
if (time_hash_map_.contains(time)) {
qDebug() << "Showed:" << time_hash_map_[time].toHex();
QString fn = CachePathName(time_hash_map_[time]);
if (QFileInfo::exists(fn)) {
@@ -362,6 +364,8 @@ void RendererProcessor::DownloadThreadFinished(const rational& time)
texture_output_->ClearCachedValue();
foreach (NodeEdgePtr edge, edges) {
edge->input()->ClearCachedValue();
edge->input()->parent()->InvalidateCache(time,
time,
edge->input());
@@ -85,11 +85,20 @@ void RendererProcessThread::ProcessLoop()
NodeOutput* output_to_process = path_.node();
Node* node_to_process = output_to_process->parent();
node_to_process->Lock();
QList<Node*> all_deps = node_to_process->GetDependencies();
foreach (Node* dep, all_deps) {
dep->Lock();
}
// Check hash
QCryptographicHash hasher(QCryptographicHash::Sha1);
node_to_process->Hash(&hasher, output_to_process, path_.time());
hash_ = hasher.result();
texture_ = nullptr;
if (!parent_->HasHash(hash_)) {
QList<NodeDependency> deps = node_to_process->RunDependencies(output_to_process, path_.time());
@@ -106,6 +115,12 @@ void RendererProcessThread::ProcessLoop()
render_instance()->context()->functions()->glFinish();
}
foreach (Node* dep, all_deps) {
dep->Unlock();
}
node_to_process->Unlock();
emit FinishedPath();
}
}
@@ -31,6 +31,7 @@ RendererThreadBase::RendererThreadBase(QOpenGLContext *share_ctx, const int &wid
mode_(mode),
render_instance_(nullptr)
{
connect(share_ctx_, SIGNAL(aboutToBeDestroyed()), this, SLOT(Cancel()));
}
void RendererThreadBase::Cancel()
@@ -39,14 +39,15 @@ public:
const olive::PixelFormat& format,
const olive::RenderMode& mode);
void Cancel();
RenderInstance* render_instance();
void StartThread(Priority priority = InheritPriority);
virtual void run() override;
public slots:
void Cancel();
protected:
virtual void ProcessLoop() = 0;