2024-10-15 00:06:46 -06:00
|
|
|
#version 450
|
|
|
|
#extension GL_EXT_buffer_reference : require
|
|
|
|
|
2024-10-20 21:59:28 -06:00
|
|
|
#include "ui_common.glsl"
|
2024-10-18 14:26:41 -06:00
|
|
|
|
2024-10-15 11:44:59 -06:00
|
|
|
layout(local_size_x = 1) in;
|
|
|
|
|
2024-10-15 00:06:46 -06:00
|
|
|
void main() {
|
2024-10-15 11:44:59 -06:00
|
|
|
uint gID = gl_GlobalInvocationID.x;
|
2024-10-18 18:34:31 -06:00
|
|
|
String string = pc.layer.strings.s[gID];
|
2024-10-24 20:49:59 -06:00
|
|
|
Font font = pc.layer.container.context.fonts.f[string.font];
|
2024-10-15 11:44:59 -06:00
|
|
|
|
2024-10-18 22:53:06 -06:00
|
|
|
uint buffer_pos = atomicAdd(pc.layer.draw.instance_count, string.len);
|
2024-10-22 20:24:34 -06:00
|
|
|
vec2 pen = vec2(0.0, 0.0);
|
2024-10-28 22:49:57 -06:00
|
|
|
|
2024-10-15 16:14:34 -06:00
|
|
|
for(uint i = 0; i < string.len; i++) {
|
2024-11-10 16:36:01 -07:00
|
|
|
uint code = (pc.layer.codes.c[(string.offset + i)/4] >> ((string.offset + i) % 4)*8) & 0xFF;
|
2024-10-18 22:53:06 -06:00
|
|
|
Symbol symbol = font.symbols.s[code];
|
2024-10-22 20:24:34 -06:00
|
|
|
pc.layer.drawables.d[buffer_pos + i].pos = string.pos + pen;
|
|
|
|
pen += string.size*symbol.advance;
|
2024-10-18 22:53:06 -06:00
|
|
|
pc.layer.drawables.d[buffer_pos + i].size = vec2(string.size, string.size);
|
2024-11-12 11:56:57 -07:00
|
|
|
pc.layer.drawables.d[buffer_pos + i].color[0] = string.color;
|
|
|
|
pc.layer.drawables.d[buffer_pos + i].color[1] = string.color;
|
|
|
|
pc.layer.drawables.d[buffer_pos + i].color[2] = string.color;
|
|
|
|
pc.layer.drawables.d[buffer_pos + i].color[3] = string.color;
|
|
|
|
pc.layer.drawables.d[buffer_pos + i].var = code + (string.font << 16);
|
2024-10-18 22:53:06 -06:00
|
|
|
pc.layer.drawables.d[buffer_pos + i].type = 1;
|
2024-10-15 16:14:34 -06:00
|
|
|
}
|
2024-10-15 00:06:46 -06:00
|
|
|
}
|