Commit Graph

14146 Commits

Author SHA1 Message Date
Mitchell Hashimoto
28086a7adc inspector: terminal migrate content 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
7cfac87fc4 inspector: trying new stuff 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
38aae2325d inspector: trying new logic layout 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
a25e91bb25 pkg/dcimgui: expose more private dockbuilder stuff 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
7073fb88f4 inspector: remove cursor helper, move it to screen, style helper 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
bdd0295e0e inspector: add style file for style widgets 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
1fa74b19e8 inspector: grid section lets you pick a cell 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
f23e67388d inspector: add grid section to screen 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
4992212ecd inspector: add more cursor state 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
e5a03a103c inspector: show warning if inactive screen being viewed 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
0b3f4ae340 inspector: move screens to terminal section 2026-01-31 08:47:13 -08:00
Mitchell Hashimoto
4c5af7073e inspector: move screen window to dedicated file 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
4c2ea6a9d8 inspector: fix up detachable headers to dock 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
1d7def0d2e inspector: move modes out to separate header 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
86af16b081 inspector: move surface window out to its own file 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
ff14938389 inspector: detachable collapsing headers 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
d58703a245 update AGENTS.md 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
061730ef97 inspector: terminal mouse section 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
03f012f567 inspector: terminal colors 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
41b5dc4928 inspector: terminal tab 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
377c6d7700 inspector: add AGENTS.md 2026-01-31 08:47:12 -08:00
Mitchell Hashimoto
d8b1b09eb7 Renderer: Debug Overlay Framework (#10503)
This adds a cross-platform ability to draw an overlay of debug
information directly on top of our terminal.

The debug overlay is drawn on the CPU using z2d and then rendered as an
image on the GPU (using the same subsystem and shaders as things like
the Kitty Graphics Protocol). This lets us iterate more quickly on
overlays since it's all simple imperative 2D drawing operations, and
also lets it be cross-platform immediately.

The goal of this PR is to **introduce the framework.** To enable the
overlays, you have to modify code and recompile it, but of course in the
future this will be runtime toggle-able via the inspector. Additionally,
the dummy overlay in this PR (OSC8 highlighting) isn't particularly
useful and has limitations; it's only meant to be a demo. More realistic
overlays will come later.

## Demo

Here is a demo of an overlay highlighting OSC8 hyperlinks:

<img width="1746" height="1648" alt="CleanShot_2026-01-30_at_15 04 582x"
src="https://github.com/user-attachments/assets/4c490d11-5baa-4ef6-b97b-1cfd321235d8"
/>

## Performance

```
Empty but overlay active:
generic_renderer: [rebuildOverlay time] start_micro=1769835575905814 duration=12ns
generic_renderer: [updateFrame time] start_micro=1769835575905766 duration=199ns

Hyperlink on every line:
generic_renderer: [rebuildOverlay time] start_micro=1769835573560797 duration=452ns
generic_renderer: [updateFrame time] start_micro=1769835573560682 duration=891ns
```

Pretty great! 🎉

With the overlay active but nothing to draw, the overlay adds ~6%
overhead. With the overlay active and hyperlinks on every line, the
overlay adds ~50% overhead. These are big percentages, but the absolute
numbers are miniscule. And, for a high value debug feature that is only
on some of the time, it's totally acceptable.

Also, as a reminder, for 120fps we have _8.3 million nanoseconds_ per
frame (including the time to draw, of course). If we're spending
sub-1000ns we're in the realm of 1M FPS. So, it's fine. lol.

(Edit: I previously had debug timings which are significantly worse but
have a lot more safety checks.)

## Other Notes

* **Damage/dirty tracking.** I don't do any for the overlay, and we just
rebuild it on every frame. I'm not convinced the complexity is worth it
for a debug overlay and the performance numbers at this point do not
necessitate it in any way.

* **Update vs draw times.** We call `draw` _far_ more often than
`update` so putting the overlay rebuild into `update` made way more
sense. I did measure both.
2026-01-31 08:46:52 -08:00
Mitchell Hashimoto
d3e1b1bc19 disable debug 2026-01-30 20:47:19 -08:00
Mitchell Hashimoto
693035eaaf renderer: turn off AA and turn on hairline 2026-01-30 20:39:20 -08:00
Mitchell Hashimoto
d4f7c11a38 renderer: cache the overlay between calls 2026-01-30 20:33:28 -08:00
Mitchell Hashimoto
daed17c58a renderer: make overlay features configurable 2026-01-30 15:28:07 -08:00
Mitchell Hashimoto
fa06849dcc renderer: overlay explicit error sets 2026-01-30 15:11:16 -08:00
Mitchell Hashimoto
ed7f190fff renderer: overlay doesn't need to account for padding 2026-01-30 15:04:06 -08:00
Mitchell Hashimoto
f5c652a488 renderer: image can draw overlays 2026-01-30 14:58:26 -08:00
Mitchell Hashimoto
3931c45c6a renderer: image state supports overlay 2026-01-30 14:21:50 -08:00
Mitchell Hashimoto
f176342537 renderer: overlay system 2026-01-30 14:18:57 -08:00
Mitchell Hashimoto
89d3ad2bf3 renderer: generalize and extract image renderer state (#10501)
This extracts all our image renderer state into a separate struct,
blandly named `renderer.image.State`. This structure owns all the
storage of images and placements and exposes a limited public API to
manage them.

One motivation was to limit state access by our Kitty graphics functions
within the generic renderer. Another was to limit our own generic
renderer from getting our image system into an incoherent state. This is
prevented now on both sides due to some encapsulation.

This currently only supports Kitty images, since that's the only image
protocol we support. But I intend to add additional image types to this,
namely the ability to add overlay images for debug information. **There
are no plans to add new image protocols to the terminal,** the
extraction is purely to support some internal features. But, it could be
used for other protocols one day.
2026-01-30 14:18:40 -08:00
Mitchell Hashimoto
025885aa25 renderer: generalize and extract image renderer state
This extracts all our image renderer state into a separate struct,
blandly named `renderer.image.State`. This structure owns all the 
storage of images and placements and exposes a limited public API
to manage them.

One motivation was to limit state access by our Kitty graphics functions
within the generic renderer. Another was to limit our own generic
renderer from getting our image system into an incoherent state. This is
prevented now on both sides due to some encapsulation.

This currently only supports Kitty images, since that's the only image
protocol we support. But I intend to add additional image types to this,
namely the ability to add overlay images for debug information. 
**There are no plans to add new image protocols to the terminal,** the
extraction is purely to support some internal features. But, it could be
used for other protocols one day.
2026-01-30 14:10:03 -08:00
Leah Amelia Chen
30d0ed4afd flake.nix: drop desc argument for runVM function (#10498) 2026-01-31 04:01:31 +08:00
faukah
db8623e257 flake.nix: drop desc argument for runVM function
The current runVM function gets called only with a module and without a desc,
resulting in an error when running `nix flake show` or similar
commands.

This commit drops the `desc` argument to `runVM` and gets rid of that problem.
2026-01-30 20:44:48 +01:00
Jeffrey C. Ollie
7c7d5421f9 core: don't log redraw_surface or redraw_inspector app messages (#10491)
They are _very_ verbose and make other debug logs difficult to read.
2026-01-29 13:43:43 -06:00
Jeffrey C. Ollie
9df9374e90 core: ensure comptime evaluation 2026-01-29 13:31:48 -06:00
Jeffrey C. Ollie
8bf03ff64a core: guard app message logging to ensure it's optimized away in release builds 2026-01-29 13:18:13 -06:00
Jeffrey C. Ollie
f04ac78624 core: use 0.15 native tag name conversion 2026-01-29 13:14:11 -06:00
Jeffrey C. Ollie
0ed63dffd3 core: don't log redraw_surface or redraw_inspector app messages
They are _very_ verbose and make other debug logs difficult to read.
2026-01-29 13:10:00 -06:00
Mitchell Hashimoto
685daee01b Misc inspector fixes (#10470)
Inspector is getting some love! While working on some new functionality
I found a bunch of bugs. Sending the bug fixes separately.

- Mode checkboxes didn't have a unique ID, causing Imgui warnings
- renderer: we keep a draw timer active while the inspector is visible,
allowing animations to work
- GTK and macOS: we were always calculating a delta time of 0 since we
converted to float after int math, making hover timers not work
- macOS: precision scrolling made scrolling way too fast, slow it down

No AI, just meat sticks
2026-01-27 09:39:19 -08:00
Mitchell Hashimoto
bdfb45bca7 imgui delta time needs to use float math
Our prior math converted to float after int which made our delta time
wrong making hovers and stuff not work.
2026-01-27 09:35:38 -08:00
Mitchell Hashimoto
f85653414c renderer: keep a draw timer on when we have an inspector 2026-01-27 09:08:45 -08:00
Mitchell Hashimoto
32f5677a94 macos: slow down inspector trackpad (precision) scrolling 2026-01-27 08:34:35 -08:00
Mitchell Hashimoto
7feb30a836 inspector: mode rows need a unique ID 2026-01-27 08:28:39 -08:00
Mitchell Hashimoto
0de5f43254 macos: filter only supported commands in the command palette
This got accidentally regressed when we did the jump options.
2026-01-27 08:17:22 -08:00
Mitchell Hashimoto
66e8b47fc3 macOS: xib changes from xcode (#10466)
Literally just opening these on Xcode 26.2 does this, so we should
commit it lol.
2026-01-27 08:13:42 -08:00
Mitchell Hashimoto
6ace63acc4 macOS: xib changes from xcode
Literally just opening these on Xcode 26.2 does this, so we should
commit it lol.
2026-01-27 08:10:00 -08:00
Mitchell Hashimoto
53037038ee ci: Run build-macos-freetype with coretext_freetype for Harfbuzz tests (#10464)
As mentioned in
https://github.com/ghostty-org/ghostty/pull/10332#issuecomment-3800353166,
the Harfbuzz shaping tests that depend on specific fonts (that are on
macOS, but not whatever linux distro we use for CI) aren't being checked
in CI. The `build-macos-freetype` CI check is primarily to make sure
Freetype can build on Mac, but if we switch to the `coretext_freetype`
backend, we still use Freetype for rendering, but then we get Coretext
for font discovery which then enables these tests to run.
2026-01-27 07:07:52 -08:00
Jacob Sandlund
9d8449b6f1 ci: Run build-macos-freetype with coretext_freetype for Harfbuzz tests 2026-01-27 09:26:42 -05:00