This patch introduces a partial update of GPUTextures of Images. When rendering a large image the GPUTexture could have been scaled. The old implementation would rescale the image and create a new GPUTexture. This solution would only scale and upload the part that has been changed.
The check for requested render slot isn't working in this scenario so it was replaced by correct IMA_GPU_REFRESH tagging.
Performance
Test situation: Default Cube, 4 samples, 19200x10800 tile size 512.
Blender 2.83.9: 4m27s.
This patch: 1m01s.
Patch still needs to be cleaned:
- the interface of image_buffer_calc_imbuf_rect is a bit confusing as it was extracted from image_buffer_rect_update without looking to much into its use.
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.