diff --git a/source/blender/blenfont/intern/blf_font.cc b/source/blender/blenfont/intern/blf_font.cc index ed2b8124e80..4044933efc3 100644 --- a/source/blender/blenfont/intern/blf_font.cc +++ b/source/blender/blenfont/intern/blf_font.cc @@ -193,8 +193,8 @@ static void blf_batch_draw_init() g_batch.offset_loc = GPU_vertformat_attr_add(&format, "offset", GPU_COMP_I32, 1, GPU_FETCH_INT); g_batch.glyph_size_loc = GPU_vertformat_attr_add( &format, "glyph_size", GPU_COMP_I32, 2, GPU_FETCH_INT); - g_batch.glyph_depth_loc = GPU_vertformat_attr_add( - &format, "depth", GPU_COMP_I32, 1, GPU_FETCH_INT); + g_batch.glyph_comp_len_loc = GPU_vertformat_attr_add( + &format, "comp_len", GPU_COMP_I32, 1, GPU_FETCH_INT); g_batch.glyph_mode_loc = GPU_vertformat_attr_add( &format, "mode", GPU_COMP_I32, 1, GPU_FETCH_INT); @@ -205,7 +205,8 @@ static void blf_batch_draw_init() GPU_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.col_loc, &g_batch.col_step); GPU_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.offset_loc, &g_batch.offset_step); GPU_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.glyph_size_loc, &g_batch.glyph_size_step); - GPU_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.glyph_depth_loc, &g_batch.glyph_depth_step); + GPU_vertbuf_attr_get_raw_data( + g_batch.verts, g_batch.glyph_comp_len_loc, &g_batch.glyph_comp_len_step); GPU_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.glyph_mode_loc, &g_batch.glyph_mode_step); g_batch.glyph_len = 0; @@ -353,7 +354,8 @@ void blf_batch_draw() GPU_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.col_loc, &g_batch.col_step); GPU_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.offset_loc, &g_batch.offset_step); GPU_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.glyph_size_loc, &g_batch.glyph_size_step); - GPU_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.glyph_depth_loc, &g_batch.glyph_depth_step); + GPU_vertbuf_attr_get_raw_data( + g_batch.verts, g_batch.glyph_comp_len_loc, &g_batch.glyph_comp_len_step); GPU_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.glyph_mode_loc, &g_batch.glyph_mode_step); g_batch.glyph_len = 0; } diff --git a/source/blender/blenfont/intern/blf_glyph.cc b/source/blender/blenfont/intern/blf_glyph.cc index 17be497d929..feabc01d34e 100644 --- a/source/blender/blenfont/intern/blf_glyph.cc +++ b/source/blender/blenfont/intern/blf_glyph.cc @@ -1404,7 +1404,7 @@ static void blf_texture_draw(GlyphBLF *g, copy_v4_v4_uchar(static_cast(GPU_vertbuf_raw_step(&g_batch.col_step)), color); copy_v2_v2_int(static_cast(GPU_vertbuf_raw_step(&g_batch.glyph_size_step)), glyph_size); *((int *)GPU_vertbuf_raw_step(&g_batch.offset_step)) = g->offset; - *((int *)GPU_vertbuf_raw_step(&g_batch.glyph_depth_step)) = g->depth; + *((int *)GPU_vertbuf_raw_step(&g_batch.glyph_comp_len_step)) = g->depth; *((int *)GPU_vertbuf_raw_step(&g_batch.glyph_mode_step)) = g->render_mode; g_batch.glyph_len++; diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h index 1929455d108..61eb24db911 100644 --- a/source/blender/blenfont/intern/blf_internal_types.h +++ b/source/blender/blenfont/intern/blf_internal_types.h @@ -88,9 +88,9 @@ typedef struct BatchBLF { struct FontBLF *font; struct GPUBatch *batch; struct GPUVertBuf *verts; - struct GPUVertBufRaw pos_step, col_step, offset_step, glyph_size_step, glyph_depth_step, + struct GPUVertBufRaw pos_step, col_step, offset_step, glyph_size_step, glyph_comp_len_step, glyph_mode_step; - unsigned int pos_loc, col_loc, offset_loc, glyph_size_loc, glyph_depth_loc, glyph_mode_loc; + unsigned int pos_loc, col_loc, offset_loc, glyph_size_loc, glyph_comp_len_loc, glyph_mode_loc; unsigned int glyph_len; /** Copy of `font->pos`. */ int ofs[2]; diff --git a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl index 34a3170e667..f8d7a3ac490 100644 --- a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl @@ -67,8 +67,8 @@ vec4 texture_1D_custom_bilinear_filter_color(vec2 uv) vec2 texel_2d = uv * vec2(glyph_dim) + 0.5; ivec2 texel_2d_near = ivec2(texel_2d) - 1; - int frag_offset = glyph_offset + ((texel_2d_near.y * glyph_dim.x * glyph_depth) + - (texel_2d_near.x * glyph_depth)); + int frag_offset = glyph_offset + ((texel_2d_near.y * glyph_dim.x * glyph_comp_len) + + (texel_2d_near.x * glyph_comp_len)); float tr = 0.0; float tg = 0.0; @@ -86,7 +86,7 @@ vec4 texture_1D_custom_bilinear_filter_color(vec2 uv) void main() { - if (glyph_depth == 4) { + if (glyph_comp_len == 4) { fragColor.rgba = texture_1D_custom_bilinear_filter_color(texCoord_interp).rgba; return; } diff --git a/source/blender/gpu/shaders/gpu_shader_text_vert.glsl b/source/blender/gpu/shaders/gpu_shader_text_vert.glsl index 2ad157824b4..7ce3b56565e 100644 --- a/source/blender/gpu/shaders/gpu_shader_text_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_text_vert.glsl @@ -8,7 +8,7 @@ void main() glyph_offset = offset; glyph_dim = abs(glyph_size); glyph_mode = mode; - glyph_depth = depth; + glyph_comp_len = comp_len; interp_size = int(glyph_size.x < 0) + int(glyph_size.y < 0); /* Quad expansion using instanced rendering. */ diff --git a/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh b/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh index bfa1cb8fd48..20a7827024d 100644 --- a/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh +++ b/source/blender/gpu/shaders/infos/gpu_shader_text_info.hh @@ -12,7 +12,7 @@ GPU_SHADER_INTERFACE_INFO(text_iface, "") .flat(Type::VEC4, "color_flat") .no_perspective(Type::VEC2, "texCoord_interp") .flat(Type::INT, "glyph_offset") - .flat(Type::INT, "glyph_depth") + .flat(Type::INT, "glyph_comp_len") .flat(Type::INT, "glyph_mode") .flat(Type::IVEC2, "glyph_dim") .flat(Type::INT, "interp_size"); @@ -22,7 +22,7 @@ GPU_SHADER_CREATE_INFO(gpu_shader_text) .vertex_in(1, Type::VEC4, "col") .vertex_in(2, Type ::IVEC2, "glyph_size") .vertex_in(3, Type ::INT, "offset") - .vertex_in(4, Type ::INT, "depth") + .vertex_in(4, Type ::INT, "comp_len") .vertex_in(5, Type ::INT, "mode") .vertex_out(text_iface) .fragment_out(0, Type::VEC4, "fragColor")