aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-06-14Add support for macOSJoe Wilm
Alacritty now runs on macOS using CoreText for font rendering. The font rendering subsystems were moved into a separate crate called `font`. The font crate provides a unified (albeit limited) API which wraps CoreText on macOS and FreeType/FontConfig on other platforms. The unified API differed slightly from what the original Rasterizer for freetype implemented, and it was updated accordingly. The cell separation properties (sep_x and sep_y) are now premultiplied into the cell width and height. They were previously passed through as uniforms to the shaders; removing them prevents a lot of redundant work. `libc` has some differences between Linux and macOS. `__errno_location` is not available on macOS, and the `errno` crate was brought in to provide a cross-platform API for dealing with errno. Differences in `openpty` were handled by implementing a macOS specific version. It would be worth investigating a way to unify the implementations at some point. A type mismatch with TIOCSCTTY was resolved with a cast. Differences in libc::passwd struct fields were resolved by using std::mem::uninitialized instead of zeroing the struct ourselves. This has the benefit of being much cleaner. The thread setup had to be changed to support both macOS and Linux. macOS requires that events from the window be handled on the main thread. Failure to do so will prevent the glutin window from even showing up! For this reason, the renderer and parser were moved to their own thread, and the input is received on the main thread. This is essentially reverse the setup prior to this commit. Renderer initialization (and thus font cache initialization) had to be moved to the rendering thread as well since there's no way to make_context(null) with glx on Linux. Trying to just call make_context a second time on the rendering thread had resulted in a panic!.
2016-06-09Fix backspaceJoe Wilm
There's never a count associated with this, and it has been removed from the Handler method to reflect as much.
2016-06-09Fix all trivial compiler warningsJoe Wilm
Of note are the `ansi` and `grid` modules becoming public. There are several bits of unused code in each of these. In the case of `grid`, the unused parts are generally useful, like some indexing implementations. In ansi, there are pieces that will be used once the parser is more complete. In any case, these modules are fairly generic and mostly usable outside of Alacritty. Unused cargo packages were also removed.
2016-06-09Sort some importsJoe Wilm
2016-06-09Make state updates and rendering event drivenJoe Wilm
The main thing preventing this system being event driven in the past was input from the keyboard had to be polled separately from pty activity. This commit adds a thread for the window event iterator and sends them on the same channel as pty characters. With that in place, the render loop looks like - Block on 1 available input - Get all remaining available input that won't cause blocking - Render Which means that rendering is only performed on state changes. This obsoleted the need for a `dirty` flag in the Term struct.
2016-06-08Fix shutdown deadlockJoe Wilm
Calling ::std::process::exit() from the SIGCHLD handler would sometimes deadlock some OpenGL internal shutdown procedure. To resolve this, a flag was added that can be checked with `process_should_exit`.
2016-06-08Add support for scrolling regionsJoe Wilm
It's now possible to move around within Vim without the screen becoming corrupt! The ANSI parser now calls a (new) `set_scrolling_region` on the handler when the DECSTBM CSI is received. In order to provide a sensible default in case that the sequence doesn't include arguments, a TermInfo trait was added which currently has methods for inspecting number of rows and columns. This was added as an additional trait instead of being included on Handler since they have semantically different purposes. The tests had to be updated to account for the additional trait bounds. The utilities module now has a `Rotate` trait which is implemented for the built-in slice type. This means that slices and anything derefing to a slice can be rotated. Since VecDeque doesn't support slicing (it's a circular buffer), the grid rows are now held in a Vec to support rotation. For ergomomic access to the grid for scrolling and clearing regions, additional Index/IndexMut implementations were added to the grid::Row type. Finally, a `reset` method was added to `Cell` which properly resets the state to default (instead of just clearing the char). This supports region clearing and also fixed a bug where cell backgrounds would remain after being cleared.
2016-06-07Handle TEXT_CURSOR modeJoe Wilm
When the flag is unset, the cursor is not rendered.
2016-06-07Only draw when terminal state has changedJoe Wilm
This is achieved by setting a `dirty` flag when the terminal receives an event that causes visible state to change. The implementation is pretty much crap because most methods know about the flag. Figure out something better later.
2016-06-07Parse a few more ansi terminal mode commandsJoe Wilm
2016-06-07Handle pty char recv errorsJoe Wilm
The main loop is now exitted if the char sender hangs up.
2016-06-07Add named thread for pty readerJoe Wilm
2016-06-07Unwrap some unhandled errorsJoe Wilm
They're still unhandled, but they won't silently pass by anymore. TODO
2016-06-06Add explicit bounds check when advancing cursorJoe Wilm
2016-06-06Tweak some Grid methodsJoe Wilm
Adds some #[inline] tags, and delegates to internals for num_rows and num_cols. In case these become different than the expected values, this should help to fail sooner.
2016-06-06Fix bug where there were extra grid rowsJoe Wilm
Apparently VecDeque::with_capacity is more of a suggestion.
2016-06-06Terminal sets more attributes on grid CellsJoe Wilm
2016-06-06Fix escape bytes as input bug in ANSI parserJoe Wilm
There were several unrecognized escape codes that have arguments which were being interpretted as input. Naturally, this caused state to be corrupt. The escape codes are now handled by throwing away the bytes. Consider this a TODO for later.
2016-06-06Add support for drawing background colorsJoe Wilm
2016-06-06Minor updates to terminal handlingJoe Wilm
Properly handles goto_col and goto_row. Additionally, input wrapping is handled. Truecolor specs are now set appropriately.
2016-06-06Update task listJoe Wilm
2016-06-06Handle SIGCHLDJoe Wilm
Closes alacritty after joining with child process.
2016-06-06Support dynamic character loadingJoe Wilm
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-06Batching flushes on texture changeJoe Wilm
This fixes a bug when multiple atlases are required.
2016-06-06Refactor Instanced Drawing to use Vertex ArraysJoe Wilm
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-04Optimize Rendering with batched draw callsJoe Wilm
Draw calls are now batched for performance. Render times on git log at the default size are now ~200usec.
2016-06-04Add iterator methods to Grid and Row typesJoe Wilm
The iterator methods simplify logic in the main grid render function. To disambiguate iterator methods from those returning counts (and to free up names), the `rows()` and `cols()` methods on `Grid` have been renamed to `num_rows()` and `num_cols()`, respectively.
2016-06-04Optimize renderingJoe Wilm
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-04Add live-reload for shadersJoe Wilm
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-03render: cleanup active_tex handlingJoe Wilm
- Removes a spammy printn! - Sets active_tex to zero wherever gl::BindTexture is called with zero
2016-06-03Move debug timerJoe Wilm
It was near the left side; it will be less in-the-way on the right.
2016-06-02Use texture atlas for glyphsJoe Wilm
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-02Refactor renderer functions out of main.rsJoe Wilm
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-02Update Cargo dependenciesJoe Wilm
Most importantly, freetype-rs was updated to use freetype-sys 0.4 which includes the LCD_FILTER apis.
2016-06-02Initial support for Terminal Emulation (woo!)Joe Wilm
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-05-28Initial ANSI parser implementationJoe Wilm
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-28Remove old debug "test"Joe Wilm
It wasn't actually a test, it was a crappy ascii renderer to show freetype rendered glyphs.
2016-05-28Add Summary of ANSI standards for ASCII terminalsJoe Wilm
This doc was found in the tmux repository, and I'm adding it here so it doesn't get lost. Having it in-tree will also allow it to be referenced from the code.
2016-05-24Implement tty::new()Joe Wilm
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-21Add render time meterJoe Wilm
Optimization is impossible without measurement!
2016-05-20Correct sub-pixel font rendering with OpenGLJoe Wilm
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-04-11Use subpixel font renderingJoe Wilm
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-10Add a GridJoe Wilm
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-02-27Start tracking some tasksJoe Wilm
TASKS.md is a set of prioritized work for the project
2016-02-27Rasterizer uses DPI from GlutinJoe Wilm
2016-02-27Font no longer hardcoded in get_glyphJoe Wilm
2016-02-27Fix compiler warningsJoe Wilm
2016-02-27Add support for multiple font faces in rasterizerJoe Wilm
2016-02-27Cleanup PackedVertex initializationJoe Wilm
2016-02-27Implement per vertex structJoe Wilm