[Bf-blender-cvs] [6fb4ca1eec7] master: Image Engine: Add assert to check for correct float colorspace.

Jeroen Bakker noreply at git.blender.org
Fri Dec 9 10:31:26 CET 2022


Commit: 6fb4ca1eec7e38e9755b330deb813f1059582352
Author: Jeroen Bakker
Date:   Fri Dec 9 10:08:51 2022 +0100
Branches: master
https://developer.blender.org/rB6fb4ca1eec7e38e9755b330deb813f1059582352

Image Engine: Add assert to check for correct float colorspace.

Float images loaded in Blender are converted to scene linear and don't
require additional conversion. Image engine can reuse the rect_float of
those images. An assert statement is added tp make this more clear and
to test on missing code paths or future developments.

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

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

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

diff --git a/source/blender/draw/engines/image/image_buffer_cache.hh b/source/blender/draw/engines/image/image_buffer_cache.hh
index ebd08273dca..6c1be27f9f7 100644
--- a/source/blender/draw/engines/image/image_buffer_cache.hh
+++ b/source/blender/draw/engines/image/image_buffer_cache.hh
@@ -9,6 +9,7 @@
 
 #include "BLI_vector.hh"
 
+#include "IMB_colormanagement.h"
 #include "IMB_imbuf.h"
 #include "IMB_imbuf_types.h"
 
@@ -68,6 +69,11 @@ struct FloatBufferCache {
   {
     /* Check if we can use the float buffer of the given image_buffer. */
     if (image_buffer->rect_float != nullptr) {
+      BLI_assert_msg(
+          IMB_colormanagement_space_name_is_scene_linear(
+              IMB_colormanagement_get_float_colorspace(image_buffer)),
+          "Expected rect_float to be scene_linear - if there are code paths where this "
+          "isn't the case we should convert those and add to the FloatBufferCache as well.");
       return image_buffer;
     }



More information about the Bf-blender-cvs mailing list