[Bf-blender-cvs] [bce810f0576] blender-v3.1-release: Fix T95871: Non-float textures report as float.

Jeroen Bakker noreply at git.blender.org
Mon Feb 21 07:51:10 CET 2022


Commit: bce810f05763b3ccf9f7331e96541be2df38f29b
Author: Jeroen Bakker
Date:   Mon Feb 21 07:48:49 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rBbce810f05763b3ccf9f7331e96541be2df38f29b

Fix T95871: Non-float textures report as float.

Althought the float buffers are only used as cache, current code paths
don't look at the flags to identify which kind of image it is. Actual
fix would be to check flags, but that wouldn't be something to add one
week before release.

This commit fixes it by removing the buffers after use in the image
engine.

===================================================================

M	source/blender/draw/engines/image/image_drawing_mode.hh

===================================================================

diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh b/source/blender/draw/engines/image/image_drawing_mode.hh
index 124f8057cfe..ccb0f3e963a 100644
--- a/source/blender/draw/engines/image/image_drawing_mode.hh
+++ b/source/blender/draw/engines/image/image_drawing_mode.hh
@@ -223,7 +223,7 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
       if (iterator.tile_data.tile_buffer == nullptr) {
         continue;
       }
-      ensure_float_buffer(*iterator.tile_data.tile_buffer);
+      const bool do_free_float_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);
 
@@ -330,6 +330,10 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
                                0);
         imb_freerectImbuf_all(&extracted_buffer);
       }
+
+      if (do_free_float_buffer) {
+        imb_freerectfloatImBuf(iterator.tile_data.tile_buffer);
+      }
     }
   }
 
@@ -405,10 +409,7 @@ 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;
+    const bool do_free_float_buffer = ensure_float_buffer(tile_buffer);
 
     /* 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



More information about the Bf-blender-cvs mailing list