diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-03-30 20:16:14 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-03-30 21:09:26 +0300 |
commit | ab9adf9cdc3b2fd91dcade32ea4b4359f4897392 (patch) | |
tree | 1f9e12d6a24fa1f74cfc4ab595ac1680d0202433 /source/blender/blenfont/intern/blf_internal_types.h | |
parent | 8568d38f1b0858a3138b72698babd6ba7b65d6b3 (diff) |
BLF: Use Batch API instead of IMM.
This is not a perfect win just yet. It's now calling glBufferSubData for
every call (instead of using glMapBufferRange which is almost faster), but
with this system we will be able to batch drawcalls together.
See next commit.
Diffstat (limited to 'source/blender/blenfont/intern/blf_internal_types.h')
-rw-r--r-- | source/blender/blenfont/intern/blf_internal_types.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h index 9164a02b2cc..360aae47dd0 100644 --- a/source/blender/blenfont/intern/blf_internal_types.h +++ b/source/blender/blenfont/intern/blf_internal_types.h @@ -31,6 +31,24 @@ #ifndef __BLF_INTERNAL_TYPES_H__ #define __BLF_INTERNAL_TYPES_H__ +#include "../../../intern/gawain/gawain/gwn_vertex_buffer.h" + +#define BLF_BATCHING_SIZE 2048 /* in glyph */ + +typedef struct BatchBLF{ + struct FontBLF *font; /* can only batch glyph from the same font */ + struct Gwn_Batch *batch; + struct Gwn_VertBuf *verts; + struct Gwn_VertBufRaw pos_step, tex_step, col_step; + unsigned int pos_loc, tex_loc, col_loc; + unsigned int glyph_ct; + float ofs[2]; /* copy of font->pos */ + float mat[4][4]; /* to catch bad usage */ + bool enabled; +} BatchBLF; + +extern BatchBLF g_batch; + typedef struct GlyphCacheBLF { struct GlyphCacheBLF *next; struct GlyphCacheBLF *prev; |