diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 32 | ||||
-rw-r--r-- | source/blender/editors/render/render_internal.c | 17 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_draw.c | 18 | ||||
-rw-r--r-- | source/blender/render/extern/include/RE_pipeline.h | 3 | ||||
-rw-r--r-- | source/blender/render/intern/source/pipeline.c | 1 |
5 files changed, 38 insertions, 33 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 2d582157233..63bfbc3d093 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -1894,13 +1894,16 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_ memset(&rres, 0, sizeof(RenderResult)); if(!(rres.rectx > 0 && rres.recty > 0)) { - RE_ReleaseResultImage(re); + if(from_render) + RE_ReleaseResultImage(re); return NULL; } /* release is done in BKE_image_release_ibuf using lock_r */ - if(from_render) + if(from_render) { + BLI_lock_thread(LOCK_VIEWER); *lock_r= re; + } /* this gives active layer, composite or seqence result */ rect= (unsigned int *)rres.rect32; @@ -1909,9 +1912,9 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_ dither= iuser->scene->r.dither_intensity; /* get compo/seq result by default */ - if(rres.rectf && layer==0); + if(rres.compo_seq && layer==0); else if(rres.layers.first) { - RenderLayer *rl= BLI_findlink(&rres.layers, layer-(rres.rectf?1:0)); + RenderLayer *rl= BLI_findlink(&rres.layers, layer-(rres.compo_seq?1:0)); if(rl) { RenderPass *rpass; @@ -1934,6 +1937,9 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_ } } + if(!(rectf || rect)) + return NULL; + ibuf= image_get_ibuf(ima, IMA_NO_INDEX, 0); /* make ibuf if needed, and initialize it */ @@ -1942,17 +1948,12 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_ image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0); } - if(!(rectf || rect)) - return ibuf; - ibuf->x= rres.rectx; ibuf->y= rres.recty; - if(ibuf->rect_float!=rectf || rect) { /* ensure correct redraw */ - BLI_lock_thread(LOCK_CUSTOM1); + if(ibuf->rect_float!=rectf || rect) /* ensure correct redraw */ imb_freerectImBuf(ibuf); - BLI_unlock_thread(LOCK_CUSTOM1); - } + if(rect) ibuf->rect= rect; @@ -1991,7 +1992,7 @@ static ImBuf *image_get_ibuf_threadsafe(Image *ima, ImageUser *iuser, int *frame if(ima->lastframe != frame) ima->tpageflag |= IMA_TPAGE_REFRESH; ima->lastframe = frame; - } + } else if(ima->type==IMA_TYPE_MULTILAYER) { frame= iuser?iuser->framenr:ima->lastframe; index= iuser?iuser->multi_index:IMA_NO_INDEX; @@ -2155,10 +2156,13 @@ ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **lock_r) void BKE_image_release_ibuf(Image *ima, void *lock) { /* for getting image during threaded render / compositing, need to release */ - if(lock == ima) + if(lock == ima) { BLI_unlock_thread(LOCK_VIEWER); /* viewer image */ - else if(lock) + } + else if(lock) { RE_ReleaseResultImage(lock); /* render result */ + BLI_unlock_thread(LOCK_VIEWER); /* view image imbuf */ + } } ImBuf *BKE_image_get_ibuf(Image *ima, ImageUser *iuser) diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index dcafbc5b252..3f98a340b74 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -129,12 +129,8 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat } if(rectf==NULL) return; - if(ibuf->rect==NULL) { - BLI_lock_thread(LOCK_CUSTOM1); - if(ibuf->rect==NULL) - imb_addrectImBuf(ibuf); - BLI_unlock_thread(LOCK_CUSTOM1); - } + if(ibuf->rect==NULL) + imb_addrectImBuf(ibuf); rectf+= 4*(rr->rectx*ymin + xmin); rectc= (char *)(ibuf->rect + ibuf->x*rymin + rxmin); @@ -505,17 +501,22 @@ static void image_renderinfo_cb(void *rjv, RenderStats *rs) static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrect) { RenderJob *rj= rjv; + Image *ima= rj->image; ImBuf *ibuf; void *lock; - ibuf= BKE_image_acquire_ibuf(rj->image, &rj->iuser, &lock); + /* only update if we are displaying the slot being rendered */ + if(ima->render_slot != ima->last_render_slot) + return; + + ibuf= BKE_image_acquire_ibuf(ima, &rj->iuser, &lock); if(ibuf) { image_buffer_rect_update(rj->scene, rr, ibuf, renrect); /* make jobs timer to send notifier */ *(rj->do_update)= 1; } - BKE_image_release_ibuf(rj->image, lock); + BKE_image_release_ibuf(ima, lock); } static void render_startjob(void *rjv, short *stop, short *do_update) diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 55bec0740ea..a611ee6f32f 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -77,18 +77,14 @@ static void image_verify_buffer_float(SpaceImage *sima, Image *ima, ImBuf *ibuf, */ if(ibuf->rect_float && ibuf->rect==NULL) { - BLI_lock_thread(LOCK_CUSTOM1); - if(ibuf->rect_float && ibuf->rect==NULL) { - if(color_manage) { - if(ima && ima->source == IMA_SRC_VIEWER) - ibuf->profile = IB_PROFILE_LINEAR_RGB; - } - else - ibuf->profile = IB_PROFILE_NONE; - - IMB_rect_from_float(ibuf); + if(color_manage) { + if(ima && ima->source == IMA_SRC_VIEWER) + ibuf->profile = IB_PROFILE_LINEAR_RGB; } - BLI_unlock_thread(LOCK_CUSTOM1); + else + ibuf->profile = IB_PROFILE_NONE; + + IMB_rect_from_float(ibuf); } } diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index c0d1d251356..0d8161c9a7a 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -130,6 +130,9 @@ typedef struct RenderResult { /* for render results in Image, verify validity for sequences */ int framenr; + /* for acquire image, to indicate if it is compo/seq result */ + int compo_seq; + /* render info text */ char *text; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 2d7b724d893..f9089e7399b 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1061,6 +1061,7 @@ void RE_AcquireResultImage(Render *re, RenderResult *rr) rr->rectf= re->result->rectf; rr->rectz= re->result->rectz; rr->rect32= re->result->rect32; + rr->compo_seq= (rr->rectf != NULL); /* active layer */ rl= render_get_active_layer(re, re->result); |