529 Commits

Author SHA1 Message Date
Jeffrey C. Ollie
6dbb82c259 kitty graphics: performance enhancements
Improve the performance of Kitty graphics by switching to the WUFFS
library for decoding PNG images and for "swizzling" G, GA, and RGB data
to RGBA formats needed by the renderers.

WUFFS claims 2-3x performance benefits over other implementations, as
well as memory-safe operations.

Although not thorougly benchmarked, performance is on par with Kitty's
graphics decoding.

https://github.com/google/wuffs
2024-09-02 20:45:08 -07:00
Mitchell Hashimoto
bae12993b3 crash: tag the thread type 2024-09-02 10:02:14 -07:00
Mitchell Hashimoto
d499f7795b input: crash binding can configure which thread to crash 2024-09-02 09:44:35 -07:00
Mitchell Hashimoto
8f477b00da renderer/termio attach thread local state for crash capture 2024-09-01 14:15:12 -07:00
Qwerasd
ff0c1141da renderer: add updateFrame critical region timings for dev benchmark 2024-08-27 01:23:29 -04:00
Mitchell Hashimoto
cff907940f renderer: do not extend padding color if any cell has default bg color
Before, cells that were explicitly set to match the default bg color
were treated as if they did NOT have the default and extending would
occur. We now check the exact RGB of each cell.
2024-08-22 14:57:46 -07:00
Mitchell Hashimoto
37d19b3cef Merge pull request #2109 from edmz/block_hollow
Config: cursor-style can bet set to block_hollow
2024-08-18 15:08:08 -07:00
Mitchell Hashimoto
2ee54879a4 renderer: use fg as extension color for covering glyphs (U+2588)
Fixes #2099

This is another heuristic of sorts to make `window-padding-color=extend`
look better by default. If a fully covering glyph is used then we use
the fg color to extend rather than the background.

This doesn't account for fonts that may do this for whatever codepoints,
but I think that's a special scenario that we should just recommend
disabling this feature.
2024-08-18 11:56:50 -07:00
Eduardo Dominguez
2e70ad20df Config: cursor-style can bet set to block_hollow
`cursor-style` can now also be set to `block_hollow`, no other changes
in behaviour are added.
2024-08-16 15:25:44 -06:00
Mitchell Hashimoto
b660380b01 renderer: yeet usingns 2024-08-16 10:43:32 -07:00
Qwerasd
37872afbce kitty graphics: support loading 1 channel grayscale images 2024-08-15 21:38:46 -04:00
Mitchell Hashimoto
78e9e9f93a Merge pull request #2100 from qwerasd205/mac-opengl
macos/opengl: lock context while rendering to stop resize crashes
2024-08-15 14:25:20 -07:00
Mitchell Hashimoto
bc667714dd renderer/opengl: add comment explaning ogl lock on darwin 2024-08-15 14:25:05 -07:00
Qwerasd
4c2fbe8f74 fix(renderer/Metal): bail out of drawFrame if we haven't sized screen yet 2024-08-15 15:12:49 -04:00
Qwerasd
57d850822e macos/opengl: lock context while rendering to stop resize crashes 2024-08-14 23:47:33 -04:00
Qwerasd
900aab10f2 renderer: don't update frame if renderer grid size != terminal size 2024-08-14 22:43:58 -04:00
Qwerasd
7929e0bc09 fix: prevent flicker while shrinking screen by eliminating thread race
Before this fix, if vsync was on the GPU cells buffer could be cleared
for a frame while resizing the terminal down. This was due to the fact
that the surface sent messages for the resize to both the renderer and
the IO thread. If the renderer thread was processed first then the GPU
cells buffer(s) would be cleared and not rebuilt, because the terminal
state would be larger than the GPU cell buffers causing updateFrame to
bail out early, leaving empty cell buffers.

This fixes the problem by changing the origin of the renderer's resize
message to be the IO thread, only after properly updating the terminal
state, to avoid clearing the GPU cells buffers at a time they can't be
successfully rebuilt.
2024-08-14 19:46:24 -04:00
Qwerasd
10b8ca3c69 spelling: normalize grey -> gray 2024-08-11 18:31:01 -04:00
Mitchell Hashimoto
bac258e6d2 renderer: fix underflow possibility in padding calculation 2024-08-10 21:00:04 -07:00
Mitchell Hashimoto
f7f8c655df renderer: remove alt-screen extend-always 2024-08-10 10:39:10 -07:00
Mitchell Hashimoto
9f06e74353 config: add window-padding-color=extend-always to force always 2024-08-10 10:34:12 -07:00
Mitchell Hashimoto
40b3d4c72e config: clarify padding color default 2024-08-10 10:27:59 -07:00
Mitchell Hashimoto
861fe0379b metal: cell bg pipeline no longer has vertex data, needs no vertex desc
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.
2024-08-09 15:10:58 -07:00
Mitchell Hashimoto
e4b8cac7ad renderer/opengl: reset screen uniforms on font change
Fixes #2067
2024-08-09 10:26:46 -07:00
Qwerasd
f47ab3e5b5 fix: add Contents.bgCell to avoid accidentally indexing with undersized ints 2024-08-08 21:02:26 -04:00
Qwerasd
740dce6e66 fix: promote dimensions to usize so cell_count doesn't overflow 2024-08-08 20:43:47 -04:00
Qwerasd
bdbf5ad1c7 remove superfluous slicing syntax 2024-08-08 19:10:00 -04:00
Qwerasd
e4ab550ea1 comment 2024-08-08 19:09:30 -04:00
Qwerasd
732483c08a renderer/metal: use memset to clear bg cell rows 2024-08-08 19:05:42 -04:00
Qwerasd
d68906563e renderer/metal: properly support padding color = background (not extend) 2024-08-08 19:03:39 -04:00
Qwerasd
e5241cb659 renderer/Metal: remove extraneous len arg from drawCellBgs 2024-08-07 18:30:44 -04:00
Qwerasd
3a58b89ef1 fix: use single triangle for metal post shader vertex 2024-08-07 18:17:49 -04:00
Qwerasd
76dc157675 fix tests 2024-08-07 18:02:11 -04:00
Qwerasd
6339f9bae9 renderer: metal shaders rework
- 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.
2024-08-07 17:39:31 -04:00
Mitchell Hashimoto
c116d147d6 build: build metal lib 2024-08-06 15:30:48 -07:00
Mitchell Hashimoto
14a42fcdb7 renderer/metal: load shaders from precompiled lib 2024-08-06 15:05:10 -07:00
Mitchell Hashimoto
e5a087e143 renderer/metal: fix warnings compiling metal shader 2024-08-06 10:43:57 -07:00
Mitchell Hashimoto
389cc95394 renderer/metal: powerline enum value used wrong value 2024-08-06 10:22:08 -07:00
Mitchell Hashimoto
0f8ed39766 Merge pull request #2049 from pluiedev/fix/exempt-powerline-from-minimum-contrast
renderer: exempt Powerline cells from minimum contrast requirements
2024-08-06 10:12:14 -07:00
Mitchell Hashimoto
247d5e4411 renderer/opengl: comptime assertion to verify 2024-08-06 10:07:08 -07:00
Mitchell Hashimoto
5be3098963 comment 2024-08-06 10:04:56 -07:00
Leah Amelia Chen
503dfae6ff renderer: exempt Powerline cells from minimum contrast requirements
With a minimum contrast set, the colored glyphs that Powerline uses
would sometimes be set to white or black while the surrounding background
colors remain unchanged, breaking up contiguous colors on segments of
the Powerline.

This no longer happens with this patch as Powerline glyphs are now
special-cased and exempt from the minimum contrast adjustment.
2024-08-06 15:28:50 +08:00
Łukasz Niemier
f9be02a20f chore: clean up typos 2024-08-05 13:56:57 +02:00
Mitchell Hashimoto
ea551990eb renderer: disable window-padding-color=extend in certain scenarios
There are scenarios where this configuration looks bad. This commit
introduces some heuristics to prevent it. Here are the heuristics:

  * Extension is always enabled on alt screen.
  * Extension is disabled if a row contains any default bg color. The
    thinking is that in this scenario, using the default bg color looks
    just fine.
  * Extension is disabled if a row is marked as a prompt (using semantic
    prompt sequences). The thinking here is that prompts often contain
    perfect fit glyphs such as Powerline glyphs and those look bad when
    extended.

This introduces some CPU cost to the extension feature but it should be
minimal and respects dirty tracking. This is unfortunate but the feature
makes many terminal scenarios look much better and the performance cost
is minimal so I believe it is worth it.

Further heuristics are likely warranted but this should be a good
starting set.
2024-08-03 21:56:19 -07:00
Mitchell Hashimoto
1cc5a69c43 Revert "renderer/metal: can access grid metrics directly on font grid"
This reverts commit 172179bbff7d3f0df73ba1c29c6906b69ead2619.
2024-08-03 18:37:42 -07:00
Mitchell Hashimoto
172179bbff renderer/metal: can access grid metrics directly on font grid
Its never recalculated so we don't need a lock.
2024-08-03 18:37:15 -07:00
Mitchell Hashimoto
56b3aa0b5e renderer/metal: font grid change should run all screen size logic 2024-08-03 18:33:53 -07:00
Mitchell Hashimoto
ed1c163c7b renderer/opengl: support window-padding-color=extend 2024-08-03 16:29:17 -07:00
Mitchell Hashimoto
55e8c421b5 config: add window-padding-color 2024-08-03 16:14:14 -07:00
Mitchell Hashimoto
9214db3c5f renderer/metal: handle top/left 2024-08-03 16:03:42 -07:00