57 return (
M_PI * 2.0f) / sides;
66 return angle - offset;
78 GPUShader *shader = context.get_shader(
"compositor_bokeh_image");
88 this->
result.bind_as_image(shader,
"output_img");
92 this->
result.unbind_as_image();
108 map_.remove_if([](
auto item) {
return !item.value->needed; });
112 for (
auto &value : map_.values()) {
113 value->needed =
false;
127 auto &bokeh_kernel = *map_.lookup_or_add_cb(key, [&]() {
128 return std::make_unique<BokehKernel>(
129 context,
size, sides, rotation, roundness, catadioptric, lens_shift);
132 bokeh_kernel.needed =
true;
133 return bokeh_kernel.result;
void GPU_shader_uniform_1f(GPUShader *sh, const char *name, float value)
void GPU_shader_bind(GPUShader *shader)
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
struct GPUShader GPUShader
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Result & get(Context &context, int2 size, int sides, float rotation, float roundness, float catadioptric, float lens_shift)
BokehKernelKey(int2 size, int sides, float rotation, float roundness, float catadioptric, float lens_shift)
BokehKernel(Context &context, int2 size, int sides, float rotation, float roundness, float catadioptric, float lens_shift)
local_group_size(16, 16) .push_constant(Type b
static float compute_exterior_angle(int sides)
bool operator==(const BokehKernelKey &a, const BokehKernelKey &b)
static float compute_rotation(float angle, int sides)
void compute_dispatch_threads_at_least(GPUShader *shader, int2 threads_range, int2 local_size=int2(16))
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
uint64_t get_default_hash(const T &v)
unsigned __int64 uint64_t