diff options
author | Jeroen Bakker <jeroen@blender.org> | 2020-12-18 11:15:55 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2020-12-18 11:18:44 +0300 |
commit | 4f9e21bdc9772603acc0ba6727da9dd67287ac0f (patch) | |
tree | 4fbfce2561953060be0bca60aed073f71ad1eed2 /source/blender/editors/space_image/image_edit.c | |
parent | 095b69361403bacd322172d6293b0faeee40b44e (diff) |
Fix T82591: Performance regression when rendering at very high resolution
This patch introduces a partial update of GPUTexture. When rendering
a large image the GPUTexture could have been scaled. The old implementation
would rescale the image on CPU and create a new GPUTexture. This
resulted in flooding the PCI bus.
The new solution would only scale and upload the parts of the GPUTexture
that has been changed. It does this by keeping track of areas of 256x256
pixels. When something changes the tiles that cover that changes will be
rescaled and uploaded the next time the GPUTexture is requested.
Test situation: Default Cube, 4 samples, 19200x10800 tile size 512.
Blender 2.83.9: 4m27s.
Blender 2.91: 20+m (regression)
This patch: 1m01s.
There is still room for more optimizations:
* Reduce the time that an image is locked.
** Use task scheduling to update the tiles of an image.
** Generic optimization of the ImBuf scale method.
Maniphest Tasks: T82591
Differential Revision: https://developer.blender.org/D9591
Diffstat (limited to 'source/blender/editors/space_image/image_edit.c')
-rw-r--r-- | source/blender/editors/space_image/image_edit.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index 180f1fb183c..c26f92c5463 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -407,6 +407,9 @@ bool ED_image_slot_cycle(struct Image *image, int direction) image->render_slot = ((cur == 1) ? 0 : 1); } + if ((cur != image->render_slot)) { + image->gpuflag |= IMA_GPU_REFRESH; + } return (cur != image->render_slot); } |