32 using AccumulateT = std::conditional_t<std::is_same_v<T, Color>,
float4,
T>;
33 AccumulateT accumulated_value = AccumulateT(0);
37 accumulated_value += center_value * weights.
load_pixel<
float>(
int2(0));
43 for (
int i = 1; i < weights.
domain().data_size.x; i++) {
51 output.store_pixel(
int2(texel.y, texel.x),
T(accumulated_value));
59 return "compositor_symmetric_separable_blur_float";
62 return "compositor_symmetric_separable_blur_float4";
82 const Result &weights = context.cache_manager().symmetric_separable_blur_weights.get(
83 context, filter_type, radius);
111 const Result &weights = context.cache_manager().symmetric_separable_blur_weights.get(
112 context, filter_type, radius);
123 switch (input.
type()) {
145 if (context.use_gpu()) {
157 const bool extend_bounds)
161 Result padded_input = context.create_result(input.
type());
164 Result horizontal_pass_result = context.create_result(input.
type());
165 blur_pass(context, padded_input, horizontal_pass_result, radius.x, filter_type);
168 Result padded_horizontal_pass_result = context.create_result(input.
type());
170 horizontal_pass_result,
171 padded_horizontal_pass_result,
172 int2(padding_size.y, 0),
174 horizontal_pass_result.
release();
176 blur_pass(context, padded_horizontal_pass_result,
output, radius.y, filter_type);
177 padded_horizontal_pass_result.
release();
180 Result horizontal_pass_result = context.create_result(input.
type());
181 blur_pass(context, input, horizontal_pass_result, radius.x, filter_type);
182 blur_pass(context, horizontal_pass_result,
output, radius.y, filter_type);
183 horizontal_pass_result.
release();
#define BLI_assert_unreachable()
Domain transposed() const
void unbind_as_texture() const
static ResultType type(gpu::TextureFormat format)
void bind_as_texture(gpu::Shader *shader, const char *texture_name) const
T load_pixel_extended(const int2 &texel) const
T load_pixel(const int2 &texel) const
static void blur_pass(const Result &input, const Result &weights, Result &output)
void compute_dispatch_threads_at_least(gpu::Shader *shader, int2 threads_range, int2 local_size=int2(16))
void symmetric_separable_blur(Context &context, const Result &input, Result &output, const float2 &radius, const math::FilterKernel filter_type=math::FilterKernel::Gauss, const bool extend_bounds=false)
static void blur_pass_cpu(Context &context, const Result &input, Result &causal_output, Result &non_causal_output, const float sigma)
void pad(Context &context, const Result &input, Result &output, const int2 size, const PaddingMethod padding_method)
static const char * get_blur_shader(const ResultType type)
void parallel_for(const int2 range, const Function &function)
static void blur_pass_gpu(Context &context, const Result &input, Result &causal_result, Result &non_causal_result, const float sigma)
static void blur_pass(Context &context, const Result &input, Result &output, const float sigma)
void GPU_shader_bind(gpu::Shader *shader, const gpu::shader::SpecializationConstants *constants_state=nullptr)