Fix T73763: Laggy with nodes Editor + International Fonts

Two main reasons for the lag:
- Allocation of memory with transfer to GPU.
- BLF_cache_clear();

The memory allocation seems to be unnecessary, so I removed it.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D6837
This commit is contained in:
Germano Cavalcante 2020-02-14 11:25:41 -03:00
parent d6d44ccc77
commit a21f5ec562
Notes: blender-bot 2023-02-14 02:30:11 +01:00
Referenced by commit 12728d43f8, Revert "Fix T73763: Laggy with nodes Editor + International Fonts"
Referenced by issue #73763, Nodes Editor laggy
2 changed files with 4 additions and 5 deletions

View File

@ -265,11 +265,9 @@ static void blf_glyph_cache_texture(FontBLF *font, GlyphCacheBLF *gc)
gc->p2_height = font->tex_size_max;
}
unsigned char *pixels = MEM_callocN((size_t)gc->p2_width * (size_t)gc->p2_height,
"BLF texture init");
GPUTexture *tex = GPU_texture_create_nD(
gc->p2_width, gc->p2_height, 0, 2, pixels, GPU_R8, GPU_DATA_UNSIGNED_BYTE, 0, false, error);
MEM_freeN(pixels);
gc->p2_width, gc->p2_height, 0, 2, NULL, GPU_R8, GPU_DATA_UNSIGNED_BYTE, 0, false, error);
gc->textures[gc->texture_current] = tex;
GPU_texture_bind(tex, 0);
GPU_texture_wrap_mode(tex, false);

View File

@ -1123,7 +1123,8 @@ void UI_view2d_zoom_cache_reset(void)
/* While scaling we can accumulate fonts at many sizes (~20 or so).
* Not an issue with embedded font, but can use over 500Mb with i18n ones! See [#38244]. */
/* note: only some views draw text, we could check for this case to avoid clearning cache */
/* note: This can be very bad for performance.
* Only some views draw text, we could check for this case to avoid clearning cache. */
BLF_cache_clear();
}