49 if (context.use_gpu()) {
50 this->compute_gpu(context, type);
53 this->compute_cpu(type);
66 return "compositor_image_coordinates_uniform";
68 return "compositor_image_coordinates_normalized";
70 return "compositor_image_coordinates_pixel";
77void ImageCoordinates::compute_gpu(Context &context,
const CoordinatesType type)
82 this->
result.bind_as_image(shader,
"output_img");
86 this->
result.unbind_as_image();
98 float2 normalized_coordinates = (centered_coordinates / max_size) * 2.0f;
99 this->
result.store_pixel(texel, normalized_coordinates);
107 this->
result.store_pixel(texel, normalized_coordinates);
113 [&](
const int2 texel) { this->result.store_pixel(texel, float2(texel)); });
126 map_.remove_if([](
auto item) {
return !item.value->needed; });
130 for (
auto &value : map_.values()) {
131 value->needed =
false;
141 auto &pixel_coordinates = *map_.lookup_or_add_cb(
142 key, [&]() {
return std::make_unique<ImageCoordinates>(context,
size, type); });
144 pixel_coordinates.needed =
true;
145 return pixel_coordinates.result;
#define BLI_assert_unreachable()
void GPU_shader_bind(blender::gpu::Shader *shader, const blender::gpu::shader::SpecializationConstants *constants_state=nullptr)
unsigned long long int uint64_t
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Result & get(Context &context, const int2 &size, const CoordinatesType type)
ImageCoordinatesKey(const int2 &size, const CoordinatesType type)
ImageCoordinates(Context &context, const int2 &size, const CoordinatesType type)
void compute_dispatch_threads_at_least(gpu::Shader *shader, int2 threads_range, int2 local_size=int2(16))
bool operator==(const BokehKernelKey &a, const BokehKernelKey &b)
void parallel_for(const int2 range, const Function &function)
static const char * get_shader_name(const int distance)
T max(const T &a, const T &b)
uint64_t get_default_hash(const T &v, const Args &...args)
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2