83 return ((a->preview_render_size !=
b->preview_render_size) || (a->rectx !=
b->rectx) ||
84 (a->recty !=
b->recty) || (a->bmain !=
b->bmain) || (a->scene !=
b->scene) ||
85 (a->motion_blur_shutter !=
b->motion_blur_shutter) ||
86 (a->motion_blur_samples !=
b->motion_blur_samples) ||
87 (a->scene->r.views_format !=
b->scene->r.views_format) || (a->view_id !=
b->view_id));
92 uint rval = a->rectx + a->recty;
94 rval ^= a->preview_render_size;
97 rval ^=
int(a->motion_blur_shutter * 100.0f) << 10;
98 rval ^= a->motion_blur_samples << 16;
99 rval ^= ((a->scene->r.views_format * 2) + a->view_id) << 24;
121 return ((a->seq !=
b->seq) || (a->frame_index !=
b->frame_index) || (a->type !=
b->type) ||
127 const float timeline_frame,
148 if (scene && scene->ed && scene->ed->cache) {
149 return scene->ed->cache;
175 return size_t(
U.memcachelimit) * 1024 * 1024;
202 flag = scene->ed->cache_flag;
222 if (stored_types_flag & key->
type) {
252 if (item && item->
ibuf) {
290 int pfjob_start, pfjob_end;
318 if (l_diff > r_diff) {
351 if (prev !=
nullptr && prev->link_next != base) {
370 if (
next !=
nullptr &&
next->link_prev != base) {
469 if (!cache || !base) {
492 if (scene->ed->cache ==
nullptr) {
498 cache->
bmain = bmain;
500 scene->ed->cache = cache;
502 if (scene->ed->disk_cache_timestamp == 0) {
503 scene->ed->disk_cache_timestamp =
time(
nullptr);
512 const float timeline_frame,
519 context->scene, seq, timeline_frame, type);
525 key->
task_id = context->task_id;
531 const float timeline_frame,
560 scene, key->
seq, timeline_frame, key->
type);
593 scene->ed->cache =
nullptr;
625 int invalidate_types,
626 bool force_seq_changed_range)
644 int range_start = range_start_seq_changed;
645 int range_end = range_end_seq_changed;
647 if (!force_seq_changed_range) {
653 range_start =
max_ii(range_start, range_start_seq);
654 range_end =
min_ii(range_end, range_end_seq);
669 if (key->
type & invalidate_composite && key->
frame_index >= range_start &&
675 else if (key->
type & invalidate_source && key->
seq == seq &&
690 if (context->skip_cache || context->is_proxy_render || context->for_render || !seq) {
694 Scene *scene = context->scene;
696 if (context->is_prefetch_render) {
698 scene = context->scene;
706 if (!scene->ed->cache) {
712 ImBuf *ibuf =
nullptr;
734 if (ibuf ==
nullptr) {
751 Scene *scene = context->scene;
753 if (context->is_prefetch_render) {
755 scene = context->scene;
768 if (scene->ed->cache) {
770 scene->ed->cache->last_key =
nullptr;
779 if (i ==
nullptr || context->skip_cache || context->is_proxy_render || context->for_render ||
785 Scene *scene = context->scene;
787 if (context->is_prefetch_render) {
789 scene = context->scene;
801 if (!scene->ed->cache) {
826 bool callback_init(
void *userdata,
size_t item_count),
827 bool callback_iter(
void *userdata,
Sequence *seq,
int timeline_frame,
int cache_type))
861 interrupt = callback_iter(userdata, key->
seq, timeline_frame, key->
type);
Some types for dealing with directories.
BLI_INLINE void * BLI_ghashIterator_getKey(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
bool BLI_ghash_haskey(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void BLI_ghashIterator_step(GHashIterator *ghi)
BLI_INLINE void * BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
GHash * BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
unsigned int BLI_ghash_len(const GHash *gh) ATTR_WARN_UNUSED_RESULT
bool BLI_ghash_remove(GHash *gh, const void *key, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
void BLI_ghashIterator_init(GHashIterator *ghi, GHash *gh)
BLI_INLINE bool BLI_ghashIterator_done(const GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT
MINLINE int min_ii(int a, int b)
MINLINE int max_ii(int a, int b)
void * BLI_mempool_alloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
void BLI_mempool_free(BLI_mempool *pool, void *addr) ATTR_NONNULL(1
BLI_mempool * BLI_mempool_create(unsigned int esize, unsigned int elem_num, unsigned int pchunk, unsigned int flag) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1)
void BLI_mutex_end(ThreadMutex *mutex)
void BLI_mutex_init(ThreadMutex *mutex)
#define BLI_MUTEX_INITIALIZER
void BLI_mutex_lock(ThreadMutex *mutex)
void BLI_mutex_unlock(ThreadMutex *mutex)
pthread_mutex_t ThreadMutex
@ SEQ_CACHE_STORE_PREPROCESSED
@ SEQ_CACHE_STORE_FINAL_OUT
@ SEQ_CACHE_STORE_COMPOSITE
@ SEQ_CACHE_PREFETCH_ENABLE
void IMB_refImBuf(ImBuf *ibuf)
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
local_group_size(16, 16) .push_constant(Type b
ImBuf * seq_disk_cache_read_file(SeqDiskCache *disk_cache, SeqCacheKey *key)
void seq_disk_cache_invalidate(SeqDiskCache *disk_cache, Scene *scene, Sequence *seq, Sequence *seq_changed, int invalidate_types)
SeqDiskCache * seq_disk_cache_create(Main *bmain, Scene *scene)
void seq_disk_cache_free(SeqDiskCache *disk_cache)
bool seq_disk_cache_enforce_limits(SeqDiskCache *disk_cache)
bool seq_disk_cache_write_file(SeqDiskCache *disk_cache, SeqCacheKey *key, ImBuf *ibuf)
bool seq_disk_cache_is_enabled(Main *bmain)
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void IMB_freeImBuf(ImBuf *)
static float seq_cache_timeline_frame_to_frame_index(const Scene *scene, const Sequence *seq, const float timeline_frame, const int type)
void SEQ_cache_iterate(Scene *scene, void *userdata, bool callback_init(void *userdata, size_t item_count), bool callback_iter(void *userdata, Sequence *seq, int timeline_frame, int cache_type))
static ImBuf * seq_cache_get_ex(SeqCache *cache, SeqCacheKey *key)
static void seq_cache_recycle_linked(Scene *scene, SeqCacheKey *base)
void SEQ_cache_cleanup(Scene *scene)
static SeqCacheKey * seq_cache_allocate_key(SeqCache *cache, const SeqRenderData *context, Sequence *seq, const float timeline_frame, const int type)
static void seq_cache_create(Main *bmain, Scene *scene)
static void seq_cache_unlock(Scene *scene)
ImBuf * seq_cache_get(const SeqRenderData *context, Sequence *seq, float timeline_frame, int type)
bool seq_cache_put_if_possible(const SeqRenderData *context, Sequence *seq, float timeline_frame, int type, ImBuf *ibuf)
static int get_stored_types_flag(Scene *scene, SeqCacheKey *key)
static SeqCacheKey * seq_cache_choose_key(Scene *scene, SeqCacheKey *lkey, SeqCacheKey *rkey)
static void seq_cache_set_temp_cache_linked(Scene *scene, SeqCacheKey *base)
static void seq_cache_valfree(void *val)
static uint seq_hash_render_data(const SeqRenderData *a)
static uint seq_cache_hashhash(const void *key_)
void seq_cache_put(const SeqRenderData *context, Sequence *seq, float timeline_frame, int type, ImBuf *i)
void seq_cache_free_temp_cache(Scene *scene, short id, int timeline_frame)
static void seq_cache_key_unlink(SeqCacheKey *key)
static ThreadMutex cache_create_lock
static bool seq_cmp_render_data(const SeqRenderData *a, const SeqRenderData *b)
static void seq_cache_keyfree(void *val)
static size_t seq_cache_get_mem_total()
static void seq_cache_put_ex(Scene *scene, SeqCacheKey *key, ImBuf *ibuf)
void seq_cache_cleanup_sequence(Scene *scene, Sequence *seq, Sequence *seq_changed, int invalidate_types, bool force_seq_changed_range)
float seq_cache_frame_index_to_timeline_frame(Sequence *seq, float frame_index)
static SeqCache * seq_cache_get_from_scene(Scene *scene)
static bool seq_cache_hashcmp(const void *a_, const void *b_)
static void seq_cache_lock(Scene *scene)
void seq_cache_destruct(Scene *scene)
static void seq_cache_populate_key(SeqCacheKey *key, const SeqRenderData *context, Sequence *seq, const float timeline_frame, const int type)
static SeqCacheKey * seq_cache_get_item_for_removal(Scene *scene)
bool seq_cache_recycle_item(Scene *scene)
size_t(* MEM_get_memory_in_use)(void)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void seq_prefetch_get_time_range(Scene *scene, int *r_start, int *r_end)
bool seq_prefetch_job_is_running(Scene *scene)
void SEQ_prefetch_stop(Scene *scene)
Sequence * seq_prefetch_get_original_sequence(Sequence *seq, Scene *scene)
SeqRenderData * seq_prefetch_get_original_context(const SeqRenderData *context)
float SEQ_give_frame_index(const Scene *scene, const Sequence *seq, float timeline_frame)
int SEQ_time_left_handle_frame_get(const Scene *, const Sequence *seq)
float SEQ_time_start_frame_get(const Sequence *seq)
int SEQ_time_right_handle_frame_get(const Scene *scene, const Sequence *seq)
ThreadMutex iterator_mutex
SeqDiskCache * disk_cache