31using namespace nodes::derived_node_tree_types;
37 if (!input->is_logically_linked()) {
43 input.foreach_origin_socket([&](
const DSocket origin) { socket = origin; });
55 if (origin->is_input()) {
65 switch (socket->
type) {
80 bool condition_satisfied =
false;
81 output.foreach_target_socket(
83 if (condition(target.node())) {
84 condition_satisfied =
true;
88 return condition_satisfied;
95 output.foreach_target_socket(
97 if (condition(target)) {
106 return node->typeinfo->get_compositor_shader_node;
111 using namespace nodes;
114 const NodeDeclaration *node_declaration = socket->owner_node().declaration();
117 if (!node_declaration) {
118 return input_descriptor;
126 CompositorInputRealizationOptions::RealizeOnOperationDomain);
128 return input_descriptor;
152 if (node.context()->instance_key().value !=
153 node.context()->derived_tree().active_context().instance_key().value)
168 if (
output->is_logically_linked()) {
181 const int greater_dimension_size = 128;
183 return int2(greater_dimension_size,
int(greater_dimension_size * (
float(
size.y) /
size.x)));
186 return int2(
int(greater_dimension_size * (
float(
size.x) /
size.y)), greater_dimension_size);
194 &node.context()->derived_tree().root_context().btree());
200 node->runtime->preview_xsize = preview_size.x;
201 node->runtime->preview_ysize = preview_size.y;
204 root_tree->
previews, node.instance_key(), preview_size.x, preview_size.y,
true);
206 GPUShader *shader = context.get_shader(
"compositor_compute_preview");
226 float *preview_pixels =
static_cast<float *
>(
231 &context.get_scene().view_settings, &context.get_scene().display_settings);
234 for (const int64_t y : sub_y_range) {
235 for (const int64_t x : IndexRange(preview_size.x)) {
236 const int index = (y * preview_size.x + x) * 4;
237 IMB_colormanagement_processor_apply_v4(color_processor, preview_pixels + index);
238 rgba_float_to_uchar(preview->ibuf->byte_buffer.data + index, preview_pixels + index);
255 for (const int64_t y : sub_y_range) {
256 for (const int64_t x : IndexRange(range.x)) {
257 function(int2(x, y));
#define BLI_assert_unreachable()
void GPU_compute_dispatch(GPUShader *shader, uint groups_x_len, uint groups_y_len, uint groups_z_len)
void GPU_shader_bind(GPUShader *shader)
void GPU_memory_barrier(eGPUBarrier barrier)
@ GPU_BARRIER_TEXTURE_FETCH
void * GPU_texture_read(GPUTexture *texture, eGPUDataFormat data_format, int mip_level)
void GPU_texture_swizzle_set(GPUTexture *texture, const char swizzle[4])
ColormanageProcessor * IMB_colormanagement_display_processor_new(const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings)
void IMB_colormanagement_processor_free(ColormanageProcessor *cm_processor)
struct GPUShader GPUShader
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Vector< SocketDeclaration * > inputs
int compositor_domain_priority() const
const CompositorInputRealizationOptions & compositor_realization_options() const
bool compositor_expects_single_value() const
void bind_as_image(GPUShader *shader, const char *image_name, bool read=false) const
void unbind_as_texture() const
const Domain & domain() const
void unbind_as_image() const
void allocate_texture(Domain domain, bool from_pool=true)
static ResultType type(eGPUTextureFormat format)
void bind_as_texture(GPUShader *shader, const char *texture_name) const
void MEM_freeN(void *vmemh)
bNodePreview * node_preview_verify(bNodeInstanceHash *previews, bNodeInstanceKey key, int xsize, int ysize, bool create)
bNodeInstanceHash * node_instance_hash_new(const char *info)
VecBase< T, Size > divide_ceil(const VecBase< T, Size > &a, const VecBase< T, Size > &b)
bool is_pixel_node(DNode node)
bool is_node_preview_needed(const DNode &node)
static int2 compute_preview_size(int2 size)
bool is_output_linked_to_node_conditioned(DOutputSocket output, FunctionRef< bool(DNode)> condition)
void compute_preview_from_result(Context &context, const DNode &node, Result &input_result)
DOutputSocket get_output_linked_to_input(DInputSocket input)
int number_of_inputs_linked_to_output_conditioned(DOutputSocket output, FunctionRef< bool(DInputSocket)> condition)
void parallel_for(const int2 range, FunctionRef< void(int2)> function)
DOutputSocket find_preview_output_socket(const DNode &node)
ResultType get_node_socket_result_type(const bNodeSocket *socket)
InputDescriptor input_descriptor_from_input_socket(const bNodeSocket *socket)
DOutputSocket::TargetSocketPathInfo TargetSocketPathInfo
void compute_dispatch_threads_at_least(GPUShader *shader, int2 threads_range, int2 local_size=int2(16))
DSocket get_input_origin_socket(DInputSocket input)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
VecBase< int32_t, 2 > int2
NodeInstanceHashHandle * previews