// Matches `GlyphEntry::IS_COLORED`. const COLORED: u32 = 1u; struct GlyphInfo { uv_min: vec2, uv_max: vec2, // Which layer of the atlas array this glyph's page is. layer: u32, color: u32, flags: u32, } @group(1) @binding(0) var glyphs: array; @fragment fn fs_main(in: VertexOutput) -> @location(0) vec4 { let g = glyphs[in.idx]; let uv = mix(g.uv_min, g.uv_max, in.uv); let texel = textureSample(atlas, samp, uv, i32(g.layer)); if (g.flags & COLORED) != 0u { return masked(in, texel); } var color = unpack4x8unorm(g.color); color.a *= texel.a; return masked(in, color); }