1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-11 13:51:01 -05:00
Commit graph

27 commits

Author SHA1 Message Date
Joe Wilm
78f5de4935
Support dynamic character loading
The glyph cache was previously initialized with a list of glyphs from
INIT_LIST, and never updated again. This meant that code points not
included in that list were not displayed. Now, the glyph cache has
gained the ability to load new glyphs at render time.

This seems to have lightly decreased performance for some reason.
2016-06-06 14:31:12 -07:00
Joe Wilm
ed7aa96907
Refactor Instanced Drawing to use Vertex Arrays
Per-instanced data was previously stored in uniforms. This required
several OpenGL calls to upload all of the data, and it was more complex
to prepare (several vecs vs one).

Additionally, drawing APIs are now accessible through a `RenderApi`
(obtained through `QuadRenderer::with_api`) which enables some RAII
patterns. Specifically, checks for batch flushing are handled in Drop.
2016-06-06 13:20:35 -07:00
Joe Wilm
1f3f9add49
Optimize Rendering with batched draw calls
Draw calls are now batched for performance. Render times on git log at
the default size are now ~200usec.
2016-06-04 21:31:41 -07:00
Joe Wilm
2f058bd053
Optimize rendering
This moves some logic that was previously being done per-character into
the vertex shader. At this time, we've traded CPU computation for
additional gl::Uniform2f calls. This is only a marginal improvement.
However, this patch positions the renderer well for instanced drawing,
and that will be a huge performance win.
2016-06-04 15:30:17 -07:00
Joe Wilm
f944b517fa
Add live-reload for shaders
Recompiling the entire program whenever a shader changes is slow, and it
can interrupt flow. Shader reloads are essentially instantaneous now. If
the new shader fails to compile, no state is changed; the previous
program continues to be used.
2016-06-04 10:54:33 -07:00
Joe Wilm
2e51d92a92
Use texture atlas for glyphs
This dramatically reduces the number of BindTexture calls needed when
rendering the grid. Draw times for a moderately full terminal of the
default size are ~1ms with this patch.
2016-06-02 22:14:55 -07:00
Joe Wilm
2f98871b02
Refactor renderer functions out of main.rs
This moves the rendering logic to draw the grid, to draw strings, and to
draw the cursor into the renderere module. In addition to being an
organizational improvement, this also allowed for some optimizations
managing OpenGL state. Render times for a moderate screen of text
dropped from ~10ms to ~4ms.
2016-06-02 20:27:07 -07:00
Joe Wilm
30ec145109
Initial support for Terminal Emulation (woo!)
This patch introduces basic support for terminal emulation. Basic means
commands that don't use paging and are not full screen applications like
vim or tmux. Some paging applications are working properly, such as as
`git log`. Other pagers work reasonably well as long as the help menu is
not accessed.

There is now a central Rgb color type which is shared by the renderer,
terminal emulation, and the pty parser.

The parser no longer owns a Handler. Instead, a mutable reference to a
Handler is provided whenever advancing the parser. This resolved some
potential ownership issues (eg parser owning the `Term` type would've
been unworkable).
2016-06-02 19:42:28 -07:00
Joe Wilm
70b0423a31
Initial ANSI parser implementation
This is the initial terminal stream parsing implementation for
Alacritty. There are currently several TODOs, FIXMEs, and unimplemented!
things scattered about still, but what's here is good enough to
correctly parse my zsh startup.

The `Parser` implementation is largely based on the suck-less _simple
terminal_ parser. Because this is Rust and Rust has a fantastic type
system, some improvements are possible. First, `Parser` is a struct, and
its data is stored internally instead of statically. Second, there's no
terminal updates hard-coded into the parser. Instead, `Parser` is
generic over a `Handler` type which has methods for all of the actions
supported by the parser. Because Parser is generic, it should be
possible (with proper inlining) to have equivalent performance to the
hard-coded version.

In addition to using _simple terminal_ as a reference, there's a doc in
Alacritty's repository `docs/ansicode.txt`, a summary of the ANSI
terminal protocol, which has been referenced extensively.

There's probably a large number escapes we don't handle, and that's ok.
There's a lot that aren't necessary for everyday terminal usage. If you
feel like something that's not supported should be, feel free to add it.
Please try not to become overzealous and adding support for sequences
only used by folks trapped in 1988.
2016-05-28 22:09:25 -07:00
Joe Wilm
78414b5ae1
Implement tty::new()
Opens a pty, forks a child process, and execs the shell defined in
user's /etc/passwd file. Bytes from the pty are currently just written
to Alacritty's stdout as a sanity check that things are hooked up.

Thanks to `st` for some guidance on setting this up.
2016-05-24 21:06:19 -07:00
Joe Wilm
855ae75697
Add render time meter
Optimization is impossible without measurement!
2016-05-21 11:08:50 -07:00
Joe Wilm
c70acbac0b
Correct sub-pixel font rendering with OpenGL
Uses the GL_ARB_blend_func_extended to get single-pass, per-channel
alpha blending. gl_generator is now used instead of gl to enable the
extension.

The background color is removed since that presumably needs to run in a
separate pass.
2016-05-20 21:36:28 -07:00
Joe Wilm
e794bc11b9
Use subpixel font rendering
OpenGL only supports shared alpha blending. Subpixel font rendering
requires using the font RGB values as alpha masks for the corresponding
RGB channels. To support this, blending is implemented in the fragment
shader.
2016-04-11 08:05:19 -07:00
Joe Wilm
b84eb9e921
Add a Grid
The grid holds the state of the terminal with row-major ordering.
Eventually, the grid::Cell type will hold other attributes such as
color, background color, decorations, and weight.

An initialization list is added for common ASCII symbols.
2016-04-10 16:25:05 -07:00
Joe Wilm
c8b69412b2 Rasterizer uses DPI from Glutin 2016-02-27 20:26:31 -08:00
Joe Wilm
1bf7bb8e12 Font no longer hardcoded in get_glyph 2016-02-27 14:45:38 -08:00
Joe Wilm
7e9888b1f5 Add support for multiple font faces in rasterizer 2016-02-27 14:38:38 -08:00
Joe Wilm
ce96b5df6b Fix some compiler warnings 2016-02-25 21:02:18 -08:00
Joe Wilm
07640b392c Move rendering stuff into renderer mod 2016-02-25 21:02:01 -08:00
Joe Wilm
eac9747a78 Abstract glyph rendering, poorly
Adds a QuadRenderer class that actually only works with glyphs for now.
Manually place a few glyphs to demonstrate that it works.
2016-02-24 21:02:21 -08:00
Joe Wilm
cda4952145 Bit of cleanup
- Commend vertex slice
- Add helper for binding mask texture (and specify that it's a mask)
- Prefix uniform members of ShaderProgram with u_. This makes it easy to
  identify in the rest of code.
2016-02-24 20:37:17 -08:00
Joe Wilm
5226666690 Use indexed drawing to draw quads 2016-02-24 20:11:15 -08:00
Joe Wilm
400e4c92a7 build rect describing glyph quad 2016-02-24 19:08:57 -08:00
Joe Wilm
2b7caf95fd Render the letter J
This letter brought to you by OpenGL and freetype.
2016-02-23 20:42:58 -08:00
Joe Wilm
5040c44f67 Implement very basic glyph rasterization
There are several assumptions made at this point and very little (no)
error handling done.
2016-02-21 19:45:35 -08:00
Joe Wilm
2a7dc1deb8 Add function for listing font names on linux
This function isn't exactly useful, but it's working ffi with the
fontconfig library. Woo! Next step will be returning some objects with
more information (like font path so we can start rendering glyphs!).
2016-02-21 15:20:03 -08:00
Joe Wilm
621776cd94 Initialize new cargo binary project 2016-02-21 08:15:41 -08:00