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/makesrna | |
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/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_image.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 2373045d95a..cf4b343e2f7 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -598,6 +598,7 @@ static void rna_render_slots_active_set(PointerRNA *ptr, int index = BLI_findindex(&image->renderslots, slot); if (index != -1) { image->render_slot = index; + image->gpuflag |= IMA_GPU_REFRESH; } } } @@ -613,6 +614,7 @@ static void rna_render_slots_active_index_set(PointerRNA *ptr, int value) Image *image = (Image *)ptr->owner_id; int num_slots = BLI_listbase_count(&image->renderslots); image->render_slot = value; + image->gpuflag |= IMA_GPU_REFRESH; CLAMP(image->render_slot, 0, num_slots - 1); } |