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.
This commit is contained in:
Jeroen Bakker 2022-12-09 10:08:51 +01:00
parent 9785f84dd2
commit 6fb4ca1eec
1 changed files with 6 additions and 0 deletions

View File

@ -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;
}