diff options
author | Sergey Sharybin <sergey@blender.org> | 2021-08-04 16:37:18 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2021-08-24 17:20:57 +0300 |
commit | 038f9b7f4a0e58da671079fd09aecdb926f12b0f (patch) | |
tree | 11e1ed18297d3cd006262b265f72489c2b09c3dd /source/blender/editors/space_image/image_edit.c | |
parent | 7aff40f410f4bb869c8045a67cda6a6ab6810a13 (diff) |
Render: Lazily allocate render passes pixels storage
The idea is to only allocate pixel storage only when there is an actual
data to be written to them.
This moves the code forward a better support of high-res rendering when
pixel storage is not allocated until render engine is ready to provide
pixel data.
Is expected to be no functional changes for neither users no external
engines. The only difference is that the motion and depth passes will
be displayed as transparent for until render engine provides any tile
result (at which point the pixels will be allocated and initialized to
infinite depth).
Differential Revision: https://developer.blender.org/D12195
Diffstat (limited to 'source/blender/editors/space_image/image_edit.c')
-rw-r--r-- | source/blender/editors/space_image/image_edit.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index 169dafcb8d0..a95189a303f 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -139,8 +139,10 @@ ImBuf *ED_space_image_acquire_buffer(SpaceImage *sima, void **r_lock, int tile) ImBuf *ibuf; if (sima && sima->image) { + const Image *image = sima->image; + #if 0 - if (sima->image->type == IMA_TYPE_R_RESULT && BIF_show_render_spare()) { + if (image->type == IMA_TYPE_R_RESULT && BIF_show_render_spare()) { return BIF_render_spare_imbuf(); } else @@ -152,6 +154,12 @@ ImBuf *ED_space_image_acquire_buffer(SpaceImage *sima, void **r_lock, int tile) } if (ibuf) { + if (image->type == IMA_TYPE_R_RESULT && ibuf->x != 0 && ibuf->y != 0) { + /* Render result might be lazily allocated. Return ibuf without buffers to indicate that + * there is image buffer but it has no data yet. */ + return ibuf; + } + if (ibuf->rect || ibuf->rect_float) { return ibuf; } |