Commit: e21f04070ec2fa1fa9364c20df15b508a29f1497
Author: Omar Emara
Date:   Thu May 5 12:29:46 2022 +0200
Branches: temp-viewport-compositor-merge
https://developer.blender.org/rBe21f04070ec2fa1fa9364c20df15b508a29f1497

Viewport Compositor: Rebase on master

===================================================================

M       release/scripts/startup/bl_ui/space_view3d.py
M       source/blender/CMakeLists.txt
M       source/blender/blenkernel/BKE_colortools.h
M       source/blender/blenkernel/BKE_node.h
M       source/blender/blenkernel/intern/colortools.c
M       source/blender/blenkernel/intern/image_gpu.cc
A       source/blender/blenlib/BLI_transformation_2d.hh
M       source/blender/blenlib/CMakeLists.txt
M       source/blender/draw/CMakeLists.txt
A       source/blender/draw/engines/compositor/compositor_engine.cc
A       source/blender/draw/engines/compositor/compositor_engine.h
M       source/blender/draw/intern/draw_manager.c
M       source/blender/editors/render/render_update.cc
M       source/blender/editors/space_view3d/space_view3d.c
M       source/blender/gpu/CMakeLists.txt
M       source/blender/gpu/GPU_material.h
M       source/blender/gpu/GPU_shader.h
M       source/blender/gpu/intern/gpu_codegen.cc
M       source/blender/gpu/intern/gpu_material.c
M       source/blender/gpu/intern/gpu_material_library.h
M       source/blender/gpu/intern/gpu_node_graph.c
M       source/blender/gpu/intern/gpu_node_graph.h
M       source/blender/gpu/intern/gpu_shader.cc
M       source/blender/gpu/intern/gpu_shader_create_info.cc
M       source/blender/gpu/intern/gpu_shader_create_info.hh
M       source/blender/gpu/intern/gpu_shader_dependency.cc
R100    source/blender/gpu/shaders/material/gpu_shader_material_color_ramp.glsl 
source/blender/gpu/shaders/common/gpu_shader_common_color_ramp.glsl
A       source/blender/gpu/shaders/common/gpu_shader_common_color_utilities.glsl
A       source/blender/gpu/shaders/common/gpu_shader_common_curves.glsl
R093    source/blender/gpu/shaders/material/gpu_shader_material_hash.glsl       
source/blender/gpu/shaders/common/gpu_shader_common_hash.glsl
R098    source/blender/gpu/shaders/material/gpu_shader_material_math.glsl       
source/blender/gpu/shaders/common/gpu_shader_common_math.glsl
R059    source/blender/gpu/shaders/material/gpu_shader_material_math_util.glsl  
source/blender/gpu/shaders/common/gpu_shader_common_math_utilities.glsl
R095    source/blender/gpu/shaders/material/gpu_shader_material_mix_rgb.glsl    
source/blender/gpu/shaders/common/gpu_shader_common_mix_rgb.glsl
A       source/blender/gpu/shaders/compositor/compositor_alpha_crop.glsl
A       source/blender/gpu/shaders/compositor/compositor_blur.glsl
A       source/blender/gpu/shaders/compositor/compositor_convert.glsl
A       source/blender/gpu/shaders/compositor/compositor_filter.glsl
A       source/blender/gpu/shaders/compositor/compositor_flip.glsl
A       source/blender/gpu/shaders/compositor/compositor_image_crop.glsl
A       
source/blender/gpu/shaders/compositor/compositor_projector_lens_distortion.glsl
A       source/blender/gpu/shaders/compositor/compositor_realize_on_domain.glsl
A       
source/blender/gpu/shaders/compositor/compositor_screen_lens_distortion.glsl
A       source/blender/gpu/shaders/compositor/compositor_split_viewer.glsl
A       
source/blender/gpu/shaders/compositor/infos/compositor_alpha_crop_info.hh
A       source/blender/gpu/shaders/compositor/infos/compositor_blur_info.hh
A       source/blender/gpu/shaders/compositor/infos/compositor_convert_info.hh
A       source/blender/gpu/shaders/compositor/infos/compositor_filter_info.hh
A       source/blender/gpu/shaders/compositor/infos/compositor_flip_info.hh
A       
source/blender/gpu/shaders/compositor/infos/compositor_image_crop_info.hh
A       
source/blender/gpu/shaders/compositor/infos/compositor_projector_lens_distortion_info.hh
A       
source/blender/gpu/shaders/compositor/infos/compositor_realize_on_domain_info.hh
A       
source/blender/gpu/shaders/compositor/infos/compositor_screen_lens_distortion_info.hh
A       
source/blender/gpu/shaders/compositor/infos/compositor_split_viewer_info.hh
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_alpha_over.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_bright_contrast.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_channel_matte.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_chroma_matte.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_balance.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_correction.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_matte.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_spill.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_color_to_luminance.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_difference_matte.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_distance_matte.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_exposure.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_gamma.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_hue_correct.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_hue_saturation_value.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_invert.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_load_input.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_luminance_matte.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_map_value.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_normal.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_posterize.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_separate_combine.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_set_alpha.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_store_output.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_texture_utilities.glsl
A       
source/blender/gpu/shaders/compositor/library/gpu_shader_compositor_type_conversion.glsl
D       source/blender/gpu/shaders/material/gpu_shader_material_color_util.glsl
M       
source/blender/gpu/shaders/material/gpu_shader_material_combine_color.glsl
M       source/blender/gpu/shaders/material/gpu_shader_material_combine_hsv.glsl
D       source/blender/gpu/shaders/material/gpu_shader_material_float_curve.glsl
M       
source/blender/gpu/shaders/material/gpu_shader_material_fractal_noise.glsl
M       source/blender/gpu/shaders/material/gpu_shader_material_gamma.glsl
M       source/blender/gpu/shaders/material/gpu_shader_material_hair_info.glsl
M       source/blender/gpu/shaders/material/gpu_shader_material_hue_sat_val.glsl
M       source/blender/gpu/shaders/material/gpu_shader_material_map_range.glsl
M       source/blender/gpu/shaders/material/gpu_shader_material_mapping.glsl
M       source/blender/gpu/shaders/material/gpu_shader_material_noise.glsl
M       source/blender/gpu/shaders/material/gpu_shader_material_point_info.glsl
M       
source/blender/gpu/shaders/material/gpu_shader_material_separate_color.glsl
M       
source/blender/gpu/shaders/material/gpu_shader_material_separate_hsv.glsl
M       source/blender/gpu/shaders/material/gpu_shader_material_tex_brick.glsl
M       
source/blender/gpu/shaders/material/gpu_shader_material_tex_environment.glsl
M       
source/blender/gpu/shaders/material/gpu_shader_material_tex_musgrave.glsl
M       source/blender/gpu/shaders/material/gpu_shader_material_tex_noise.glsl
M       source/blender/gpu/shaders/material/gpu_shader_material_tex_voronoi.glsl
M       source/blender/gpu/shaders/material/gpu_shader_material_tex_wave.glsl
M       
source/blender/gpu/shaders/material/gpu_shader_material_tex_white_noise.glsl
M       source/blender/gpu/shaders/material/gpu_shader_material_vector_math.glsl
M       
source/blender/gpu/shaders/material/gpu_shader_material_vector_rotate.glsl
M       source/blender/imbuf/IMB_colormanagement.h
M       source/blender/imbuf/intern/colormanagement_inline.c
M       source/blender/makesdna/DNA_view3d_types.h
M       source/blender/makesrna/intern/rna_space.c
M       source/blender/nodes/NOD_node_declaration.hh
M       source/blender/nodes/composite/CMakeLists.txt
M       source/blender/nodes/composite/nodes/node_composite_alpha_over.cc
M       source/blender/nodes/composite/nodes/node_composite_antialiasing.cc
M       source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc
M       source/blender/nodes/composite/nodes/node_composite_blur.cc
M       source/blender/nodes/composite/nodes/node_composite_bokehblur.cc
M       source/blender/nodes/composite/nodes/node_composite_bokehimage.cc
M       source/blender/nodes/composite/nodes/node_composite_boxmask.cc
M       source/blender/nodes/composite/nodes/node_composite_brightness.cc
M       source/blender/nodes/composite/nodes/node_composite_channel_matte.cc
M       source/blender/nodes/composite/nodes/node_composite_chroma_matte.cc
M       source/blender/nodes/composite/nodes/node_composite_color_matte.cc
M       source/blender/nodes/composite/nodes/node_composite_color_spill.cc
M       source/blender/nodes/composite/nodes/node_composite_colorbalance.cc
M       source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc
M       source/blender/nodes/composite/nodes/node_composite_composite.cc
M       
source/blender/nodes/composite/nodes/node_composite_convert_color_space.cc
M       source/blender/nodes/composite/nodes/node_composite_cornerpin.cc
M       source/blender/nodes/composite/nodes/node_composite_crop.cc
M       source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc
M       source/blender/nodes/composite/nodes/node_composite_curves.cc
M       source/blender/nodes/composite/nodes/node_composite_defocus.cc
M       source/blender/nodes/composite/nodes/node_composite_denoise.cc
M       source/blender/nodes/composite/nodes/node_composite_despeckle.cc
M       source/blender/nodes/composite/nodes/node_composite_diff_matte.cc
M       source/blender/nodes/composite/nodes/node_composite_dilate.cc
M       source/blender/nodes/composite/nodes/node_composite_directionalblur.cc
M       source/blender/nodes/composite/nodes/node_composite_displace.cc
M       source/blender/nodes/composite/nodes/node_composite_distance_matte.cc
M       source/blender/nodes/composite/nodes/node_composite_double_edge_mask.cc
M       source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc
M       source/blender/nodes/composite/nodes/node_composite_exposure.cc
M       source/blender/nodes/composite/nodes/node_composite_filter.cc
M       source/blender/nodes/composite/nodes/node_composite_flip.cc
M       source/blender/nodes/composite/nodes/node_composite_gamma.cc
M       source/blender/nodes/composite/nodes/node_composite_glare.cc
M       source/blender/nodes/composite/nodes/node_composite_hue_sat_val.cc
M       source/blender/nodes/composite/nodes/node_composite_huecorrect.cc
M       source/blender/nodes/composite/nodes/node_composite_id_mask.cc
M       source/blender/nodes/composite/nodes/node_composite_image.cc
M       source/blender/nodes/composite/nodes/node_composite_inpaint.cc
M       source/blender/nodes/composite/nodes/node_composite_invert.cc
M       source/blender/nodes/composite/nodes/node_composite_keying.cc
M       source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc
M       source/blender/nodes/composite/nodes/node_composite_lensdist.cc
M       source/blender/nodes/composite/nodes/node_composite_levels.cc
M       source/blender/nodes/composite/nodes/node_composite_luma_matte.cc
M       source/blender/nodes/composite/nodes/node_composite_map_range.cc
M       source/blender/nodes/composite/nodes/node_composite_map_uv.cc
M       source/blender/nodes/composite/nodes/node_composite_map_value.cc
M       source/blender/nodes/composite/nodes/node_composite_mask.cc
M       source/blender/nodes/composite/nodes/node_composite_math.cc
M       source/blender/nodes/composite/nodes/node_composite_mixrgb.cc
M       source/blender/nodes/composite/nodes/node_composite_movieclip.cc
M       source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc
M       source/blender/nodes/composite/nodes/node_composite_normal.cc
M       source/blender/nodes/composite/nodes/node_composite_normalize.cc
M       source/blender/nodes/composite/nodes/node_composite_output_file.cc
M       source/blender/nodes/composite/nodes/node_composite_pixelate.cc
M       source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc
M       source/blender/nodes/composite/nodes/node_composite_posterize.cc
M       source/blender/nodes/composite/nodes/node_composite_premulkey.cc
M       source/blender/nodes/composite/nodes/node_composite_rgb.cc
M       source/blender/nodes/composite/nodes/node_composite_rotate.cc
M       source/blender/nodes/composite/nodes/node_composite_scale.cc
M       source/blender/nodes/composite/nodes/node_composite_scene_time.cc
M       source/blender/nodes/composite/nodes/node_composite_sepcomb_hsva.cc
M       source/blender/nodes/composite/nodes/node_composite_sepcomb_rgba.cc
M       source/blender/nodes/composite/nodes/node_composite_sepcomb_xyz.cc
M       source/blender/nodes/composite/nodes/node_composite_sepcomb_ycca.cc
M       source/blender/nodes/composite/nodes/node_composite_sepcomb_yuva.cc
M       source/blender/nodes/composite/nodes/node_composite_setalpha.cc
M       source/blender/nodes/composite/nodes/node_composite_split_viewer.cc
M       source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc
M       source/blender/nodes/composite/nodes/node_composite_sunbeams.cc
M       source/blender/nodes/composite/nodes/node_composite_switch.cc
M       source/blender/nodes/composite/nodes/node_composite_switchview.cc
M       source/blender/nodes/composite/nodes/node_composite_texture.cc
M       source/blender/nodes/composite/nodes/node_composite_tonemap.cc
M       source/blender/nodes/composite/nodes/node_composite_trackpos.cc
M       source/blender/nodes/composite/nodes/node_composite_transform.cc
M       source/blender/nodes/composite/nodes/node_composite_translate.cc
M       source/blender/nodes/composite/nodes/node_composite_val_to_rgb.cc
M       source/blender/nodes/composite/nodes/node_composite_value.cc
M       source/blender/nodes/composite/nodes/node_composite_vec_blur.cc
M       source/blender/nodes/composite/nodes/node_composite_viewer.cc
M       source/blender/nodes/composite/nodes/node_composite_zcombine.cc
A       source/blender/viewport_compositor/CMakeLists.txt
A       source/blender/viewport_compositor/VPC_compile_state.hh
A       source/blender/viewport_compositor/VPC_context.hh
A       source/blender/viewport_compositor/VPC_conversion_processor_operation.hh
A       source/blender/viewport_compositor/VPC_domain.hh
A       source/blender/viewport_compositor/VPC_evaluator.hh
A       source/blender/viewport_compositor/VPC_gpu_material_node.hh
A       source/blender/viewport_compositor/VPC_gpu_material_operation.hh
A       source/blender/viewport_compositor/VPC_input_descriptor.hh
A       source/blender/viewport_compositor/VPC_input_single_value_operation.hh
A       source/blender/viewport_compositor/VPC_node_operation.hh
A       source/blender/viewport_compositor/VPC_operation.hh
A       source/blender/viewport_compositor/VPC_processor_operation.hh
A       
source/blender/viewport_compositor/VPC_realize_on_domain_processor_operation.hh
A       
source/blender/viewport_compositor/VPC_reduce_to_single_value_processor_operation.hh
A       source/blender/viewport_compositor/VPC_result.hh
A       source/blender/viewport_compositor/VPC_scheduler.hh
A       source/blender/viewport_compositor/VPC_shader_pool.hh
A       source/blender/viewport_compositor/VPC_texture_pool.hh
A       source/blender/viewport_compositor/VPC_unsupported_node_operation.hh
A       source/blender/viewport_compositor/VPC_utilities.hh
A       source/blender/viewport_compositor/intern/compile_state.cc
A       source/blender/viewport_compositor/intern/context.cc
A       
source/blender/viewport_compositor/intern/conversion_processor_operation.cc
A       source/blender/viewport_compositor/intern/domain.cc
A       source/blender/viewport_compositor/intern/evaluator.cc
A       source/blender/viewport_compositor/intern/gpu_material_node.cc
A       source/blender/viewport_compositor/intern/gpu_material_operation.cc
A       
source/blender/viewport_compositor/intern/input_single_value_operation.cc
A       source/blender/viewport_compositor/intern/node_operation.cc
A       source/blender/viewport_compositor/intern/operation.cc
A       source/blender/viewport_compositor/intern/processor_operation.cc
A       
source/blender/viewport_compositor/intern/realize_on_domain_processor_operation.cc
A       
source/blender/viewport_compositor/intern/reduce_to_single_value_processor_operation.cc
A       source/blender/viewport_compositor/intern/result.cc
A       source/blender/viewport_compositor/intern/scheduler.cc
A       source/blender/viewport_compositor/intern/shader_pool.cc
A       source/blender/viewport_compositor/intern/texture_pool.cc
A       source/blender/viewport_compositor/intern/unsupported_node_operation.cc
A       source/blender/viewport_compositor/intern/utilities.cc

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index b65079c0f36..f528b49d271 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6079,6 +6079,23 @@ class VIEW3D_PT_shading_render_pass(Panel):
         layout.prop(shading, "render_pass", text="")
 
 
+class VIEW3D_PT_shading_compositor(Panel):
+    bl_space_type = 'VIEW_3D'
+    bl_region_type = 'HEADER'
+    bl_label = "Compositor"
+    bl_parent_id = 'VIEW3D_PT_shading'
+
+    @classmethod
+    def poll(cls, context):
+        return context.space_data.shading.type in ('MATERIAL', 'RENDERED')
+
+    def draw(self, context):
+        shading = context.space_data.shading
+
+        layout = self.layout
+        layout.prop(shading, "use_compositor")
+
+
 class VIEW3D_PT_gizmo_display(Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'HEADER'
@@ -7816,6 +7833,7 @@ classes = (
     VIEW3D_PT_shading_options_shadow,
     VIEW3D_PT_shading_options_ssao,
     VIEW3D_PT_shading_render_pass,
+    VIEW3D_PT_shading_compositor,
     VIEW3D_PT_gizmo_display,
     VIEW3D_PT_overlay,
     VIEW3D_PT_overlay_guides,
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index deff45d0350..f201e1842d2 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -113,6 +113,7 @@ add_subdirectory(sequencer)
 add_subdirectory(shader_fx)
 add_subdirectory(io)
 add_subdirectory(functions)
+add_subdirectory(viewport_compositor)
 add_subdirectory(makesdna)
 add_subdirectory(makesrna)
 
diff --git a/source/blender/blenkernel/BKE_colortools.h 
b/source/blender/blenkernel/BKE_colortools.h
index 0d4560207ea..d52fd91ccdd 100644
--- a/source/blender/blenkernel/BKE_colortools.h
+++ b/source/blender/blenkernel/BKE_colortools.h
@@ -129,6 +129,36 @@ bool BKE_curvemapping_RGBA_does_something(const struct 
CurveMapping *cumap);
 void BKE_curvemapping_table_F(const struct CurveMapping *cumap, float **array, 
int *size);
 void BKE_curvemapping_table_RGBA(const struct CurveMapping *cumap, float 
**array, int *size);
 
+/** Get the minimum x value of each curve map table. */
+void BKE_curvemapping_get_range_minimums(const struct CurveMapping 
*curve_mapping,
+                                         float minimums[4]);
+
+/** Get the reciprocal of the difference between the maximum and the minimum x 
value of each curve
+ * map table. Evaluation parameters can be multiplied by this value to be 
normalized. If the
+ * difference is zero, 1^8 is returned. */
+void BKE_curvemapping_compute_range_dividers(const struct CurveMapping 
*curve_mapping,
+                                             float dividers[4]);
+
+/** Compute the slopes at the start and end points of each curve map. The 
slopes are multiplied by
+ * the range of the curve map to compensate for parameter normalization. If 
the slope is vertical,
+ * 1^8 is returned.  */
+void BKE_curvemapping_compute_slopes(const struct CurveMapping *curve_mapping,
+                                     float start_slopes[4],
+                                     float end_slopes[4]);
+
+/** Check if the curve map at the index is identity, that is, does nothing. A 
curve map is said to
+ * be identity if:
+ * - The curve mapping uses extrapolation.
+ * - Its range is 1.
+ * - The slope at its start point is 1.
+ * - The slope at its end point is 1.
+ * - The number of points is 2.
+ * - The start point is at (0, 0).
+ * - The end point is at (1, 1).
+ * Note that this could return false even if the curve map is identity, this 
happens in the case
+ * when more than 2 points exist in the curve map but all points are 
collinear. */
+bool BKE_curvemapping_is_map_identity(const struct CurveMapping 
*curve_mapping, int index);
+
 /**
  * Call when you do images etc, needs restore too. also verifies tables.
  * non-const (these modify the curve).
diff --git a/source/blender/blenkernel/BKE_node.h 
b/source/blender/blenkernel/BKE_node.h
index 1ff10d06b00..7c14113880b 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -101,6 +101,7 @@ typedef struct bNodeSocketTemplate {
 namespace blender {
 class CPPType;
 namespace nodes {
+class DNode;
 class NodeMultiFunctionBuilder;
 class GeoNodeExecParams;
 class NodeDeclarationBuilder;
@@ -109,6 +110,11 @@ class GatherLinkSearchOpParams;
 namespace fn {
 class MFDataType;
 }  // namespace fn
+namespace viewport_compositor {
+class Context;
+class NodeOperation;
+class GPUMaterialNode;
+}  // namespace viewport_compositor
 }  // namespace blender
 
 using CPPTypeHandle = blender::CPPType;
@@ -123,7 +129,14 @@ using SocketGetGeometryNodesCPPValueFunction = void 
(*)(const struct bNodeSocket
 using NodeGatherSocketLinkOperationsFunction =
     void (*)(blender::nodes::GatherLinkSearchOpParams &params);
 
+using NodeGetCompositorOperationFunction = 
blender::viewport_compositor::NodeOperation
+    *(*)(blender::viewport_compositor::Context &context, blender::nodes::DNode 
node);
+using NodeGetCompositorGPUMaterialNodeFunction =
+    blender::viewport_compositor::GPUMaterialNode *(*)(blender::nodes::DNode 
node);
+
 #else
+typedef void *NodeGetCompositorOperationFunction;
+typedef void *NodeGetCompositorGPUMaterialNodeFunction;
 typedef void *NodeMultiFunctionBuildFunction;
 typedef void *NodeGeometryExecFunction;
 typedef void *NodeDeclareFunction;
@@ -309,6 +322,14 @@ typedef struct bNodeType {
   /* gpu */
   NodeGPUExecFunction gpu_fn;
 
+  /* Get an instance of this node's compositor operation. Freeing the instance 
is the
+   * responsibility of the caller. */
+  NodeGetCompositorOperationFunction get_compositor_operation;
+
+  /* Get an instance of this node's compositor GPU material node. Freeing the 
instance is the
+   * responsibility of the caller. */
+  NodeGetCompositorGPUMaterialNodeFunction get_compositor_gpu_material_node;
+
   /* Build a multi-function for this node. */
   NodeMultiFunctionBuildFunction build_multi_function;
 
diff --git a/source/blender/blenkernel/intern/colortools.c 
b/source/blender/blenkernel/intern/colortools.c
index c3d66d4463d..e4c46703f8a 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -1158,6 +1158,80 @@ bool BKE_curvemapping_RGBA_does_something(const 
CurveMapping *cumap)
   return false;
 }
 
+void BKE_curvemapping_get_range_minimums(const CurveMapping *curve_mapping, 
float minimums[CM_TOT])
+{
+  for (int i = 0; i < CM_TOT; i++) {
+    minimums[i] = curve_mapping->cm[i].mintable;
+  }
+}
+
+void BKE_curvemapping_compute_range_dividers(const CurveMapping *curve_mapping,
+                                             float dividers[CM_TOT])
+{
+  for (int i = 0; i < CM_TOT; i++) {
+    const CurveMap *curve_map = &curve_mapping->cm[i];
+    dividers[i] = 1.0f / max_ff(1e-8f, curve_map->maxtable - 
curve_map->mintable);
+  }
+}
+
+void BKE_curvemapping_compute_slopes(const CurveMapping *curve_mapping,
+                                     float start_slopes[CM_TOT],
+                                     float end_slopes[CM_TOT])
+{
+  float range_dividers[CM_TOT];
+  BKE_curvemapping_compute_range_dividers(curve_mapping, range_dividers);
+  for (int i = 0; i < CM_TOT; i++) {
+    const CurveMap *curve_map = &curve_mapping->cm[i];
+    /* If extrapolation is not enabled, the slopes are horizontal. */
+    if (!(curve_mapping->flag & CUMA_EXTEND_EXTRAPOLATE)) {
+      start_slopes[i] = 0.0f;
+      end_slopes[i] = 0.0f;
+      continue;
+    }
+
+    if (curve_map->ext_in[0] != 0.0f) {
+      start_slopes[i] = curve_map->ext_in[1] / (curve_map->ext_in[0] * 
range_dividers[i]);
+    }
+    else {
+      start_slopes[i] = 1e8f;
+    }
+
+    if (curve_map->ext_out[0] != 0.0f) {
+      end_slopes[i] = curve_map->ext_out[1] / (curve_map->ext_out[0] * 
range_dividers[i]);
+    }
+    else {
+      end_slopes[i] = 1e8f;
+    }
+  }
+}
+
+bool BKE_curvemapping_is_map_identity(const CurveMapping *curve_mapping, int 
index)
+{
+  if (!(curve_mapping->flag & CUMA_EXTEND_EXTRAPOLATE)) {
+    return false;
+  }
+  const CurveMap *curve_map = &curve_mapping->cm[index];
+  if (curve_map->maxtable - curve_map->mintable != 1.0f) {
+    return false;
+  }
+  if (curve_map->ext_in[0] != curve_map->ext_in[1]) {
+    return false;
+  }
+  if (curve_map->ext_out[0] != curve_map->ext_out[1]) {
+    return false;
+  }
+  if (curve_map->totpoint != 2) {
+    return false;
+  }
+  if (curve_map->curve[0].x != 0 || curve_map->curve[0].y != 0) {
+    return false;
+  }
+  if (curve_map->curve[1].x != 0 || curve_map->curve[1].y != 0) {
+    return false;
+  }
+  return true;
+}
+
 void BKE_curvemapping_init(CurveMapping *cumap)
 {
   int a;
diff --git a/source/blender/blenkernel/intern/image_gpu.cc 
b/source/blender/blenkernel/intern/image_gpu.cc
index 0d470c5b663..81c8778c49e 100644
--- a/source/blender/blenkernel/intern/image_gpu.cc
+++ b/source/blender/blenkernel/intern/image_gpu.cc
@@ -395,6 +395,7 @@ static GPUTexture *image_get_gpu_texture(Image *ima,
     ima->gpu_pass = requested_pass;
     ima->gpu_layer = requested_layer;
     ima->gpu_view = requested_view;
+    BKE_image_partial_update_mark_full_update(ima);
   }
 #undef GPU_FLAGS_TO_CHECK
 
diff --git a/source/blender/blenlib/BLI_transformation_2d.hh 
b/source/blender/blenlib/BLI_transformation_2d.hh
new file mode 100644
index 00000000000..59ddc48e091
--- /dev/null
+++ b/source/blender/blenlib/BLI_transformation_2d.hh
@@ -0,0 +1,162 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#pragma once
+
+#include <cmath>
+#include <cstdint>
+
+#include "BLI_assert.h"
+#include "BLI_math_base.h"
+#include "BLI_math_matrix.h"
+#include "BLI_math_vec_types.hh"
+#include "BLI_math_vector.h"
+
+namespace blender {
+
+/* A 2D affine transformation stored in a transformation matrix in homogeneous 
coordinates form.
+ * The matrix is stored column major order. */
+struct Transformation2D {
+ private:
+  float matrix_[3][3];
+
+ public:
+  static Transformation2D zero()
+  {
+    Transformation2D result;
+    result.matrix_[0][0] = 0.0f;
+    result.matrix_[0][1] = 0.0f;
+    result.matrix_[0][2] = 0.0f;
+    result.matrix_[1][0] = 0.0f;
+   

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to