107 if (scene && scene->
ed) {
148 for (
Strip &strip_orig : *seqbase) {
149 if (
STREQ(strip->name, strip_orig.name)) {
155 if (match !=
nullptr) {
173 return pfjob ? &pfjob->
context :
nullptr;
178 Scene *scene = context->scene;
179 if (context->is_prefetch_render) {
181 if (context !=
nullptr) {
182 scene = context->scene;
190 Scene *scene = context->scene;
191 if (context->is_prefetch_render) {
193 if (context !=
nullptr) {
194 scene = context->scene;
210 if (new_frame >= playback_range.
end_frame) {
225 *r_start = std::numeric_limits<int>::min();
226 *r_end = std::numeric_limits<int>::min();
229 if (pfjob ==
nullptr) {
236 *r_start = pfjob->
cfra;
291 if (cfra > pfjob->
cfra) {
292 int delta = cfra - pfjob->
cfra;
300 if (cfra < pfjob->cfra) {
330 for (
Scene *scene =
G.main->scenes.first(); scene; scene =
static_cast<Scene *
>(scene->id.next))
360 context->preview_render_size,
370 context->preview_render_size,
384 pfjob->
scene = scene;
394 if (ms_orig !=
nullptr) {
433 ListBaseT<SeqTimelineChannel> *channels,
434 ListBaseT<Strip> *seqbase,
437 SeqRenderState
state);
441 ListBaseT<SeqTimelineChannel> *channels,
442 ListBaseT<Strip> *seqbase,
457 ListBaseT<SeqTimelineChannel> *channels,
458 ListBaseT<Strip> *seqbase,
464 if (
state.strips_in_progress.contains(strip)) {
470 strip->scene !=
nullptr)
476 if ((strip->input1 &&
509 int meta_frame =
give_frame_index(scene, strip, frame) + strip->content_start();
517 strip->scene !=
nullptr &&
editing_get(strip->scene))
519 state.strips_in_progress.add(strip);
521 const Scene *target_scene = strip->scene;
523 int target_timeline_frame =
give_frame_index(scene, strip, frame) + target_scene->
r.sfra;
526 target_ed->current_channels(),
527 target_ed->current_strips(),
528 target_timeline_frame,
549 if (timeline_frame == pfjob->
scene->
r.cfra) {
644 if (!context->scene->ed) {
647 pfjob = MEM_new<PrefetchJob>(
"PrefetchJob");
648 context->scene->ed->runtime->prefetch_job = pfjob;
655 pfjob->
scene = context->scene;
659 pfjob->
bmain = context->bmain;
688 Scene *scene = context->scene;
690 bool has_strips = bool(
ed->current_strips()->first());
692 if (!context->is_prefetch_render) {
693 bool playing = context->is_playing;
694 bool scrubbing = context->is_scrubbing;
714 bool playing = screen->
animtimer !=
nullptr;
723 if (running && !playing && !suspended && showing_cache) {
Read Blender memory allocation and freeing.
GPUSecondaryContextData GPU_create_secondary_context()
void GPU_destroy_secondary_context(GPUSecondaryContextData &data)
T max(const T &a, const T &b)
static void seq_prefetch_update_active_seqbase(PrefetchJob *pfjob)
void prefetch_stop(Scene *scene)
static bool seq_prefetch_must_skip_frame(PrefetchJob *pfjob)
static PrefetchJob * seq_prefetch_job_get(Scene *scene)
ImBuf * render_give_ibuf(const RenderData *context, float timeline_frame, int chanshown)
bool seq_prefetch_job_is_running(Scene *scene)
bool prefetch_need_redraw(const bContext *C, Scene *scene)
static Strip * original_strip_get(const Strip *strip, ListBaseT< Strip > *seqbase)
ListBaseT< Strip > * active_seqbase_get(const Editing *ed)
static void seq_prefetch_update_depsgraph(PrefetchJob *pfjob)
float give_frame_index(const Scene *scene, const Strip *strip, float timeline_frame)
Editing * editing_get(const Scene *scene)
void seq_prefetch_free(Scene *scene)
static PrefetchJob * seq_prefetch_start_ex(const RenderData *context, float cfra)
static bool seqbase_renders_scene_strip(const Scene *scene, ListBaseT< SeqTimelineChannel > *channels, ListBaseT< Strip > *seqbase, int frame, SeqRenderState state)
static bool strip_renders_scene_strip(const Scene *scene, ListBaseT< SeqTimelineChannel > *channels, ListBaseT< Strip > *seqbase, Strip *strip, int frame, SeqRenderState state)
static void seq_prefetch_resume(Scene *scene)
static RenderData * get_original_context(const RenderData *context)
static int seq_prefetch_cfra(PrefetchJob *pfjob)
void seq_prefetch_start(const RenderData *context, float timeline_frame)
MetaStack * meta_stack_active_get(const Editing *ed)
static bool seq_prefetch_need_suspend(PrefetchJob *pfjob)
Vector< Strip * > query_rendered_strips_sorted(const Scene *scene, ListBaseT< SeqTimelineChannel > *channels, ListBaseT< Strip > *seqbase, const int timeline_frame, const int chanshown)
void render_new_render_data(Main *bmain, Depsgraph *depsgraph, Scene *scene, int rectx, int recty, eSpaceSeq_Proxy_RenderSize preview_render_size, Render *render, RenderData *r_context)
static void seq_prefetch_update_area(PrefetchJob *pfjob)
static AnimationEvalContext seq_prefetch_anim_eval_context(PrefetchJob *pfjob)
static bool seq_prefetch_job_is_waiting(Scene *scene)
Scene * prefetch_get_original_scene_and_strip(const RenderData *context, const Strip *&strip)
static void * seq_prefetch_frames(void *job)
static void seq_prefetch_do_suspend(PrefetchJob *pfjob)
bool evict_caches_if_full(Scene *scene)
static void seq_prefetch_update_context(const RenderData *context)
static constexpr int before_playhead_frames
static void seq_prefetch_update_scene(Scene *scene)
ListBaseT< SeqTimelineChannel > * channels_displayed_get(const Editing *ed)
static void seq_prefetch_job_scrubbing_set(Scene *scene, bool is_scrubbing)
Scene * prefetch_get_original_scene(const RenderData *context)
void seq_prefetch_get_time_range(Scene *scene, int *r_start, int *r_end)
static bool seq_prefetch_is_cache_full(Scene *scene)
void BLI_condition_init(ThreadCondition *cond)
void DEG_graph_free(Depsgraph *graph)
void BLI_mutex_unlock(ThreadMutex *mutex)
void BLI_threadpool_insert(ListBaseT< ThreadSlot > *threadbase, void *callerdata)
Depsgraph * DEG_graph_new(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluationMode mode)
void BLI_threadpool_end(ListBaseT< ThreadSlot > *threadbase)
void BLI_condition_wait(ThreadCondition *cond, ThreadMutex *mutex)
void DEG_ids_clear_recalc(Depsgraph *depsgraph, bool backup)
SpaceSeq * CTX_wm_space_seq(const bContext *C)
AnimationEvalContext BKE_animsys_eval_context_construct(Depsgraph *depsgraph, float eval_time) ATTR_WARN_UNUSED_RESULT
void BLI_condition_end(ThreadCondition *cond)
ScenePlaybackRange BKE_scene_get_playback_range(const Scene *scene)
void DEG_graph_build_for_render_pipeline(Depsgraph *graph)
AnimData * BKE_animdata_from_id(const ID *id)
void BLI_condition_notify_one(ThreadCondition *cond)
void BLI_mutex_lock(ThreadMutex *mutex)
void IMB_freeImBuf(ImBuf *ibuf)
void DEG_debug_name_set(Depsgraph *depsgraph, const char *name)
void BLI_threadpool_remove(ListBaseT< ThreadSlot > *threadbase, void *callerdata)
void BLI_mutex_end(ThreadMutex *mutex)
void BKE_main_free(Main *bmain)
void BKE_animsys_evaluate_animdata(ID *id, AnimData *adt, const AnimationEvalContext *anim_eval_context, eAnimData_Recalc recalc, bool flush_to_original)
pthread_cond_t ThreadCondition
pthread_mutex_t ThreadMutex
void DEG_evaluate_on_framechange(Depsgraph *graph, float frame, DepsgraphEvaluateSyncWriteback sync_writeback=DEG_EVALUATE_SYNC_WRITEBACK_NO)
@ SEQ_CACHE_PREFETCH_ENABLE
bScreen * CTX_wm_screen(const bContext *C)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
ViewLayer * BKE_view_layer_default_render(const Scene *scene)
void BLI_mutex_init(ThreadMutex *mutex)
void BLI_threadpool_init(ListBaseT< ThreadSlot > *threadbase, void *(*do_thread)(void *), int tot)
Strip * current_meta_strip
seq::EditingRuntime * runtime
eEditingCacheFlag cache_flag
eSpaceSeq_SequencerCacheOverlay_Flag flag
struct SequencerCacheOverlay cache_overlay
struct Strip * mask_strip
struct wmTimer * animtimer
GHOST_IContext * ghost_context
PrefetchJob * prefetch_job
ThreadMutex prefetch_suspend_mutex
int num_frames_prefetched
ListBaseT< ThreadSlot > threads
ThreadCondition prefetch_suspend_cond
gpu::GPUSecondaryContextData gpu_context