Page MenuHome

Possible fix for T73763: Laggy with nodes Editor + International Fonts

Authored by Germano Cavalcante (mano-wii) on Thu, Feb 13, 4:25 PM.



Two main reasons for the lag:

  • Memory allocation and transfer to GPU.
  • BLF_cache_clear();

The memory allocation can be avoided in some setups.
The other reason (BLF_cache_clear) I decided not to touch. It was added here rBd358f1f9e7c1

Diff Detail

rB Blender

Event Timeline

It only solves a small part of the problem, but's it's a good change.

Probably there is some room for optimization in the code that creates the cache. The cache clearing could be made smarter with some kind of garbage collection of unused font sizes, rather than clearing the cache entirely.

Alternatively, we could try not clearing the cache at all until the zoom operation is completed, and somehow draw the glyphs scaled during zoom (even if that gives some pixelation).

This revision is now accepted and ready to land.Fri, Feb 14, 2:34 PM
This revision is now accepted and ready to land.Sat, Feb 15, 2:32 PM
  • Add GPU support to fill a texture image with a constant value
  • Fix memset --> memcpy

I ran a profile for this in the context of D6854: UI: always use international font. For me the bottleneck is in GPU_texture_update_sub that calls glTexSubImage, which seems to be called for every individual glyph.

Since we usually batch drawing of text, perhaps the glyph update could be batched as well so we call glTexSubImage at most once per batch? We could also add all ASCII characters immediately to the font, but this doesn't help for all languages.