Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <jeroen@blender.org>2022-02-14 12:54:21 +0300
committerJeroen Bakker <jeroen@blender.org>2022-02-14 12:54:21 +0300
commitd23cf42ba761a0d387c693f1f9d421447adc2c03 (patch)
tree9285d141ebdfc9cc322718099e51a3dd6a9e2ce0 /source/blender/draw
parentab71d833c775dce9efa25398ad3079729d404951 (diff)
Fix T95725: Changing render slot doesn't update displayed image.
Fixed by checking the requested pass, layer and view against the previous used one.
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/engines/image/image_drawing_mode.hh3
-rw-r--r--source/blender/draw/engines/image/image_instance_data.hh23
2 files changed, 26 insertions, 0 deletions
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)