I noticed that the HashMap iterator showed up prominently in Instruments when quickly
resizing Ghostty.
I think this is related to the [tombstone issue](https://github.com/ziglang/zig/issues/17851),
where the `next()` function has to skip unused meta-nodes.
In that same issue, Andrew is suggesting that the non-array hashmap might get deleted from the
standard library.
After switching to `AutoArrayHashMapUnmanaged`, iteration barely shows up anymore.
Deletion from the pin list should also be fast as swapRemove is used (order does not need to be preserved).
Question is if insertion performance is negatively affected, though I'm not seeing anything obvious.
Still, checking this PR for any perf regressions might be a good idea.
If this pans out, there are more places where this switch might be beneficial.
The shared memory segment size must be a multiple of page size. This
means that it may be larger than our expected image size. In this case,
we trim the padding at the end.
This happened to work in releases somehow but Xcode debug builds would
catch this as an assertion. Our cell bg pipeline now uses the "full
screen vertex shader" which takes no parameters, so we don't need a
vertex descriptor.
Adds support for using shared memory to transfer images between
the CLI and Ghostty using the Kitty image protocol. This should be
the fastest way to transfer images if the CLI program and Ghostty are
running on the same system.
Works for single image transfer using `kitten icat`:
```
kitten icat --transfer-mode=memory images/icons/icon_256x256.png
```
However trying to play a movie with `mpv` fails in Ghostty (although it
works in Kitty):
```
mpv --vo=kitty --vo-kitty-use-shm=yes --profile=sw-fast --really-quiet video.mp4
```
`mpv` appears to be sending frames using the normal image transfer
commands but always setting `more_chunks` to `true` which results in an
image never being shown by Ghostty.
Shared memory transfer on Windows remains to be implemented.
- Significant changes to optimize memory usage.
- Adjusted formatting of the metal shader code to improve readability.
- Normalized naming conventions in shader code.
- Abstracted repetitive code for attribute descriptors to a helper
function.
These sequences were implemented:
CSI 14 t - report the text area size in pixels
CSI 16 t - report the cell size in pixels
CSI 18 t - report the text area size in cells
CSI 21 t - report the window title
These sequences were not implemented because they manuipulate the window
state in ways that we do not want.
CSI 1 t
CSI 2 t
CSI 3 ; x ; y t
CSI 4 ; height ; width ; t
CSI 5 t
CSI 6 t
CSI 7 t
CSI 8 ; height ; width ; t
CSI 9 ; 0 t
CSI 9 ; 1 t
CSI 9 ; 2 t
CSI 9 ; 3 t
CSI 10 ; 0 t
CSI 10 ; 1 t
CSI 10 ; 2 t
CSI 24 t
These sequences were not implemented because they do not make sense in
a Wayland context:
CSI 11 t
CSI 13 t
CSI 14 ; 2 t
These sequences were not implemented because they provide information
about the screen that is unnecessary.
CSI 15 t
CSI 19 t
These sequences were not implemeted because Ghostty does not maintain an
icon title for windows.
CSI 20 t
CSI 22 ; 0 t
CSI 22 ; 1 t
CSI 23 ; 0 t
CSI 23 ; 1 t
These sequences were not implemented because of the additional
complexity of maintaining a stack of window titles.
CSI 22 ; 2 t
CSI 23 ; 2 t