Changeset View
Changeset View
Standalone View
Standalone View
source/blender/sequencer/intern/prefetch.c
| Show First 20 Lines • Show All 322 Lines • ▼ Show 20 Lines | if (!pfjob) { | ||||
| return; | return; | ||||
| } | } | ||||
| pfjob->scene = scene; | pfjob->scene = scene; | ||||
| seq_prefetch_free_depsgraph(pfjob); | seq_prefetch_free_depsgraph(pfjob); | ||||
| seq_prefetch_init_depsgraph(pfjob); | seq_prefetch_init_depsgraph(pfjob); | ||||
| } | } | ||||
| static void seq_prefetch_update_active_seqbase(PrefetchJob *pfjob) | |||||
| { | |||||
| MetaStack *ms_orig = SEQ_meta_stack_active_get(SEQ_editing_get(pfjob->scene)); | |||||
| Editing *ed_eval = SEQ_editing_get(pfjob->scene_eval); | |||||
| if (ms_orig != NULL) { | |||||
| Sequence *meta_eval = seq_prefetch_get_original_sequence(ms_orig->parseq, pfjob->scene_eval); | |||||
| SEQ_seqbase_active_set(ed_eval, &meta_eval->seqbase); | |||||
| } | |||||
| else { | |||||
| SEQ_seqbase_active_set(ed_eval, &ed_eval->seqbase); | |||||
| } | |||||
| } | |||||
| static void seq_prefetch_resume(Scene *scene) | static void seq_prefetch_resume(Scene *scene) | ||||
| { | { | ||||
| PrefetchJob *pfjob = seq_prefetch_job_get(scene); | PrefetchJob *pfjob = seq_prefetch_job_get(scene); | ||||
| if (pfjob && pfjob->waiting) { | if (pfjob && pfjob->waiting) { | ||||
| BLI_condition_notify_one(&pfjob->prefetch_suspend_cond); | BLI_condition_notify_one(&pfjob->prefetch_suspend_cond); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | while (seq_prefetch_cfra(pfjob) <= pfjob->scene->r.efra) { | ||||
| /* This is quite hacky solution: | /* This is quite hacky solution: | ||||
| * We need cross-reference original scene with copy for cache. | * We need cross-reference original scene with copy for cache. | ||||
| * However depsgraph must not have this data, because it will try to kill this job. | * However depsgraph must not have this data, because it will try to kill this job. | ||||
| * Scene copy don't reference original scene. Perhaps, this could be done by depsgraph. | * Scene copy don't reference original scene. Perhaps, this could be done by depsgraph. | ||||
| * Set to NULL before return! | * Set to NULL before return! | ||||
| */ | */ | ||||
| pfjob->scene_eval->ed->prefetch_job = pfjob; | pfjob->scene_eval->ed->prefetch_job = pfjob; | ||||
| ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(pfjob->scene)); | ListBase *seqbase = SEQ_active_seqbase_get(SEQ_editing_get(pfjob->scene_eval)); | ||||
| if (seq_prefetch_must_skip_frame(pfjob, seqbase)) { | if (seq_prefetch_must_skip_frame(pfjob, seqbase)) { | ||||
| pfjob->num_frames_prefetched++; | pfjob->num_frames_prefetched++; | ||||
| continue; | continue; | ||||
| } | } | ||||
| ImBuf *ibuf = SEQ_render_give_ibuf(&pfjob->context_cpy, seq_prefetch_cfra(pfjob), 0); | ImBuf *ibuf = SEQ_render_give_ibuf(&pfjob->context_cpy, seq_prefetch_cfra(pfjob), 0); | ||||
| seq_cache_free_temp_cache(pfjob->scene, pfjob->context.task_id, seq_prefetch_cfra(pfjob)); | seq_cache_free_temp_cache(pfjob->scene, pfjob->context.task_id, seq_prefetch_cfra(pfjob)); | ||||
| IMB_freeImBuf(ibuf); | IMB_freeImBuf(ibuf); | ||||
| ▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | static PrefetchJob *seq_prefetch_start_ex(const SeqRenderData *context, float cfra) | ||||
| pfjob->num_frames_prefetched = 1; | pfjob->num_frames_prefetched = 1; | ||||
| pfjob->waiting = false; | pfjob->waiting = false; | ||||
| pfjob->stop = false; | pfjob->stop = false; | ||||
| pfjob->running = true; | pfjob->running = true; | ||||
| seq_prefetch_update_scene(context->scene); | seq_prefetch_update_scene(context->scene); | ||||
| seq_prefetch_update_context(context); | seq_prefetch_update_context(context); | ||||
| seq_prefetch_update_active_seqbase(pfjob); | |||||
| BLI_threadpool_remove(&pfjob->threads, pfjob); | BLI_threadpool_remove(&pfjob->threads, pfjob); | ||||
| BLI_threadpool_insert(&pfjob->threads, pfjob); | BLI_threadpool_insert(&pfjob->threads, pfjob); | ||||
| return pfjob; | return pfjob; | ||||
| } | } | ||||
| void seq_prefetch_start(const SeqRenderData *context, float timeline_frame) | void seq_prefetch_start(const SeqRenderData *context, float timeline_frame) | ||||
| ▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines | |||||