Differential D16279 Diff 56892 source/blender/compositor/realtime_compositor/algorithms/intern/algorithm_parallel_reduction.cc
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/realtime_compositor/algorithms/intern/algorithm_parallel_reduction.cc
| Show First 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | float sum_luminance_squared_difference(Context &context, | ||||
| float *reduced_value = parallel_reduction_dispatch(context, texture, shader, GPU_R32F); | float *reduced_value = parallel_reduction_dispatch(context, texture, shader, GPU_R32F); | ||||
| const float sum = *reduced_value; | const float sum = *reduced_value; | ||||
| MEM_freeN(reduced_value); | MEM_freeN(reduced_value); | ||||
| GPU_shader_unbind(); | GPU_shader_unbind(); | ||||
| return sum; | return sum; | ||||
| } | } | ||||
| /* -------------------------------------------------------------------- | |||||
| * Maximum Reductions. | |||||
| */ | |||||
| float maximum_float_in_range(Context &context, | |||||
| GPUTexture *texture, | |||||
| float lower_bound, | |||||
| float upper_bound) | |||||
| { | |||||
| GPUShader *shader = context.shader_manager().get("compositor_maximum_float_in_range"); | |||||
| GPU_shader_bind(shader); | |||||
| GPU_shader_uniform_1f(shader, "lower_bound", lower_bound); | |||||
| GPU_shader_uniform_1f(shader, "upper_bound", upper_bound); | |||||
| float *reduced_value = parallel_reduction_dispatch(context, texture, shader, GPU_R32F); | |||||
| const float maximum = *reduced_value; | |||||
| MEM_freeN(reduced_value); | |||||
| GPU_shader_unbind(); | |||||
| return maximum; | |||||
| } | |||||
| /* -------------------------------------------------------------------- | |||||
| * Minimum Reductions. | |||||
| */ | |||||
| float minimum_float_in_range(Context &context, | |||||
| GPUTexture *texture, | |||||
| float lower_bound, | |||||
| float upper_bound) | |||||
| { | |||||
| GPUShader *shader = context.shader_manager().get("compositor_minimum_float_in_range"); | |||||
| GPU_shader_bind(shader); | |||||
| GPU_shader_uniform_1f(shader, "lower_bound", lower_bound); | |||||
| GPU_shader_uniform_1f(shader, "upper_bound", upper_bound); | |||||
| float *reduced_value = parallel_reduction_dispatch(context, texture, shader, GPU_R32F); | |||||
| const float minimum = *reduced_value; | |||||
| MEM_freeN(reduced_value); | |||||
| GPU_shader_unbind(); | |||||
| return minimum; | |||||
| } | |||||
| } // namespace blender::realtime_compositor | } // namespace blender::realtime_compositor | ||||