Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Emara <mail@OmarEmara.dev>2022-10-20 17:31:35 +0300
committerOmar Emara <mail@OmarEmara.dev>2022-10-20 17:32:28 +0300
commit58e25f11ae9eb805dd857fae56be1d1a43710091 (patch)
tree50e7fe25fbf77f7ee16c42406d2debb1f2cd565f /source/blender/gpu/shaders/compositor/infos/compositor_parallel_reduction_info.hh
parent9d710374bda41359132f929286f5eea7340441b5 (diff)
Realtime Compositor: Implement normalize node
This patch implements the normalize node for the realtime compositor. Differential Revision: https://developer.blender.org/D16279 Reviewed By: Clement Foucault
Diffstat (limited to 'source/blender/gpu/shaders/compositor/infos/compositor_parallel_reduction_info.hh')
-rw-r--r--source/blender/gpu/shaders/compositor/infos/compositor_parallel_reduction_info.hh24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/compositor/infos/compositor_parallel_reduction_info.hh b/source/blender/gpu/shaders/compositor/infos/compositor_parallel_reduction_info.hh
index 4a71bdc80e2..e2252b14758 100644
--- a/source/blender/gpu/shaders/compositor/infos/compositor_parallel_reduction_info.hh
+++ b/source/blender/gpu/shaders/compositor/infos/compositor_parallel_reduction_info.hh
@@ -108,6 +108,18 @@ GPU_SHADER_CREATE_INFO(compositor_maximum_luminance)
.define("REDUCE(lhs, rhs)", "max(lhs, rhs)")
.do_static_compilation(true);
+GPU_SHADER_CREATE_INFO(compositor_maximum_float_in_range)
+ .additional_info("compositor_parallel_reduction_shared")
+ .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
+ .push_constant(Type::FLOAT, "lower_bound")
+ .push_constant(Type::FLOAT, "upper_bound")
+ .define("TYPE", "float")
+ .define("IDENTITY", "vec4(lower_bound)")
+ .define("INITIALIZE(v)", "((v.x <= upper_bound) && (v.x >= lower_bound)) ? v.x : lower_bound")
+ .define("LOAD(value)", "value.x")
+ .define("REDUCE(lhs, rhs)", "((rhs > lhs) && (rhs <= upper_bound)) ? rhs : lhs")
+ .do_static_compilation(true);
+
/* --------------------------------------------------------------------
* Minimum Reductions.
*/
@@ -123,3 +135,15 @@ GPU_SHADER_CREATE_INFO(compositor_minimum_luminance)
.define("LOAD(value)", "value.x")
.define("REDUCE(lhs, rhs)", "min(lhs, rhs)")
.do_static_compilation(true);
+
+GPU_SHADER_CREATE_INFO(compositor_minimum_float_in_range)
+ .additional_info("compositor_parallel_reduction_shared")
+ .image(0, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D, "output_img")
+ .push_constant(Type::FLOAT, "lower_bound")
+ .push_constant(Type::FLOAT, "upper_bound")
+ .define("TYPE", "float")
+ .define("IDENTITY", "vec4(upper_bound)")
+ .define("INITIALIZE(v)", "((v.x <= upper_bound) && (v.x >= lower_bound)) ? v.x : upper_bound")
+ .define("LOAD(value)", "value.x")
+ .define("REDUCE(lhs, rhs)", "((rhs < lhs) && (rhs >= lower_bound)) ? rhs : lhs")
+ .do_static_compilation(true);