diff options
Diffstat (limited to 'source/blender/draw/engines/image/image_instance_data.hh')
-rw-r--r-- | source/blender/draw/engines/image/image_instance_data.hh | 23 |
1 files changed, 23 insertions, 0 deletions
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) |