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:
authorCampbell Barton <ideasman42@gmail.com>2018-03-31 14:09:03 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-03-31 14:11:38 +0300
commit0ef38879b3adc200f65b24ab11e1134c6eeec161 (patch)
treebfa8220d514ccd55f332451039687de29d08fc31 /source/blender/blenfont
parent8b74741b9e1b8ac2cead829a3ca2621bb5950865 (diff)
Cleanup: BLF batch drawing naming
- batching -> batch_draw. - ct & size -> len. - start/end -> begin/end (follow GL convention).
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/BLF_api.h4
-rw-r--r--source/blender/blenfont/intern/blf.c8
-rw-r--r--source/blender/blenfont/intern/blf_font.c44
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c6
-rw-r--r--source/blender/blenfont/intern/blf_internal.h6
-rw-r--r--source/blender/blenfont/intern/blf_internal_types.h4
6 files changed, 36 insertions, 36 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index f9841c83163..3466f1665c6 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -97,8 +97,8 @@ void BLF_matrix(int fontid, const float m[16]);
/* Batch drawcalls together as long as
* the modelview matrix and the font remain unchanged. */
-void BLF_batching_start(void);
-void BLF_batching_end(void);
+void BLF_batch_draw_begin(void);
+void BLF_batch_draw_end(void);
/* Draw the string using the default font, size and dpi. */
void BLF_draw_default(float x, float y, float z, const char *str, size_t len) ATTR_NONNULL();
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 2407abdaf28..64a9f1739fd 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -134,7 +134,7 @@ void BLF_exit(void)
void BLF_batch_reset(void)
{
- blf_batching_vao_clear();
+ blf_batch_draw_vao_clear();
}
void BLF_cache_clear(void)
@@ -540,16 +540,16 @@ void BLF_color3f(int fontid, float r, float g, float b)
BLF_color4fv(fontid, rgba);
}
-void BLF_batching_start(void)
+void BLF_batch_draw_begin(void)
{
BLI_assert(g_batch.enabled == false);
g_batch.enabled = true;
}
-void BLF_batching_end(void)
+void BLF_batch_draw_end(void)
{
BLI_assert(g_batch.enabled == true);
- blf_batching_draw(); /* Draw remaining glyphs */
+ blf_batch_draw(); /* Draw remaining glyphs */
g_batch.enabled = false;
}
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 745cd142467..2793689ff39 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -87,7 +87,7 @@ static SpinLock ft_lib_mutex;
* group some strings together and render them in one drawcall. This behaviour
* is on demand only, between BLF_batch_start() and BLF_batch_end().
**/
-static void blf_batching_init(void)
+static void blf_batch_draw_init(void)
{
Gwn_VertFormat format = {0};
g_batch.pos_loc = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
@@ -95,32 +95,32 @@ static void blf_batching_init(void)
g_batch.col_loc = GWN_vertformat_attr_add(&format, "col", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
g_batch.verts = GWN_vertbuf_create_with_format_ex(&format, GWN_USAGE_STREAM);
- GWN_vertbuf_data_alloc(g_batch.verts, BLF_BATCHING_SIZE);
+ GWN_vertbuf_data_alloc(g_batch.verts, BLF_BATCH_DRAW_LEN_MAX);
GWN_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.pos_loc, &g_batch.pos_step);
GWN_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.tex_loc, &g_batch.tex_step);
GWN_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.col_loc, &g_batch.col_step);
- g_batch.glyph_ct = 0;
+ g_batch.glyph_len = 0;
g_batch.batch = GWN_batch_create_ex(GWN_PRIM_POINTS, g_batch.verts, NULL, GWN_BATCH_OWNS_VBO);
}
-static void blf_batching_exit(void)
+static void blf_batch_draw_exit(void)
{
GWN_BATCH_DISCARD_SAFE(g_batch.batch);
}
-void blf_batching_vao_clear(void)
+void blf_batch_draw_vao_clear(void)
{
if (g_batch.batch) {
gwn_batch_vao_cache_clear(g_batch.batch);
}
}
-void blf_batching_start(FontBLF *font)
+void blf_batch_draw_begin(FontBLF *font)
{
if (g_batch.batch == NULL) {
- blf_batching_init();
+ blf_batch_draw_init();
}
const bool font_changed = (g_batch.font != font);
@@ -153,7 +153,7 @@ void blf_batching_start(FontBLF *font)
/* flush cache if config is not the same. */
if (mat_changed || font_changed || shader_changed) {
- blf_batching_draw();
+ blf_batch_draw();
g_batch.simple_shader = simple_shader;
g_batch.font = font;
/* Save for next memcmp. */
@@ -170,15 +170,15 @@ void blf_batching_start(FontBLF *font)
}
else {
/* flush cache */
- blf_batching_draw();
+ blf_batch_draw();
g_batch.font = font;
g_batch.simple_shader = simple_shader;
}
}
-void blf_batching_draw(void)
+void blf_batch_draw(void)
{
- if (g_batch.glyph_ct == 0)
+ if (g_batch.glyph_len == 0)
return;
glEnable(GL_BLEND);
@@ -188,7 +188,7 @@ void blf_batching_draw(void)
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, g_batch.font->tex_bind_state);
- GWN_vertbuf_vertex_count_set(g_batch.verts, g_batch.glyph_ct);
+ GWN_vertbuf_vertex_count_set(g_batch.verts, g_batch.glyph_len);
GWN_vertbuf_use(g_batch.verts); /* send data */
GPUBuiltinShader shader = (g_batch.simple_shader) ? GPU_SHADER_TEXT_SIMPLE : GPU_SHADER_TEXT;
@@ -202,13 +202,13 @@ void blf_batching_draw(void)
GWN_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.pos_loc, &g_batch.pos_step);
GWN_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.tex_loc, &g_batch.tex_step);
GWN_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.col_loc, &g_batch.col_step);
- g_batch.glyph_ct = 0;
+ g_batch.glyph_len = 0;
}
-static void blf_batching_end(void)
+static void blf_batch_draw_end(void)
{
if (!g_batch.active) {
- blf_batching_draw();
+ blf_batch_draw();
}
}
@@ -227,7 +227,7 @@ void blf_font_exit(void)
{
FT_Done_FreeType(ft_lib);
BLI_spin_end(&ft_lib_mutex);
- blf_batching_exit();
+ blf_batch_draw_exit();
}
void blf_font_size(FontBLF *font, unsigned int size, unsigned int dpi)
@@ -339,7 +339,7 @@ static void blf_font_draw_ex(
blf_font_ensure_ascii_table(font);
- blf_batching_start(font);
+ blf_batch_draw_begin(font);
while ((i < len) && str[i]) {
BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table);
@@ -358,7 +358,7 @@ static void blf_font_draw_ex(
g_prev = g;
}
- blf_batching_end();
+ blf_batch_draw_end();
if (r_info) {
r_info->lines = 1;
@@ -385,7 +385,7 @@ static void blf_font_draw_ascii_ex(
blf_font_ensure_ascii_table(font);
- blf_batching_start(font);
+ blf_batch_draw_begin(font);
while ((c = *(str++)) && len--) {
BLI_assert(c < 128);
@@ -401,7 +401,7 @@ static void blf_font_draw_ascii_ex(
g_prev = g;
}
- blf_batching_end();
+ blf_batch_draw_end();
if (r_info) {
r_info->lines = 1;
@@ -425,7 +425,7 @@ int blf_font_draw_mono(FontBLF *font, const char *str, size_t len, int cwidth)
blf_font_ensure_ascii_table(font);
- blf_batching_start(font);
+ blf_batch_draw_begin(font);
while ((i < len) && str[i]) {
BLF_UTF8_NEXT_FAST(font, g, str, i, c, glyph_ascii_table);
@@ -446,7 +446,7 @@ int blf_font_draw_mono(FontBLF *font, const char *str, size_t len, int cwidth)
pen_x += cwidth * col;
}
- blf_batching_end();
+ blf_batch_draw_end();
return columns;
}
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index b05cabcd830..d472825e940 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -325,10 +325,10 @@ static void blf_texture_draw(const unsigned char color[4], float uv[2][2], float
x2 + g_batch.ofs[0], y2 + g_batch.ofs[1]);
copy_v4_v4(GWN_vertbuf_raw_step(&g_batch.tex_step), (float *)uv);
copy_v4_v4_uchar(GWN_vertbuf_raw_step(&g_batch.col_step), color);
- g_batch.glyph_ct++;
+ g_batch.glyph_len++;
/* Flush cache if it's full. */
- if (g_batch.glyph_ct == BLF_BATCHING_SIZE) {
- blf_batching_draw();
+ if (g_batch.glyph_len == BLF_BATCH_DRAW_LEN_MAX) {
+ blf_batch_draw();
}
}
diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h
index c9ea8c3323b..aa2b667d97f 100644
--- a/source/blender/blenfont/intern/blf_internal.h
+++ b/source/blender/blenfont/intern/blf_internal.h
@@ -37,9 +37,9 @@ struct GlyphBLF;
struct GlyphCacheBLF;
struct rctf;
-void blf_batching_vao_clear(void);
-void blf_batching_start(struct FontBLF *font);
-void blf_batching_draw(void);
+void blf_batch_draw_vao_clear(void);
+void blf_batch_draw_begin(struct FontBLF *font);
+void blf_batch_draw(void);
unsigned int blf_next_p2(unsigned int x);
unsigned int blf_hash(unsigned int val);
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index 5808bd38990..a954cf22370 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -33,7 +33,7 @@
#include "../../../intern/gawain/gawain/gwn_vertex_buffer.h"
-#define BLF_BATCHING_SIZE 2048 /* in glyph */
+#define BLF_BATCH_DRAW_LEN_MAX 2048 /* in glyph */
typedef struct BatchBLF{
struct FontBLF *font; /* can only batch glyph from the same font */
@@ -41,7 +41,7 @@ typedef struct BatchBLF{
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;
+ unsigned int glyph_len;
float ofs[2]; /* copy of font->pos */
float mat[4][4]; /* previous call modelmatrix. */
bool enabled, active, simple_shader;