40 : image_user(image_user), pass_name(pass_name)
51 return a.image_user.framenr ==
b.image_user.framenr &&
52 a.image_user.layer ==
b.image_user.layer && a.image_user.view ==
b.image_user.view &&
53 a.pass_name ==
b.pass_name;
63 const ListBase *layers = &image->rr->layers;
90 const ListBase *views = &image->rr->views;
96 const int view = image_user.
view;
105 const char *view_name = context.get_view_name().data();
109 if (matched_view == -1) {
122 const char *pass_name)
124 ImageUser image_user_for_pass = *image_user;
138 return image_user_for_pass;
160 image_buffer->
x, image_buffer->
y, image_buffer->
planes, 0);
161 linear_image_buffer->
flags = image_buffer->
flags;
180 const bool is_suitable_compressed_color_space =
188 return linear_image_buffer;
194 const char *pass_name)
206 if (!initial_image_buffer) {
211 context, image, image_user, pass_name);
222 const bool is_single_channel = linear_image_buffer->
channels == 1;
227 if (context.use_gpu()) {
230 this->result.wrap_external(texture_);
233 const int2 size =
int2(image_buffer->
x, image_buffer->
y);
234 const int channels_count = linear_image_buffer->
channels;
237 this->result.allocate_texture(size,
false);
239 this->result.store_pixel(texel, buffer_result.
load_pixel(texel));
249 this->result.release();
260 for (
auto &cached_images_for_id : map_.values()) {
261 cached_images_for_id.remove_if([](
auto item) {
return !item.value->needed; });
263 map_.remove_if([](
auto item) {
return item.value.is_empty(); });
267 for (
auto &cached_images_for_id : map_.values()) {
268 for (
auto &value : cached_images_for_id.values()) {
269 value->needed =
false;
277 const char *pass_name)
279 if (!image || !image_user) {
284 ImageUser image_user_for_frame = *image_user;
289 const std::string library_key = image->id.lib ? image->id.lib->id.name :
"";
290 const std::string id_key = std::string(image->id.name) + library_key;
291 auto &cached_images_for_id = map_.lookup_or_add_default(id_key);
294 if (context.query_id_recalc_flag(
reinterpret_cast<ID *
>(image)) &
ID_RECALC_ALL) {
295 cached_images_for_id.clear();
298 auto &cached_image = *cached_images_for_id.lookup_or_add_cb(key, [&]() {
299 return std::make_unique<CachedImage>(context, image, &image_user_for_frame, pass_name);
302 cached_image.needed =
true;
303 return &cached_image.result;
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
bool BKE_image_is_multilayer(const Image *ima)
void BKE_image_user_frame_calc(Image *ima, ImageUser *iuser, int cfra)
RenderPass * BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser)
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
bool BKE_image_is_multiview(const Image *ima)
void BKE_image_multiview_index(const Image *ima, ImageUser *iuser)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count_at_most(const struct ListBase *listbase, int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_findstringindex(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
ID and Library types, which are fundamental for SDNA.
#define GPU_TEXTURE_FREE_SAFE(texture)
void GPU_texture_update_mipmap_chain(GPUTexture *texture)
bool IMB_colormanagement_space_is_data(ColorSpace *colorspace)
bool IMB_colormanagement_space_is_scene_linear(ColorSpace *colorspace)
void IMB_assign_dds_data(ImBuf *ibuf, const DDSData &data, ImBufOwnership ownership)
void IMB_assign_float_buffer(ImBuf *ibuf, float *buffer_data, ImBufOwnership ownership)
void IMB_assign_byte_buffer(ImBuf *ibuf, uint8_t *buffer_data, ImBufOwnership ownership)
GPUTexture * IMB_create_gpu_texture(const char *name, ImBuf *ibuf, bool use_high_bitdepth, bool use_premult)
void IMB_float_from_rect(ImBuf *ibuf)
Contains defines and structs used throughout the imbuf module.
@ IB_DO_NOT_TAKE_OWNERSHIP
Result * get(Context &context, Image *image, const ImageUser *image_user, const char *pass_name)
CachedImageKey(ImageUser image_user, std::string pass_name)
CachedImage(Context &context, Image *image, ImageUser *image_user, const char *pass_name)
float4 load_pixel(const int2 &texel) const
void wrap_external(GPUTexture *texture)
static ResultType float_type(const int channels_count)
local_group_size(16, 16) .push_constant(Type b
struct ImBuf * IMB_allocImBuf(unsigned int, unsigned int, unsigned char, unsigned int)
void IMB_freeImBuf(ImBuf *)
static ImBuf * compute_linear_buffer(ImBuf *image_buffer)
static int get_pass_index(Image *image, ImageUser &image_user, const char *name)
static ImageUser compute_image_user_for_pass(Context &context, Image *image, const ImageUser *image_user, const char *pass_name)
static int get_view_index(Context &context, Image *image, ImageUser &image_user)
void parallel_for(const int2 range, FunctionRef< void(int2)> function)
static RenderLayer * get_render_layer(Image *image, ImageUser &image_user)
bool operator==(const BokehKernelKey &a, const BokehKernelKey &b)
VecBase< int32_t, 2 > int2
uint64_t get_default_hash(const T &v)
unsigned __int64 uint64_t
ImBufFloatBuffer float_buffer
ImBufByteBuffer byte_buffer