Differential D16990 Diff 60050 source/blender/compositor/realtime_compositor/shaders/compositor_parallel_reduction.glsl
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/realtime_compositor/shaders/compositor_parallel_reduction.glsl
| Show All 38 Lines | |||||
| * TYPE, IDENTITY, INITIALIZE, LOAD, and REDUCE. See the implementation below for more information | * TYPE, IDENTITY, INITIALIZE, LOAD, and REDUCE. See the implementation below for more information | ||||
| * as well as the compositor_parallel_reduction_info.hh for example reductions operations. */ | * as well as the compositor_parallel_reduction_info.hh for example reductions operations. */ | ||||
| /* Doing the reduction in shared memory is faster, so create a shared array where the whole data | /* Doing the reduction in shared memory is faster, so create a shared array where the whole data | ||||
| * of the work group will be loaded and reduced. The 2D structure of the work group is irrelevant | * of the work group will be loaded and reduced. The 2D structure of the work group is irrelevant | ||||
| * for reduction, so we just load the data in a 1D array to simplify reduction. The developer is | * for reduction, so we just load the data in a 1D array to simplify reduction. The developer is | ||||
| * expected to define the TYPE macro to be a float or a vec4, depending on the type of data being | * expected to define the TYPE macro to be a float or a vec4, depending on the type of data being | ||||
| * reduced. */ | * reduced. */ | ||||
| const uint reduction_size = gl_WorkGroupSize.x * gl_WorkGroupSize.y; | #define reduction_size (gl_WorkGroupSize.x * gl_WorkGroupSize.y) | ||||
| shared TYPE reduction_data[reduction_size]; | shared TYPE reduction_data[reduction_size]; | ||||
| void main() | void main() | ||||
| { | { | ||||
| /* Load the data from the texture, while returning IDENTITY for out of bound coordinates. The | /* Load the data from the texture, while returning IDENTITY for out of bound coordinates. The | ||||
| * developer is expected to define the IDENTITY macro to be a vec4 that does not affect the | * developer is expected to define the IDENTITY macro to be a vec4 that does not affect the | ||||
| * output of the reduction. For instance, sum reductions have an identity of vec4(0.0), while | * output of the reduction. For instance, sum reductions have an identity of vec4(0.0), while | ||||
| * max value reductions have an identity of vec4(FLT_MIN). */ | * max value reductions have an identity of vec4(FLT_MIN). */ | ||||
| ▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines | |||||