[Bf-blender-cvs] [d23cf42ba76] blender-v3.1-release: Fix T95725: Changing render slot doesn't update displayed image.
Jeroen Bakker
noreply at git.blender.org
Mon Feb 14 10:56:46 CET 2022
Commit: d23cf42ba761a0d387c693f1f9d421447adc2c03
Author: Jeroen Bakker
Date: Mon Feb 14 10:54:21 2022 +0100
Branches: blender-v3.1-release
https://developer.blender.org/rBd23cf42ba761a0d387c693f1f9d421447adc2c03
Fix T95725: Changing render slot doesn't update displayed image.
Fixed by checking the requested pass, layer and view against the
previous used one.
===================================================================
M source/blender/draw/engines/image/image_drawing_mode.hh
M source/blender/draw/engines/image/image_instance_data.hh
===================================================================
diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh b/source/blender/draw/engines/image/image_drawing_mode.hh
index 0aaf0ca9f24..0c638ef15c2 100644
--- a/source/blender/draw/engines/image/image_drawing_mode.hh
+++ b/source/blender/draw/engines/image/image_drawing_mode.hh
@@ -474,6 +474,9 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
method.update_screen_space_bounds(region);
method.update_screen_uv_bounds();
+ // Check for changes in the image user compared to the last time.
+ instance_data->update_image_user(iuser);
+
// Step: Update the GPU textures based on the changes in the image.
instance_data->update_gpu_texture_allocations();
update_textures(*instance_data, image, iuser);
diff --git a/source/blender/draw/engines/image/image_instance_data.hh b/source/blender/draw/engines/image/image_instance_data.hh
index 77b771a9110..a2367c687b5 100644
--- a/source/blender/draw/engines/image/image_instance_data.hh
+++ b/source/blender/draw/engines/image/image_instance_data.hh
@@ -40,6 +40,8 @@ constexpr int SCREEN_SPACE_DRAWING_MODE_TEXTURE_LEN = 1;
struct IMAGE_InstanceData {
struct Image *image;
+ /** Copy of the last image user to detect iuser differences that require a full update. */
+ struct ImageUser last_image_user;
PartialImageUpdater partial_update;
@@ -108,6 +110,27 @@ struct IMAGE_InstanceData {
}
}
+ void update_image_user(const ImageUser *image_user)
+ {
+ short requested_pass = image_user ? image_user->pass : 0;
+ short requested_layer = image_user ? image_user->layer : 0;
+ short requested_view = image_user ? image_user->multi_index : 0;
+ /* There is room for 2 multiview textures. When a higher number is requested we should always
+ * target the first view slot. This is fine as multi view images aren't used together. */
+ if (requested_view < 2) {
+ requested_view = 0;
+ }
+
+ if (last_image_user.pass != requested_pass || last_image_user.layer != requested_layer ||
+ last_image_user.multi_index != requested_view) {
+
+ last_image_user.pass = requested_pass;
+ last_image_user.layer = requested_layer;
+ last_image_user.multi_index = requested_view;
+ reset_dirty_flag(true);
+ }
+ }
+
private:
/** \brief Set dirty flag of all texture slots to the given value. */
void reset_dirty_flag(bool new_value)
More information about the Bf-blender-cvs
mailing list