Blender V5.3
COM_static_cache_manager.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include "COM_bokeh_kernel.hh"
8#include "COM_cached_image.hh"
9#include "COM_cached_mask.hh"
10#include "COM_cached_shader.hh"
15#include "COM_keying_screen.hh"
19#include "COM_string_image.hh"
23
24namespace blender::compositor {
25
26/* -------------------------------------------------------------------------------------------------
27 * Static Cache Manager
28 *
29 * A static cache manager is a collection of cached resources that can be retrieved when needed and
30 * created if not already available. In particular, each cached resource type has its own instance
31 * of a container derived from the CachedResourceContainer type in the class. All instances of that
32 * cached resource type are stored and tracked in the container. See the CachedResource and
33 * CachedResourceContainer classes for more information.
34 *
35 * The manager deletes the cached resources that are no longer needed. A cached resource is said to
36 * be not needed when it was not used in the previous evaluation. This is done through the
37 * following mechanism:
38 *
39 * - After every evaluation, do the following:
40 * 1. All resources whose CachedResource::needed flag is false are deleted.
41 * 2. The CachedResource::needed flag of all remaining resources is set to false.
42 * - During evaluation, when retrieving any cached resource, set its CachedResource::needed flag to
43 * true.
44 *
45 * In effect, any resource that was not used in the previous evaluation will be deleted. This
46 * mechanism is implemented in the reset() method of the class, which should be called after every
47 * evaluation. */
49 public:
67
68 public:
69 /* Reset the cache manager by deleting the cached resources that are no longer needed because
70 * they weren't used in the last evaluation and prepare the remaining cached resources to track
71 * their needed status in the next evaluation. See the class description for more information.
72 * This should be called before every evaluation. */
73 void reset();
74
75 /* Force free all resources even if they are still needed. This is useful to manually destroy the
76 * static cache manager, for instance, with a GPU context bound. */
77 void free();
78};
79
80} // namespace blender::compositor
SMAAPrecomputedTexturesContainer smaa_precomputed_textures
OCIOColorSpaceConversionShaderContainer ocio_color_space_conversion_shaders
MorphologicalDistanceFeatherWeightsContainer morphological_distance_feather_weights
SymmetricSeparableBlurWeightsContainer symmetric_separable_blur_weights
OCIOToDisplayShaderContainer ocio_to_display_shaders
VanVlietGaussianCoefficientsContainer van_vliet_gaussian_coefficients
SymmetricBlurWeightsContainer symmetric_blur_weights
DericheGaussianCoefficientsContainer deriche_gaussian_coefficients