Commit: 9838f9a44b6c00f54ce4079fb3e013c3339320f8
Author: Omar Emara
Date:   Fri Feb 18 11:52:31 2022 +0200
Branches: temp-viewport-compositor-compiler
https://developer.blender.org/rB9838f9a44b6c00f54ce4079fb3e013c3339320f8

Viewport Compositor: Add basic input nodes

This patch adds basic implmenetations for the render layer and image
nodes.

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

M       source/blender/draw/engines/compositor/compositor_engine.cc
M       source/blender/gpu/CMakeLists.txt
D       source/blender/gpu/shaders/composite/gpu_shader_composite_image.glsl
A       
source/blender/gpu/shaders/compositor/infos/sampler2D_to_RGBA16F_2D_image_info.hh
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_alpha_over.glsl       
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_alpha_over.glsl
R100    source/blender/gpu/shaders/composite/gpu_shader_composite_box_mask.glsl 
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_box_mask.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_bright_contrast.glsl  
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_bright_contrast.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_channel_matte.glsl    
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_channel_matte.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_chroma_matte.glsl     
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_chroma_matte.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_color_balance.glsl    
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_color_balance.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_color_correction.glsl 
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_color_correction.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_color_matte.glsl      
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_color_matte.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_color_spill.glsl      
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_color_spill.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_color_to_luminance.glsl
       
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_color_to_luminance.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_difference_matte.glsl 
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_difference_matte.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_distance_matte.glsl   
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_distance_matte.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_ellipse_mask.glsl     
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_ellipse_mask.glsl
R100    source/blender/gpu/shaders/composite/gpu_shader_composite_exposure.glsl 
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_exposure.glsl
R100    source/blender/gpu/shaders/composite/gpu_shader_composite_gamma.glsl    
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_gamma.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_hue_correct.glsl      
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_hue_correct.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_hue_saturation_value.glsl
     
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_hue_saturation_value.glsl
R100    source/blender/gpu/shaders/composite/gpu_shader_composite_invert.glsl   
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_invert.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_luminance_matte.glsl  
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_luminance_matte.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_map_value.glsl        
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_map_value.glsl
R100    source/blender/gpu/shaders/composite/gpu_shader_composite_normal.glsl   
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_normal.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_posterize.glsl        
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_posterize.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_separate_combine.glsl 
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_separate_combine.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_set_alpha.glsl        
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_set_alpha.glsl
R100    
source/blender/gpu/shaders/composite/gpu_shader_composite_split_viewer.glsl     
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_split_viewer.glsl
A       source/blender/gpu/shaders/compositor/sampler2D_to_RGBA16F_2D_image.glsl
M       source/blender/nodes/NOD_compositor_execute.hh
M       source/blender/nodes/composite/nodes/node_composite_image.cc
M       source/blender/nodes/intern/node_compositor_execute.cc

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

diff --git a/source/blender/draw/engines/compositor/compositor_engine.cc 
b/source/blender/draw/engines/compositor/compositor_engine.cc
index b9d507c46ef..f7b1ef1b150 100644
--- a/source/blender/draw/engines/compositor/compositor_engine.cc
+++ b/source/blender/draw/engines/compositor/compositor_engine.cc
@@ -20,6 +20,8 @@
 
 #include "DNA_scene_types.h"
 
+#include "DEG_depsgraph_query.h"
+
 #include "DRW_render.h"
 
 #include "IMB_colormanagement.h"
@@ -49,7 +51,8 @@ class DRWContext : public Context {
 
   GPUTexture *get_pass_texture(int view_layer, eScenePassType pass_type) 
override
   {
-    return DRW_render_pass_find(DRW_context_state_get()->scene, view_layer, 
pass_type)->pass_tx;
+    Scene *original_scene = (Scene 
*)DEG_get_original_id(&DRW_context_state_get()->scene->id);
+    return DRW_render_pass_find(original_scene, view_layer, 
pass_type)->pass_tx;
   }
 };
 
diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index 44a232fd8aa..669657c3b9e 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -282,32 +282,33 @@ set(GLSL_SRC
   shaders/common/gpu_shader_common_mix_rgb.glsl
   shaders/common/gpu_shader_common_hash.glsl
   
-  shaders/composite/gpu_shader_composite_alpha_over.glsl
-  shaders/composite/gpu_shader_composite_box_mask.glsl
-  shaders/composite/gpu_shader_composite_bright_contrast.glsl
-  shaders/composite/gpu_shader_composite_channel_matte.glsl
-  shaders/composite/gpu_shader_composite_chroma_matte.glsl
-  shaders/composite/gpu_shader_composite_color_balance.glsl
-  shaders/composite/gpu_shader_composite_color_correction.glsl
-  shaders/composite/gpu_shader_composite_color_matte.glsl
-  shaders/composite/gpu_shader_composite_color_spill.glsl
-  shaders/composite/gpu_shader_composite_color_to_luminance.glsl
-  shaders/composite/gpu_shader_composite_difference_matte.glsl
-  shaders/composite/gpu_shader_composite_distance_matte.glsl
-  shaders/composite/gpu_shader_composite_ellipse_mask.glsl
-  shaders/composite/gpu_shader_composite_exposure.glsl
-  shaders/composite/gpu_shader_composite_gamma.glsl
-  shaders/composite/gpu_shader_composite_hue_correct.glsl
-  shaders/composite/gpu_shader_composite_hue_saturation_value.glsl
-  shaders/composite/gpu_shader_composite_image.glsl
-  shaders/composite/gpu_shader_composite_invert.glsl
-  shaders/composite/gpu_shader_composite_luminance_matte.glsl
-  shaders/composite/gpu_shader_composite_map_value.glsl
-  shaders/composite/gpu_shader_composite_normal.glsl
-  shaders/composite/gpu_shader_composite_posterize.glsl
-  shaders/composite/gpu_shader_composite_separate_combine.glsl
-  shaders/composite/gpu_shader_composite_set_alpha.glsl
-  shaders/composite/gpu_shader_composite_split_viewer.glsl
+  shaders/compositor/material/gpu_shader_compositor_alpha_over.glsl
+  shaders/compositor/material/gpu_shader_compositor_box_mask.glsl
+  shaders/compositor/material/gpu_shader_compositor_bright_contrast.glsl
+  shaders/compositor/material/gpu_shader_compositor_channel_matte.glsl
+  shaders/compositor/material/gpu_shader_compositor_chroma_matte.glsl
+  shaders/compositor/material/gpu_shader_compositor_color_balance.glsl
+  shaders/compositor/material/gpu_shader_compositor_color_correction.glsl
+  shaders/compositor/material/gpu_shader_compositor_color_matte.glsl
+  shaders/compositor/material/gpu_shader_compositor_color_spill.glsl
+  shaders/compositor/material/gpu_shader_compositor_color_to_luminance.glsl
+  shaders/compositor/material/gpu_shader_compositor_difference_matte.glsl
+  shaders/compositor/material/gpu_shader_compositor_distance_matte.glsl
+  shaders/compositor/material/gpu_shader_compositor_ellipse_mask.glsl
+  shaders/compositor/material/gpu_shader_compositor_exposure.glsl
+  shaders/compositor/material/gpu_shader_compositor_gamma.glsl
+  shaders/compositor/material/gpu_shader_compositor_hue_correct.glsl
+  shaders/compositor/material/gpu_shader_compositor_hue_saturation_value.glsl
+  shaders/compositor/material/gpu_shader_compositor_invert.glsl
+  shaders/compositor/material/gpu_shader_compositor_luminance_matte.glsl
+  shaders/compositor/material/gpu_shader_compositor_map_value.glsl
+  shaders/compositor/material/gpu_shader_compositor_normal.glsl
+  shaders/compositor/material/gpu_shader_compositor_posterize.glsl
+  shaders/compositor/material/gpu_shader_compositor_separate_combine.glsl
+  shaders/compositor/material/gpu_shader_compositor_set_alpha.glsl
+  shaders/compositor/material/gpu_shader_compositor_split_viewer.glsl
+
+  shaders/compositor/sampler2D_to_RGBA16F_2D_image.glsl
 
   shaders/material/gpu_shader_material_add_shader.glsl
   shaders/material/gpu_shader_material_ambient_occlusion.glsl
@@ -488,6 +489,8 @@ set(SHADER_CREATE_INFOS
   shaders/infos/gpu_shader_simple_lighting_info.hh
   shaders/infos/gpu_shader_text_info.hh
   shaders/infos/gpu_srgb_to_framebuffer_space_info.hh
+
+  shaders/compositor/infos/sampler2D_to_RGBA16F_2D_image_info.hh
 )
 
 set(SHADER_CREATE_INFOS_CONTENT "")
diff --git 
a/source/blender/gpu/shaders/composite/gpu_shader_composite_image.glsl 
b/source/blender/gpu/shaders/composite/gpu_shader_composite_image.glsl
deleted file mode 100644
index a0ca6b4e495..00000000000
--- a/source/blender/gpu/shaders/composite/gpu_shader_composite_image.glsl
+++ /dev/null
@@ -1,16 +0,0 @@
-
-void node_composite_image(sampler2D tex, out vec4 result)
-{
-  /* TODO(fclem) correct positionning. */
-  result = texture(tex, g_data.uv_texco);
-}
-
-void node_composite_image_empty(out vec4 result)
-{
-  result = vec4(0.0);
-}
-
-void node_composite_rlayers(sampler2D rlayer, out vec4 result)
-{
-  result = texture(rlayer, g_data.uv_render_layer);
-}
diff --git 
a/source/blender/gpu/shaders/compositor/infos/sampler2D_to_RGBA16F_2D_image_info.hh
 
b/source/blender/gpu/shaders/compositor/infos/sampler2D_to_RGBA16F_2D_image_info.hh
new file mode 100644
index 00000000000..b1ef8432801
--- /dev/null
+++ 
b/source/blender/gpu/shaders/compositor/infos/sampler2D_to_RGBA16F_2D_image_info.hh
@@ -0,0 +1,31 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2022 Blender Foundation.
+ * All rights reserved.
+ */
+
+/** \file
+ * \ingroup gpu
+ */
+
+#include "gpu_shader_create_info.hh"
+
+GPU_SHADER_CREATE_INFO(sampler2D_to_RGBA16F_2D_image)
+    .local_group_size(16, 16)
+    .sampler(0, ImageType::FLOAT_2D, "input_sampler", Frequency::PASS)
+    .image(0, GPU_RGBA16F, Qualifier::WRITE, ImageType::FLOAT_2D, 
"output_image")
+    .compute_source("sampler2D_to_RGBA16F_2D_image.glsl")
+    .do_static_compilation(true);
diff --git 
a/source/blender/gpu/shaders/composite/gpu_shader_composite_alpha_over.glsl 
b/source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_alpha_over.glsl
similarity index 100%
rename from 
source/blender/gpu/shaders/composite/gpu_shader_composite_alpha_over.glsl
rename to 
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_alpha_over.glsl
diff --git 
a/source/blender/gpu/shaders/composite/gpu_shader_composite_box_mask.glsl 
b/source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_box_mask.glsl
similarity index 100%
rename from 
source/blender/gpu/shaders/composite/gpu_shader_composite_box_mask.glsl
rename to 
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_box_mask.glsl
diff --git 
a/source/blender/gpu/shaders/composite/gpu_shader_composite_bright_contrast.glsl
 
b/source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_bright_contrast.glsl
similarity index 100%
rename from 
source/blender/gpu/shaders/composite/gpu_shader_composite_bright_contrast.glsl
rename to 
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_bright_contrast.glsl
diff --git 
a/source/blender/gpu/shaders/composite/gpu_shader_composite_channel_matte.glsl 
b/source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_channel_matte.glsl
similarity index 100%
rename from 
source/blender/gpu/shaders/composite/gpu_shader_composite_channel_matte.glsl
rename to 
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_channel_matte.glsl
diff --git 
a/source/blender/gpu/shaders/composite/gpu_shader_composite_chroma_matte.glsl 
b/source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_chroma_matte.glsl
similarity index 100%
rename from 
source/blender/gpu/shaders/composite/gpu_shader_composite_chroma_matte.glsl
rename to 
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_chroma_matte.glsl
diff --git 
a/source/blender/gpu/shaders/composite/gpu_shader_composite_color_balance.glsl 
b/source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_color_balance.glsl
similarity index 100%
rename from 
source/blender/gpu/shaders/composite/gpu_shader_composite_color_balance.glsl
rename to 
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_color_balance.glsl
diff --git 
a/source/blender/gpu/shaders/composite/gpu_shader_composite_color_correction.glsl
 
b/source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_color_correction.glsl
similarity index 100%
rename from 
source/blender/gpu/shaders/composite/gpu_shader_composite_color_correction.glsl
rename to 
source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_color_correction.glsl
diff --git 
a/source/blender/gpu/shaders/composite/gpu_shader_composite_color_matte.glsl 
b/source/blender/gpu/shaders/compositor/material/gpu_shader_compositor_color_matte.glsl
similarity index 100%
rename from source/blender/gpu/shaders/composi

@@ 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