From 0037411f55ec3da4cfad79575d5531869ae5dc38 Mon Sep 17 00:00:00 2001 From: Omar Emara Date: Tue, 11 Oct 2022 13:22:52 +0200 Subject: Realtime Compositor: Implement parallel reduction This patch implements generic parallel reduction for the realtime compositor and implements the Levels operation as an example. This patch also introduces the notion of a "Compositor Algorithm", which is a reusable operation that can be used to construct other operations. Differential Revision: https://developer.blender.org/D16184 Reviewed By: Clement Foucault --- source/blender/compositor/realtime_compositor/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/compositor/realtime_compositor/CMakeLists.txt') diff --git a/source/blender/compositor/realtime_compositor/CMakeLists.txt b/source/blender/compositor/realtime_compositor/CMakeLists.txt index 1f1333332f5..5473a253241 100644 --- a/source/blender/compositor/realtime_compositor/CMakeLists.txt +++ b/source/blender/compositor/realtime_compositor/CMakeLists.txt @@ -53,6 +53,10 @@ set(SRC COM_static_shader_manager.hh COM_texture_pool.hh COM_utilities.hh + + algorithms/intern/algorithm_parallel_reduction.cc + + algorithms/COM_algorithm_parallel_reduction.hh ) set(LIB -- cgit v1.2.3 From 009acfa477bbb52560b05006d9b950e014e91d9b Mon Sep 17 00:00:00 2001 From: Omar Emara Date: Tue, 11 Oct 2022 16:22:14 +0200 Subject: Cleanup: Add missing include for parallel reduction The parallel reduction file didn't include its own header, which can yield "no previous declaration" warnings. This patch includes the header to fix the warning. --- source/blender/compositor/realtime_compositor/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/compositor/realtime_compositor/CMakeLists.txt') diff --git a/source/blender/compositor/realtime_compositor/CMakeLists.txt b/source/blender/compositor/realtime_compositor/CMakeLists.txt index 5473a253241..90cbe0988ad 100644 --- a/source/blender/compositor/realtime_compositor/CMakeLists.txt +++ b/source/blender/compositor/realtime_compositor/CMakeLists.txt @@ -2,6 +2,7 @@ set(INC . + ./algorithms ../../blenkernel ../../blenlib ../../gpu -- cgit v1.2.3 From 89525fae59eaac8fe1d63a948b454ac9ce921f05 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 19 Oct 2022 17:09:29 +1100 Subject: Cleanup: CMake include paths Remove redundant separators & redundant references to parent paths. --- source/blender/compositor/realtime_compositor/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/compositor/realtime_compositor/CMakeLists.txt') diff --git a/source/blender/compositor/realtime_compositor/CMakeLists.txt b/source/blender/compositor/realtime_compositor/CMakeLists.txt index 90cbe0988ad..bab0b5385ec 100644 --- a/source/blender/compositor/realtime_compositor/CMakeLists.txt +++ b/source/blender/compositor/realtime_compositor/CMakeLists.txt @@ -2,7 +2,7 @@ set(INC . - ./algorithms + algorithms ../../blenkernel ../../blenlib ../../gpu -- cgit v1.2.3 From bc8b15f1a532b078fcc4072295c442d140cdbc06 Mon Sep 17 00:00:00 2001 From: Omar Emara Date: Wed, 2 Nov 2022 13:55:23 +0200 Subject: Realtime Compositor: Move shaders to compositor module This patch moves the GLSL shaders and their infos to the compositor module as decided by the EEVEE & Viewport module. This is a non functional change. Differential Revision: https://developer.blender.org/D16360 Reviewed By: Clement Foucault --- .../compositor/realtime_compositor/CMakeLists.txt | 125 +++++++++++++++++++++ 1 file changed, 125 insertions(+) (limited to 'source/blender/compositor/realtime_compositor/CMakeLists.txt') diff --git a/source/blender/compositor/realtime_compositor/CMakeLists.txt b/source/blender/compositor/realtime_compositor/CMakeLists.txt index bab0b5385ec..2402adcadaf 100644 --- a/source/blender/compositor/realtime_compositor/CMakeLists.txt +++ b/source/blender/compositor/realtime_compositor/CMakeLists.txt @@ -68,4 +68,129 @@ set(LIB bf_blenkernel ) +set(GLSL_SRC + shaders/compositor_alpha_crop.glsl + shaders/compositor_bilateral_blur.glsl + shaders/compositor_blur.glsl + shaders/compositor_blur_variable_size.glsl + shaders/compositor_bokeh_image.glsl + shaders/compositor_box_mask.glsl + shaders/compositor_convert.glsl + shaders/compositor_despeckle.glsl + shaders/compositor_directional_blur.glsl + shaders/compositor_edge_filter.glsl + shaders/compositor_ellipse_mask.glsl + shaders/compositor_filter.glsl + shaders/compositor_flip.glsl + shaders/compositor_image_crop.glsl + shaders/compositor_morphological_distance.glsl + shaders/compositor_morphological_distance_feather.glsl + shaders/compositor_morphological_distance_threshold.glsl + shaders/compositor_morphological_step.glsl + shaders/compositor_normalize.glsl + shaders/compositor_parallel_reduction.glsl + shaders/compositor_projector_lens_distortion.glsl + shaders/compositor_realize_on_domain.glsl + shaders/compositor_screen_lens_distortion.glsl + shaders/compositor_set_alpha.glsl + shaders/compositor_split_viewer.glsl + shaders/compositor_symmetric_blur.glsl + shaders/compositor_symmetric_separable_blur.glsl + shaders/compositor_tone_map_photoreceptor.glsl + shaders/compositor_tone_map_simple.glsl + + shaders/library/gpu_shader_compositor_alpha_over.glsl + shaders/library/gpu_shader_compositor_blur_common.glsl + shaders/library/gpu_shader_compositor_bright_contrast.glsl + shaders/library/gpu_shader_compositor_channel_matte.glsl + shaders/library/gpu_shader_compositor_chroma_matte.glsl + shaders/library/gpu_shader_compositor_color_balance.glsl + shaders/library/gpu_shader_compositor_color_correction.glsl + shaders/library/gpu_shader_compositor_color_matte.glsl + shaders/library/gpu_shader_compositor_color_spill.glsl + shaders/library/gpu_shader_compositor_color_to_luminance.glsl + shaders/library/gpu_shader_compositor_difference_matte.glsl + shaders/library/gpu_shader_compositor_distance_matte.glsl + shaders/library/gpu_shader_compositor_exposure.glsl + shaders/library/gpu_shader_compositor_gamma.glsl + shaders/library/gpu_shader_compositor_hue_correct.glsl + shaders/library/gpu_shader_compositor_hue_saturation_value.glsl + shaders/library/gpu_shader_compositor_invert.glsl + shaders/library/gpu_shader_compositor_luminance_matte.glsl + shaders/library/gpu_shader_compositor_main.glsl + shaders/library/gpu_shader_compositor_map_value.glsl + shaders/library/gpu_shader_compositor_normal.glsl + shaders/library/gpu_shader_compositor_posterize.glsl + shaders/library/gpu_shader_compositor_separate_combine.glsl + shaders/library/gpu_shader_compositor_set_alpha.glsl + shaders/library/gpu_shader_compositor_store_output.glsl + shaders/library/gpu_shader_compositor_texture_utilities.glsl + shaders/library/gpu_shader_compositor_type_conversion.glsl +) + +set(GLSL_C) +foreach(GLSL_FILE ${GLSL_SRC}) + data_to_c_simple(${GLSL_FILE} GLSL_C) +endforeach() + +blender_add_lib(bf_compositor_shaders "${GLSL_C}" "" "" "") + +list(APPEND LIB + bf_compositor_shaders +) + +set(GLSL_SOURCE_CONTENT "") +foreach(GLSL_FILE ${GLSL_SRC}) + get_filename_component(GLSL_FILE_NAME ${GLSL_FILE} NAME) + string(REPLACE "." "_" GLSL_FILE_NAME_UNDERSCORES ${GLSL_FILE_NAME}) + string(APPEND GLSL_SOURCE_CONTENT "SHADER_SOURCE\(datatoc_${GLSL_FILE_NAME_UNDERSCORES}, \"${GLSL_FILE_NAME}\", \"${GLSL_FILE}\"\)\n") +endforeach() + +set(glsl_source_list_file "${CMAKE_CURRENT_BINARY_DIR}/glsl_compositor_source_list.h") +file(GENERATE OUTPUT ${glsl_source_list_file} CONTENT "${GLSL_SOURCE_CONTENT}") +list(APPEND SRC ${glsl_source_list_file}) +list(APPEND INC ${CMAKE_CURRENT_BINARY_DIR}) + +target_include_directories(bf_compositor_shaders PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) + +set(SRC_SHADER_CREATE_INFOS + shaders/infos/compositor_alpha_crop_info.hh + shaders/infos/compositor_bilateral_blur_info.hh + shaders/infos/compositor_blur_info.hh + shaders/infos/compositor_blur_variable_size_info.hh + shaders/infos/compositor_bokeh_image_info.hh + shaders/infos/compositor_box_mask_info.hh + shaders/infos/compositor_convert_info.hh + shaders/infos/compositor_despeckle_info.hh + shaders/infos/compositor_directional_blur_info.hh + shaders/infos/compositor_edge_filter_info.hh + shaders/infos/compositor_ellipse_mask_info.hh + shaders/infos/compositor_filter_info.hh + shaders/infos/compositor_flip_info.hh + shaders/infos/compositor_image_crop_info.hh + shaders/infos/compositor_morphological_distance_feather_info.hh + shaders/infos/compositor_morphological_distance_info.hh + shaders/infos/compositor_morphological_distance_threshold_info.hh + shaders/infos/compositor_morphological_step_info.hh + shaders/infos/compositor_normalize_info.hh + shaders/infos/compositor_parallel_reduction_info.hh + shaders/infos/compositor_projector_lens_distortion_info.hh + shaders/infos/compositor_realize_on_domain_info.hh + shaders/infos/compositor_screen_lens_distortion_info.hh + shaders/infos/compositor_set_alpha_info.hh + shaders/infos/compositor_split_viewer_info.hh + shaders/infos/compositor_symmetric_blur_info.hh + shaders/infos/compositor_symmetric_separable_blur_info.hh + shaders/infos/compositor_tone_map_photoreceptor_info.hh + shaders/infos/compositor_tone_map_simple_info.hh +) + +set(SHADER_CREATE_INFOS_CONTENT "") +foreach(DESCRIPTOR_FILE ${SRC_SHADER_CREATE_INFOS}) + string(APPEND SHADER_CREATE_INFOS_CONTENT "#include \"${DESCRIPTOR_FILE}\"\n") +endforeach() + +set(shader_create_info_list_file "${CMAKE_CURRENT_BINARY_DIR}/compositor_shader_create_info_list.hh") +file(GENERATE OUTPUT ${shader_create_info_list_file} CONTENT "${SHADER_CREATE_INFOS_CONTENT}") + blender_add_lib(bf_realtime_compositor "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") -- cgit v1.2.3 From 85ce4882981943b5a306090f03482bd5397c503d Mon Sep 17 00:00:00 2001 From: Omar Emara Date: Fri, 4 Nov 2022 16:14:22 +0200 Subject: Realtime Compositor: Implement static cache manager This patch introduces the concept of a Cached Resource that can be cached across compositor evaluations as well as used by multiple operations in the same evaluation. Additionally, this patch implements a new structure for the realtime compositor, the Static Cache Manager, that manages all the cached resources and deletes them when they are no longer needed. This improves responsiveness while adjusting compositor node trees and also conserves memory usage. Differential Revision: https://developer.blender.org/D16357 Reviewed By: Clement Foucault --- .../blender/compositor/realtime_compositor/CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/blender/compositor/realtime_compositor/CMakeLists.txt') diff --git a/source/blender/compositor/realtime_compositor/CMakeLists.txt b/source/blender/compositor/realtime_compositor/CMakeLists.txt index 2402adcadaf..b4352248b5b 100644 --- a/source/blender/compositor/realtime_compositor/CMakeLists.txt +++ b/source/blender/compositor/realtime_compositor/CMakeLists.txt @@ -3,6 +3,7 @@ set(INC . algorithms + cached_resources ../../blenkernel ../../blenlib ../../gpu @@ -10,6 +11,7 @@ set(INC ../../makesdna ../../makesrna ../../nodes + ../../render ../../gpu/intern ../../../../intern/guardedalloc ) @@ -31,6 +33,7 @@ set(SRC intern/shader_node.cc intern/shader_operation.cc intern/simple_operation.cc + intern/static_cache_manager.cc intern/static_shader_manager.cc intern/texture_pool.cc intern/utilities.cc @@ -51,6 +54,7 @@ set(SRC COM_shader_node.hh COM_shader_operation.hh COM_simple_operation.hh + COM_static_cache_manager.hh COM_static_shader_manager.hh COM_texture_pool.hh COM_utilities.hh @@ -58,12 +62,22 @@ set(SRC algorithms/intern/algorithm_parallel_reduction.cc algorithms/COM_algorithm_parallel_reduction.hh + + cached_resources/intern/morphological_distance_feather_weights.cc + cached_resources/intern/symmetric_blur_weights.cc + cached_resources/intern/symmetric_separable_blur_weights.cc + + cached_resources/COM_cached_resource.hh + cached_resources/COM_morphological_distance_feather_weights.hh + cached_resources/COM_symmetric_blur_weights.hh + cached_resources/COM_symmetric_separable_blur_weights.hh ) set(LIB bf_gpu bf_nodes bf_imbuf + bf_render bf_blenlib bf_blenkernel ) -- cgit v1.2.3