Blender
V5.3
source
blender
sequencer
intern
cache
compositor_cache.cc
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2026 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9
#include "
BLI_threads.hh
"
10
#include "
COM_result.hh
"
11
#include "
DRW_engine.hh
"
12
13
#include "
compositor_cache.hh
"
14
15
namespace
blender::seq
{
16
17
CompositorCache::~CompositorCache
()
18
{
19
bool
use_main_context =
false
;
20
if
(this->last_evaluation_used_gpu) {
21
/* Free resources with GPU context enabled. Cleanup may happen from the main thread, and we
22
* must use the main context there. */
23
BLI_assert
(
BLI_thread_is_main
() || this->secondary_gpu_context.ghost_context !=
nullptr
);
24
use_main_context =
BLI_thread_is_main
();
25
if
(use_main_context) {
26
DRW_gpu_context_enable
();
27
}
28
else
{
29
gpu::GPU_activate_secondary_context
(this->secondary_gpu_context);
30
}
31
}
32
33
this->cache_manager.free();
34
35
/* See comment above on context enabling. */
36
if
(this->last_evaluation_used_gpu) {
37
if
(use_main_context) {
38
DRW_gpu_context_disable
();
39
}
40
else
{
41
gpu::GPU_deactivate_secondary_context
(this->secondary_gpu_context);
42
}
43
}
44
}
45
46
void
CompositorCache::recreate_if_needed
(
bool
gpu
,
47
compositor::ResultPrecision
precision,
48
const
gpu::GPUSecondaryContextData
&gpu_context)
49
{
50
this->secondary_gpu_context =
gpu
? gpu_context :
gpu::GPUSecondaryContextData
();
51
52
if
(this->last_evaluation_used_gpu ==
gpu
&& this->last_evaluation_precision == precision) {
53
return
;
54
}
55
this->cache_manager.free();
56
this->last_evaluation_used_gpu =
gpu
;
57
this->last_evaluation_precision = precision;
58
}
59
60
}
// namespace blender::seq
BLI_threads.hh
COM_result.hh
DRW_engine.hh
blender::seq::CompositorCache::recreate_if_needed
void recreate_if_needed(bool gpu, compositor::ResultPrecision precision, const gpu::GPUSecondaryContextData &gpu_context)
Definition
compositor_cache.cc:46
blender::seq::CompositorCache::~CompositorCache
~CompositorCache()
Definition
compositor_cache.cc:17
compositor_cache.hh
blender::compositor::ResultPrecision
ResultPrecision
Definition
COM_result.hh:81
blender::gpu
Definition
blf_internal_types.hh:35
blender::gpu::GPU_activate_secondary_context
void GPU_activate_secondary_context(const GPUSecondaryContextData &data)
Definition
gpu_context.cc:728
blender::gpu::GPU_deactivate_secondary_context
void GPU_deactivate_secondary_context(const GPUSecondaryContextData &data)
Definition
gpu_context.cc:734
blender::seq
Definition
sequencer_intern.hh:58
blender::DRW_gpu_context_enable
void DRW_gpu_context_enable()
Definition
draw_gpu_context.cc:230
blender::BLI_assert
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
blender::DRW_gpu_context_disable
void DRW_gpu_context_disable()
Definition
draw_gpu_context.cc:254
blender::BLI_thread_is_main
int BLI_thread_is_main()
Definition
threads.cc:184
blender::gpu::GPUSecondaryContextData
Definition
GPU_context.hh:161
Generated on
for Blender by
doxygen
1.18.0