Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-01-01 14:59:38 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2014-01-01 20:32:47 +0400
commit71f689843d13b86fad26ab07867ea70fed80c1e7 (patch)
treeeb69767db07596b9148666fb242a3fb9b756482b /source/blender/blenkernel/intern/image.c
parent549248f64beaa9f8ffe9ff2e55939ac4f0c23259 (diff)
Fix deadlock happening when using Save Buffers for render
Summary: Issue was caused by the same tile being written twice to the EXR file. This was happening because of partial update of work-in-progress tiles was merging result to the final render result in order to make color management pipeline happy. We need to avoid such a merges and keep memory usage as low as possible when Save Buffers is enabled. Now render pipeline will allocate special display buffer in render layer which will contain combined pass in the display space. This keeps memory usage as low as we can do at this moment. There's one weak thing which is changing color management settings during rendering would lead to lossy conversion. This is because render result's display buffer uses color space from the time when rendering was invoked. This is actually what was happening in previous release already actually so not a big issue. Reviewers: brecht Reviewed By: brecht Differential Revision: https://developer.blender.org/D162
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r--source/blender/blenkernel/intern/image.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 3d59b719ca0..288443db650 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -2773,6 +2773,7 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
int channels, layer, pass;
ImBuf *ibuf;
int from_render = (ima->render_slot == ima->last_render_slot);
+ bool byte_buffer_in_display_space = false;
if (!(iuser && iuser->scene))
return NULL;
@@ -2835,6 +2836,13 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
/* there's no combined pass, is in renderlayer itself */
if (pass == 0) {
rectf = rl->rectf;
+ if (rectf == NULL) {
+ /* Happens when Save Buffers is enabled.
+ * Use display buffer stored in the render layer.
+ */
+ rect = (unsigned int *) rl->display_buffer;
+ byte_buffer_in_display_space = true;
+ }
}
else {
rpass = BLI_findlink(&rl->passes, pass - 1);
@@ -2859,6 +2867,27 @@ static ImBuf *image_get_render_result(Image *ima, ImageUser *iuser, void **lock_
image_assign_ibuf(ima, ibuf, IMA_NO_INDEX, 0);
}
+ /* Set color space settings for a byte buffer.
+ *
+ * This is mainly to make it so color management treats byte buffer
+ * from render result with Save Buffers enabled as final display buffer
+ * and doesnt' apply any color management on it.
+ *
+ * For other cases we need to be sure it stays to default byte buffer space.
+ */
+ if (ibuf->rect != rect) {
+ if (byte_buffer_in_display_space) {
+ const char *colorspace =
+ IMB_colormanagement_get_display_colorspace_name(&iuser->scene->view_settings,
+ &iuser->scene->display_settings);
+ IMB_colormanagement_assign_rect_colorspace(ibuf, colorspace);
+ }
+ else {
+ const char *colorspace = IMB_colormanagement_role_colorspace_name_get(COLOR_ROLE_DEFAULT_BYTE);
+ IMB_colormanagement_assign_rect_colorspace(ibuf, colorspace);
+ }
+ }
+
/* invalidate color managed buffers if render result changed */
BLI_lock_thread(LOCK_COLORMANAGE);
if (ibuf->x != rres.rectx || ibuf->y != rres.recty || ibuf->rect_float != rectf) {