zed/crates/gpui
Antonio Scandurra 45d1690f6e Use 16-bit float to store path windings
Previously, we were using a normalized 8-bit unsigned integer which forced us
to represent each increment of the winding number as a fraction of the max
value (1 / 255) which we would then add up using additive alpha blending.

This had three major drawbacks:

- The max winding number could not be greater than 255.
- Adding up (1 / 255) several times could result in a loss of precision.
- Due to also computing anti-aliasing as a fractional winding number, we had to
  reduce the max winding number to 32. This was still not good enough because
  we would multiply a fractional value with `1 / 32`, thus introducing more and
  more loss of precision.

This commit changes the texture type to an `f16` which doesn't require the
division by 255 and enables greater precision in the computation of the
anti-aliased parts of a curve. Note how this also removes the limitation of 255
windings at most per curve. The tradeoff is paying twice as much memory for
storing the texture, but that seems totally valid to achieve rendering accuracy.

Note that this kind of texture should be compatible with WebGL2 once we start
working on a web version of Zed.
2021-12-05 11:17:26 +01:00
..
examples Allow underlines to have different color than the text 2021-10-26 12:46:46 -07:00
grammars/context-predicate Move all crates to a top-level crates folder 2021-10-04 13:22:21 -06:00
src Use 16-bit float to store path windings 2021-12-05 11:17:26 +01:00
build.rs Move all crates to a top-level crates folder 2021-10-04 13:22:21 -06:00
Cargo.toml Name the root file of every crate after the crate to ease navigation 2021-11-30 12:46:39 -07:00