struct Uniforms { view_proj: mat4x4, } @group(0) @binding(0) var u: Uniforms; @group(0) @binding(1) var glyph_atlas: texture_2d; @group(0) @binding(2) var glyph_sampler: sampler; struct VertexIn { @location(0) position: vec3, @location(1) uv: vec2, } struct VertexOut { @builtin(position) clip_pos: vec4, @location(0) uv: vec2, } @vertex fn vs_main(in: VertexIn) -> VertexOut { var out: VertexOut; out.clip_pos = u.view_proj * vec4(in.position, 1.0); out.uv = in.uv; return out; } @fragment fn fs_main(in: VertexOut) -> @location(0) vec4 { let coverage = textureSample(glyph_atlas, glyph_sampler, in.uv).r; if coverage < 0.004 { discard; } return vec4(1.0, 1.0, 1.0, coverage); }