BLF: Rename Text Shader Depth to Component Len #115640
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -1404,7 +1404,7 @@ static void blf_texture_draw(GlyphBLF *g,
|
|||
copy_v4_v4_uchar(static_cast<uchar *>(GPU_vertbuf_raw_step(&g_batch.col_step)), color);
|
||||
copy_v2_v2_int(static_cast<int *>(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++;
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue