Page MenuHome

Fix T90825: Performance texture painting with limited scale.
ClosedPublic

Authored by Jeroen Bakker (jbakker) on Sep 3 2021, 11:59 AM.
Subscribers
None
Tokens
"Like" token, awarded by hitrpr."Love" token, awarded by PrettyFireNOI7."Love" token, awarded by kivig."Love" token, awarded by DiogoX2."Love" token, awarded by pablovazquez.

Details

Summary

Improve texture painting/uv editing performance when limited scale is active.
Cause of the slow down is that the image editor draws the image in maximum resolution,
but the 3d viewport uses the limited scale. The variation reuses the same GPU texture
and needed to be uploaded/scaled twice to the GPU.

This patch will adds texture slots that can hold the scaled down and the maximum
resolution image. This would allow better cache hits and reuse of existing caches.

Maximum resolution textures are reused for limited scale when they fit to reduce memory
and CPU footprint.

Diff Detail

Repository
rB Blender
Branch
arcpatch-D12388 (branched from master)
Build Status
Buildable 16864
Build 16864: arc lint + arc unit

Event Timeline

Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
  • Cleanup: Renamed GPU_TEXTURE to IMA_TEXTURE_SLOT.
  • Cleanup: Renamed resolution to slot.
  • ImageTile_runtime per texture slot.
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Sep 6 2021, 3:18 PM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Sep 6 2021, 3:45 PM
  • Cleanup: Renamed GPU_TEXTURE to IMA_TEXTURE_SLOT.
  • Cleanup: Renamed resolution to slot.
  • ImageTile_runtime per texture slot.
  • Reuse max resolution textures when they fit inside the limited scale.
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Sep 6 2021, 6:07 PM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Sep 7 2021, 8:16 AM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
  • Cleanup: TEXTURE_SLOT => SIZE_VARIATION

Future developments.

image_gpu.c would benefit from CPP due to the nested loops would also reduce some complexity.
For rendering in the image editor we should draw each pixel of the image. Currently when images are to large they will be scaled down. This would eventually need a different API and perhaps a different variation.

Jeroen Bakker (jbakker) requested review of this revision.Sep 7 2021, 8:49 AM
Clément Foucault (fclem) requested changes to this revision.Sep 7 2021, 7:40 PM

Seems to be the good thing to do to fix the issue. I'm just not sold on the naming used. But feature wise it's good to go.

source/blender/blenkernel/intern/image_gpu.c
552–563

A bit of the same issue here variation_index is a bit of a strange name since you iterate over TEXTURE_SIZE.

As I suggest to rename the enum, the variation_index would just become resolution_index, res_index , res or resolution. Since the usage is really local I don't see any issue with being a bit more concise.

1007

Nitpick: _index is a pretty redundant here.

source/blender/makesdna/DNA_image_types.h
142

Rename to eImageTextureResolution

143–144
147

or IMA_TEXTURE_RESOLUTION_COUNT

This revision now requires changes to proceed.Sep 7 2021, 7:40 PM
Jeroen Bakker (jbakker) marked 5 inline comments as done.
  • Cleanup: Rename vars/enums/attributes based on code review.
This revision is now accepted and ready to land.Sep 8 2021, 9:10 AM