Blender V5.0
compositor/intern/context.cc
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#include "BLI_bounds.hh"
6#include "BLI_math_vector.hh"
7
8#include "DNA_node_types.h"
9
10#include "GPU_shader.hh"
11
12#include "BKE_node_runtime.hh"
13
14#include "COM_context.hh"
15#include "COM_profiler.hh"
16#include "COM_render_context.hh"
18
19namespace blender::compositor {
20
21Result Context::get_pass(const Scene * /*scene*/, int /*view_layer*/, const char * /*name*/)
22{
24}
25
27{
28 return this->get_scene().r;
29}
30
32{
33 return "";
34}
35
40
41void Context::set_info_message(StringRef /*message*/) const {}
42
44{
45 return false;
46}
47
49 int /*view_layer_id*/,
50 const char * /*pass_name*/,
51 MetaData & /*meta_data*/) const
52{
53}
54
56{
57 return nullptr;
58}
59
61{
62 return nullptr;
63}
64
66
68{
69 if (!this->get_node_tree().runtime->test_break) {
70 return false;
71 }
72 return this->get_node_tree().runtime->test_break(get_node_tree().runtime->tbh);
73}
74
76{
77 cache_manager_.reset();
78}
79
84
86{
87 return !this->get_compositing_region().is_empty();
88}
89
91{
92 return get_render_data().size / 100.0f;
93}
94
96{
97 return get_render_data().cfra;
98}
99
100float Context::get_time() const
101{
102 const float frame_number = float(get_frame_number());
103 const float frame_rate = float(get_render_data().frs_sec) /
104 float(get_render_data().frs_sec_base);
105 return frame_number / frame_rate;
106}
107
118
119gpu::Shader *Context::get_shader(const char *info_name, ResultPrecision precision)
120{
121 return cache_manager().cached_shaders.get(info_name, precision);
122}
123
124gpu::Shader *Context::get_shader(const char *info_name)
125{
126 return get_shader(info_name, get_precision());
127}
128
130{
131 return Result(*this, type, precision);
132}
133
138
140{
141 return cache_manager_;
142}
143
144} // namespace blender::compositor
eCompositorDenoiseQaulity
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
gpu::Shader * get(const char *info_name, ResultPrecision precision)
virtual const Scene & get_scene() const =0
virtual Profiler * profiler() const
Result create_result(ResultType type, ResultPrecision precision)
eCompositorDenoiseQaulity get_denoise_quality() const
virtual void populate_meta_data_for_pass(const Scene *scene, int view_layer_id, const char *pass_name, MetaData &meta_data) const
virtual void set_info_message(StringRef message) const
virtual bool treat_viewer_as_compositor_output() const
virtual StringRef get_view_name() const
virtual Result get_pass(const Scene *scene, int view_layer, const char *name)
virtual const RenderData & get_render_data() const
virtual Bounds< int2 > get_compositing_region() const =0
gpu::Shader * get_shader(const char *info_name, ResultPrecision precision)
virtual ResultPrecision get_precision() const
virtual RenderContext * render_context() const
virtual const bNodeTree & get_node_tree() const =0
nullptr float
T max(const T &a, const T &b)
VecBase< int32_t, 2 > int2
int compositor_denoise_preview_quality
int compositor_denoise_final_quality
struct RenderData r
bNodeTreeRuntimeHandle * runtime