[Bf-blender-cvs] [709b19c1b06] temp-gpu-texture-partial-updates: Fix performance issue when requesting gpu textures.

Jeroen Bakker noreply at git.blender.org
Fri Nov 19 15:23:18 CET 2021


Commit: 709b19c1b06b55a4740f3472ff08feb73be75521
Author: Jeroen Bakker
Date:   Fri Nov 19 14:36:34 2021 +0100
Branches: temp-gpu-texture-partial-updates
https://developer.blender.org/rB709b19c1b06b55a4740f3472ff08feb73be75521

Fix performance issue when requesting gpu textures.

===================================================================

M	source/blender/blenkernel/intern/image_gpu.c
M	source/blender/blenkernel/intern/image_partial_update.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/image_gpu.c b/source/blender/blenkernel/intern/image_gpu.c
index c980d945946..9e9e4121fda 100644
--- a/source/blender/blenkernel/intern/image_gpu.c
+++ b/source/blender/blenkernel/intern/image_gpu.c
@@ -371,7 +371,7 @@ static GPUTexture *image_get_gpu_texture(Image *ima,
   }
 
   ImageTile *tile = BKE_image_get_tile(ima, 0);
-  if (tile == NULL || ibuf == NULL) {
+  if (tile == NULL || ibuf_intern == NULL) {
     ima->gpuflag |= IMA_GPU_REFRESH;
   }
 
@@ -433,7 +433,7 @@ static GPUTexture *image_get_gpu_texture(Image *ima,
                                                          IMA_TEXTURE_RESOLUTION_FULL;
   GPUTexture **tex = get_image_gpu_texture_ptr(ima, textarget, current_view, texture_resolution);
   if (*tex) {
-    if (ibuf == NULL) {
+    if (ibuf != ibuf_intern) {
       BKE_image_release_ibuf(ima, ibuf_intern, NULL);
     }
     return *tex;
@@ -443,7 +443,7 @@ static GPUTexture *image_get_gpu_texture(Image *ima,
    * texture with zero bind-code so we don't keep trying. */
   if (tile == NULL) {
     *tex = image_gpu_texture_error_create(textarget);
-    if (ibuf == NULL) {
+    if (ibuf != ibuf_intern) {
       BKE_image_release_ibuf(ima, ibuf_intern, NULL);
     }
     return *tex;
@@ -496,15 +496,14 @@ static GPUTexture *image_get_gpu_texture(Image *ima,
       break;
   }
 
-  /* if `ibuf` was given, we don't own the `ibuf_intern` */
-  if (ibuf == NULL) {
-    BKE_image_release_ibuf(ima, ibuf_intern, NULL);
-  }
-
   if (*tex) {
     GPU_texture_orig_size_set(*tex, ibuf_intern->x, ibuf_intern->y);
   }
 
+  if (ibuf != ibuf_intern) {
+    BKE_image_release_ibuf(ima, ibuf_intern, NULL);
+  }
+
   return *tex;
 }
 
diff --git a/source/blender/blenkernel/intern/image_partial_update.cc b/source/blender/blenkernel/intern/image_partial_update.cc
index 63e6ef7feb2..6ba769d9741 100644
--- a/source/blender/blenkernel/intern/image_partial_update.cc
+++ b/source/blender/blenkernel/intern/image_partial_update.cc
@@ -406,6 +406,7 @@ struct PartialUpdateRegisterImpl {
       return;
     }
     history.remove(0, num_items_to_remove);
+    first_changeset_id += num_items_to_remove;
   }
 
   /**



More information about the Bf-blender-cvs mailing list