fix(render): give degenerate segments area, pin font bit order, clarify vertex_count

This commit is contained in:
Martino Ferrari committed 2026-09-27 22:10:53 +02:00
1 parent 7cbc1c9955
commit b4e88fe0c1
5 files changed
+76 -15

No files matched your search

+5 -1
View File
@@ -34,7 +34,11 @@ class LineBatch {
/// Segments staged so far, one instance each.
u32 segment_count() const noexcept { return static_cast<u32>(v_.size() / 4u); }
/// Vertices the pipeline will rasterise: two per staged segment.
/// Staging vertices, two per staged segment. The pipeline draws one instanced
/// quad per segment (its four `GL_TRIANGLE_STRIP` corners come from
/// `gl_VertexID`), so the instance count a draw passes is `vertex_count() / 2`
/// — handing `vertex_count()` to `glDrawArraysInstanced` would rasterise
/// twice the geometry the batch staged.
u32 vertex_count() const noexcept { return segment_count() * 2u; }
/// Interleaved `x0,y0,x1,y1`, four floats per staged segment.
+5
View File
@@ -17,6 +17,11 @@ namespace plot::render {
/// `plot::Rect` is top-left origin while GL is bottom-left, so the y axis is
/// flipped exactly once, here.
///
/// A degenerate segment (`a_p0 == a_p1`) keeps a finite normal and is stretched
/// into a square mark one stroke width and fringe across, rather than
/// collapsing to zero area and rasterising nothing — the dense path stages
/// `min == max` buckets as exactly such segments.
///
/// The fragment shader discards outside the fringe and ramps alpha over the last
/// pixel of the half width with `smoothstep`, which is what keeps a 1px trace
/// from aliasing into dashes.