diff options
author | Jeroen Bakker <jeroen@blender.org> | 2022-02-04 17:28:48 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-02-04 17:32:28 +0300 |
commit | 2e766ff7624349b65a5d908dc3895ad10b240050 (patch) | |
tree | a423c7f8441ca8aaa588544e14043d011faf9859 /source/blender/draw/engines/image/image_drawing_mode.hh | |
parent | 080dd18cdf8768ff61955d9cb5e5d02de5eb28d2 (diff) |
Image Editor: Fix slowdown with 8b colormanaged images.
Byte images are converted to float. Due to an issue how VSE cache is
freeing its images we cannot store these float buffers what leads
to recalculating it for each change in the image editor.
This fix will reduce the slowdown to areas that have the root cause of
the memory leak, so the buffers can be reused between refreshes.
NOTE: The root cause should still be fixed.
Thanks for reporting Sybren!
Diffstat (limited to 'source/blender/draw/engines/image/image_drawing_mode.hh')
-rw-r--r-- | source/blender/draw/engines/image/image_drawing_mode.hh | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh b/source/blender/draw/engines/image/image_drawing_mode.hh index 16d3ff30890..b56f3062901 100644 --- a/source/blender/draw/engines/image/image_drawing_mode.hh +++ b/source/blender/draw/engines/image/image_drawing_mode.hh @@ -231,7 +231,7 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD if (iterator.tile_data.tile_buffer == nullptr) { continue; } - const bool float_buffer_created = ensure_float_buffer(*iterator.tile_data.tile_buffer); + ensure_float_buffer(*iterator.tile_data.tile_buffer); const float tile_width = static_cast<float>(iterator.tile_data.tile_buffer->x); const float tile_height = static_cast<float>(iterator.tile_data.tile_buffer->y); @@ -338,10 +338,6 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD 0); imb_freerectImbuf_all(&extracted_buffer); } - /* TODO(jbakker): Find leak when rendering VSE and remove this call. */ - if (float_buffer_created) { - imb_freerectfloatImBuf(iterator.tile_data.tile_buffer); - } } } @@ -419,6 +415,9 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD const int texture_width = texture_buffer.x; const int texture_height = texture_buffer.y; const bool float_buffer_created = ensure_float_buffer(tile_buffer); + /* TODO(jbakker): Find leak when rendering VSE and don't free here. */ + const bool do_free_float_buffer = float_buffer_created && + instance_data.image->type == IMA_TYPE_R_RESULT; /* IMB_transform works in a non-consistent space. This should be documented or fixed!. * Construct a variant of the info_uv_to_texture that adds the texel space @@ -456,8 +455,7 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD uv_to_texel, crop_rect_ptr); - /* TODO(jbakker): Find leak when rendering VSE and remove this call. */ - if (float_buffer_created) { + if (do_free_float_buffer) { imb_freerectfloatImBuf(&tile_buffer); } } |