Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormano-wii <germano.costa@ig.com.br>2020-02-15 18:18:43 +0300
committermano-wii <germano.costa@ig.com.br>2020-02-15 18:18:52 +0300
commit0feb03e680d680c3b8eba0327f74c4fa1f49c6fa (patch)
tree334334b6071b7f60096d97df9ab72c50e85961d9 /source/blender/blenfont
parent738bb309f9490c4d6e056e7df8ff9a6e60ad45df (diff)
Fix T73763: Laggy when zooming a node editor with International Fonts
Two main reasons for the lag: - Allocation of memory with transfer to GPU. - BLF_cache_clear(); The (partial) solution is to avoid memory allocating in some setups through the `GPU_texture_clear`. Differential Revision: https://developer.blender.org/D6837
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 535366b78fa..80d43a49e77 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -265,16 +265,16 @@ 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->textures[gc->texture_current] = tex;
+ gc->p2_width, gc->p2_height, 0, 2, NULL, GPU_R8, GPU_DATA_UNSIGNED_BYTE, 0, false, error);
+
GPU_texture_bind(tex, 0);
GPU_texture_wrap_mode(tex, false);
GPU_texture_filters(tex, GPU_NEAREST, GPU_LINEAR);
+ GPU_texture_clear(tex, GPU_DATA_UNSIGNED_BYTE, NULL);
GPU_texture_unbind(tex);
+
+ gc->textures[gc->texture_current] = tex;
}
GlyphBLF *blf_glyph_search(GlyphCacheBLF *gc, unsigned int c)