[Bf-blender-cvs] [ff280aba1b5] temp-image-engine: Cleanup: renamed ensure_float_buffer to cached_float_buffer and remove wrapper function.
Jeroen Bakker
noreply at git.blender.org
Wed Dec 7 14:28:45 CET 2022
Commit: ff280aba1b5aa04bb0a3e6567baf8a455f04c8fc
Author: Jeroen Bakker
Date: Wed Dec 7 08:41:43 2022 +0100
Branches: temp-image-engine
https://developer.blender.org/rBff280aba1b5aa04bb0a3e6567baf8a455f04c8fc
Cleanup: renamed ensure_float_buffer to cached_float_buffer and remove wrapper function.
===================================================================
M release/datafiles/locale
M release/scripts/addons
M source/blender/draw/engines/image/image_buffer_cache.hh
M source/blender/draw/engines/image/image_drawing_mode.hh
===================================================================
diff --git a/release/datafiles/locale b/release/datafiles/locale
index 4a581c54af9..e398d3c4969 160000
--- a/release/datafiles/locale
+++ b/release/datafiles/locale
@@ -1 +1 @@
-Subproject commit 4a581c54af9b92cb670d750951b9382160f10f3e
+Subproject commit e398d3c4969a37ae2ecff388344dd780bc1cfe82
diff --git a/release/scripts/addons b/release/scripts/addons
index 0b0052bd53a..90c87dd771e 160000
--- a/release/scripts/addons
+++ b/release/scripts/addons
@@ -1 +1 @@
-Subproject commit 0b0052bd53ad8249ed07dfb87705c338af698bde
+Subproject commit 90c87dd771e027e0ffa157a0e294399bfd605d99
diff --git a/source/blender/draw/engines/image/image_buffer_cache.hh b/source/blender/draw/engines/image/image_buffer_cache.hh
index 470e9f225b4..266476cf8aa 100644
--- a/source/blender/draw/engines/image/image_buffer_cache.hh
+++ b/source/blender/draw/engines/image/image_buffer_cache.hh
@@ -49,12 +49,26 @@ struct FloatImageBuffer {
}
};
+/**
+ * \brief Float buffer cache for image buffers.
+ *
+ * Image buffers might not have float buffers which are required for the image engine.
+ * Image buffers are not allowed to have both a float buffer and a byte buffer as some
+ * functionality doesn't know what to do.
+ *
+ * For this reason we store the float buffer in separate image buffers. The FloatBufferCache keep
+ * track of the cached buffers and if they are still used.
+ *
+ * TODO: When an image buffer has a float buffer but not stored in scene linear, it currently
+ * doesn't apply color management. In this case we still need to create another float buffer, but
+ * with the buffer converted to scene linear.
+ */
struct FloatBufferCache {
private:
blender::Vector<FloatImageBuffer> cache_;
public:
- ImBuf *ensure_float_buffer(ImBuf *image_buffer)
+ ImBuf *cached_float_buffer(ImBuf *image_buffer)
{
/* Check if we can use the float buffer of the given image_buffer. */
if (image_buffer->rect_float != nullptr) {
diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh b/source/blender/draw/engines/image/image_drawing_mode.hh
index 15c8600a5cb..48c68f12922 100644
--- a/source/blender/draw/engines/image/image_drawing_mode.hh
+++ b/source/blender/draw/engines/image/image_drawing_mode.hh
@@ -265,7 +265,8 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
if (iterator.tile_data.tile_buffer == nullptr) {
continue;
}
- ImBuf *tile_buffer = ensure_float_buffer(instance_data, iterator.tile_data.tile_buffer);
+ ImBuf *tile_buffer = instance_data.float_buffers.cached_float_buffer(
+ iterator.tile_data.tile_buffer);
if (tile_buffer != iterator.tile_data.tile_buffer) {
do_partial_update_float_buffer(tile_buffer, iterator);
}
@@ -421,19 +422,6 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
imb_freerectImbuf_all(&texture_buffer);
}
- /**
- * \brief Ensure that the float buffer of the given image buffer is available.
- *
- * Returns true when a float buffer was created. Somehow the sequencer cache increases the ref
- * counter, but might use a different mechanism for destructing the image, that doesn't free the
- * rect_float as the reference-counter isn't 0. To work around this we destruct any created local
- * buffers ourself.
- */
- ImBuf *ensure_float_buffer(IMAGE_InstanceData &instance_data, ImBuf *image_buffer) const
- {
- return instance_data.float_buffers.ensure_float_buffer(image_buffer);
- }
-
/**
* texture_buffer is the image buffer belonging to the texture_info.
* tile_buffer is the image buffer of the tile.
@@ -446,7 +434,7 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
{
const int texture_width = texture_buffer.x;
const int texture_height = texture_buffer.y;
- ImBuf *float_tile_buffer = ensure_float_buffer(instance_data, &tile_buffer);
+ ImBuf *float_tile_buffer = instance_data.float_buffers.cached_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