From 7144fdf28568e195dc639bea8828e614d7eb6f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Thu, 29 Mar 2018 20:22:31 +0200 Subject: BLF: Perf: Divide by 6 the amount of verts sent to the GPU. This means smaller imm buffer usage. This does not reduce the number of drawcalls. This uses geometry shader which is slow for the GPU but given we are really CPU bound on this case, it should not matter. A perfect implementation would: - Set the glyph coord in a bufferTexture and just send the glyph ID to the GPU to read the bufferTexture. - Use GWN_draw_primitive and draw 2*strllen triangle and just retrieve the glyph ID and color based on gl_VertexID / 6. - Stream fixed size buffer that the Driver can discard quickly but this is the same as improving IMM directly. --- source/blender/gpu/intern/gpu_shader.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/blender/gpu/intern') diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c index 44e01d42a62..586a7b70cd9 100644 --- a/source/blender/gpu/intern/gpu_shader.c +++ b/source/blender/gpu/intern/gpu_shader.c @@ -135,6 +135,7 @@ extern char datatoc_gpu_shader_edges_overlay_geom_glsl[]; extern char datatoc_gpu_shader_edges_overlay_simple_geom_glsl[]; extern char datatoc_gpu_shader_edges_overlay_frag_glsl[]; extern char datatoc_gpu_shader_text_vert_glsl[]; +extern char datatoc_gpu_shader_text_geom_glsl[]; extern char datatoc_gpu_shader_text_frag_glsl[]; extern char datatoc_gpu_shader_keyframe_diamond_vert_glsl[]; extern char datatoc_gpu_shader_keyframe_diamond_frag_glsl[]; @@ -649,7 +650,9 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader) [GPU_SHADER_SMOKE_FIRE] = { datatoc_gpu_shader_smoke_vert_glsl, datatoc_gpu_shader_smoke_frag_glsl }, [GPU_SHADER_SMOKE_COBA] = { datatoc_gpu_shader_smoke_vert_glsl, datatoc_gpu_shader_smoke_frag_glsl }, - [GPU_SHADER_TEXT] = { datatoc_gpu_shader_text_vert_glsl, datatoc_gpu_shader_text_frag_glsl }, + [GPU_SHADER_TEXT] = { datatoc_gpu_shader_text_vert_glsl, + datatoc_gpu_shader_text_frag_glsl, + datatoc_gpu_shader_text_geom_glsl }, [GPU_SHADER_KEYFRAME_DIAMOND] = { datatoc_gpu_shader_keyframe_diamond_vert_glsl, datatoc_gpu_shader_keyframe_diamond_frag_glsl }, [GPU_SHADER_EDGES_FRONT_BACK_PERSP] = { datatoc_gpu_shader_edges_front_back_persp_vert_glsl, -- cgit v1.2.3