diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-05-06 17:44:18 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-05-06 17:44:18 +0300 |
commit | 92d0ed30008440c9e4766769e8248b0e0befecae (patch) | |
tree | d35f53e816a468c98529b8ff4472fa75c3d26a5f /source/blender/draw/engines | |
parent | 26d375467b955f5fb4376c221e659ac8c14ece69 (diff) | |
parent | a7417ba84527d57391599d26a1872c035c5e2c48 (diff) |
Merge branch 'blender-v3.2-release'
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r-- | source/blender/draw/engines/image/image_instance_data.hh | 6 | ||||
-rw-r--r-- | source/blender/draw/engines/image/image_texture_info.hh | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/draw/engines/image/image_instance_data.hh b/source/blender/draw/engines/image/image_instance_data.hh index cb84c7f14ad..358e6fd3bd9 100644 --- a/source/blender/draw/engines/image/image_instance_data.hh +++ b/source/blender/draw/engines/image/image_instance_data.hh @@ -75,8 +75,10 @@ struct IMAGE_InstanceData { TextureInfo &info = texture_infos[i]; const bool is_allocated = info.texture != nullptr; const bool is_visible = info.visible; - const bool should_be_freed = !is_visible && is_allocated; - const bool should_be_created = is_visible && !is_allocated; + const bool resolution_changed = assign_if_different(info.last_viewport_size, + float2(DRW_viewport_size_get())); + const bool should_be_freed = is_allocated && (!is_visible || resolution_changed); + const bool should_be_created = is_visible && (!is_allocated || resolution_changed); if (should_be_freed) { GPU_texture_free(info.texture); diff --git a/source/blender/draw/engines/image/image_texture_info.hh b/source/blender/draw/engines/image/image_texture_info.hh index cd51cdaff3c..9a75941c533 100644 --- a/source/blender/draw/engines/image/image_texture_info.hh +++ b/source/blender/draw/engines/image/image_texture_info.hh @@ -46,6 +46,8 @@ struct TextureInfo { */ GPUTexture *texture; + float2 last_viewport_size = float2(0.0f, 0.0f); + ~TextureInfo() { if (batch != nullptr) { |