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/blenkernel/BKE_image.h | |
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/blenkernel/BKE_image.h')
-rw-r--r-- | source/blender/blenkernel/BKE_image.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index 303945dbf64..c51a5f7e5e1 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -382,6 +382,8 @@ struct GPUTexture *BKE_image_get_gpu_tilemap(struct Image *image, bool BKE_image_has_gpu_texture_premultiplied_alpha(struct Image *image, struct ImBuf *ibuf); void BKE_image_update_gputexture( struct Image *ima, struct ImageUser *iuser, int x, int y, int w, int h); +void BKE_image_update_gputexture_delayed( + struct Image *ima, struct ImBuf *ibuf, int x, int y, int w, int h); void BKE_image_paint_set_mipmap(struct Main *bmain, bool mipmap); /* Delayed free of OpenGL buffers by main thread */ |