403 Commits

Author SHA1 Message Date
Julia
9c8c53bffb use main buffer and copy data to fbo texture (opengl) (#5294)
NEEDS REVIEW

continuation of #5037
resolves #4729 

renders all shaders to the default buffer and then copies it to the
designated custom shader texture.

this is a draft pr because:
- it introduces a new shader "pipeline" which doesnt fit in with how the
system was designed to work (which is only rendering to the fbo)
- im not sure if this is the best way to achieve shaders being able to
sample their output while also drawing to the screen. the cusom fbo
(previous implementation) was useful in that it modularized the custom
shader stage in rendering

---------

Co-authored-by: Mitchell Hashimoto <m@mitchellh.com>
2025-01-23 20:57:14 +00:00
Qwerasd
c2da843dfd fix(wuffs): don't premul alpha when loading images
It seems like the raw data version of the kitty graphics transmit
operation is meant to be unassociated (aka straight) alpha, though I
can't find any definitive documentation either way- but in any case
unassociated alpha is more common in image formats and makes the
handling easier for the rest of it.

Also removed a redundant call to `decode_frame_config`, since it's
called implicitly when we call `decode_frame` right after.
2025-01-17 14:38:38 -05:00
Qwerasd
fca336c32d Metal: blend in Display P3 color space, add option for linear blending
This commit is quite large because it's fairly interconnected and can't
be split up in a logical way. The main part of this commit is that alpha
blending is now always done in the Display P3 color space, and depending
on the configured `window-colorspace` colors will be converted from sRGB
or assumed to already be Display P3 colors. In addition, a config option
`text-blending` has been added which allows the user to configure linear
blending (AKA "gamma correction"). Linear alpha blending also applies to
images and makes custom shaders receive linear colors rather than sRGB.

In addition, an experimental option has been added which corrects linear
blending's tendency to make dark text look too thin and bright text look
too thick. Essentially it's a correction curve on the alpha channel that
depends on the luminance of the glyph being drawn.
2025-01-13 13:50:29 -08:00
Jan200101
0493b79caf don't make library building logic public 2025-01-03 22:42:29 +01:00
Jan200101
1dc9157727 always link system freetype2 using pkg-config 2025-01-03 22:42:01 +01:00
Jan200101
72e0fb14fe don't build freetype2 when system integration is enabled 2025-01-03 22:41:15 +01:00
Jan200101
dc90ef776e don't build oniguruma when system integration is enabled 2025-01-03 21:27:22 +01:00
Jan200101
9d286de834 don't build fontconfig when system integration is enabled 2025-01-03 18:39:11 +01:00
Mitchell Hashimoto
7eb35d7275 Fix: Correct version strings for simdutf and cimgui to match vendored files (#4468)
The cimgui version listed does not match the upstream commit or the
vendored cimgui files
Checking the upstream `git log` the commit corresponds to `commit
e391fe2e66eb1c96b1624ae8444dc64c23146ef4 (tag: v1.90.6-docking)` however
the `build.zig.zon` is outdated.
The vendored cimgui files also contain the header
```cpp
// This file is automatically generated by generator.lua from
// https://github.com/cimgui/cimgui based on imgui.h file version "1.90.6" 19060
// from Dear ImGui https://github.com/ocornut/imgui with imgui_internal.h api
// docking branch
```

I wasn't too clear with what the comment meant:
```
// This should be kept in sync with the submodule in the cimgui source
// code to be safe that they're compatible.
```
and assumed it was referring to the vendored cimgui files, added a
comment pointing out where to find the cimgui source mentioned.
2025-01-03 09:13:52 -08:00
azhn
65a0fa4f35 Fix: Update pkg/simdutf/build.zig.zon to match vendored version 2025-01-03 18:22:24 +11:00
azhn
29f040716c Fix cimgui version string to match pkg/cimgui/vendor/ and the upstream version 2025-01-03 17:47:50 +11:00
Mitchell Hashimoto
405fe377d2 wuffs: update, add jpeg decoding, add simple tests (#4250)
1. Update wuffs to v0.4.0-alpha.9
2. Add JPEG decoding
3. Add basic unit tests for image decoding
4. Add CI jobs to run wuffs unit tests.
2025-01-02 15:24:28 -08:00
Jeffrey C. Ollie
22c2fe9610 wuffs: use common struct to return decoded image data 2025-01-01 22:48:30 -06:00
Jeffrey C. Ollie
652079b26c wuffs: update, add jpeg decoding, add simple tests 2025-01-01 22:48:30 -06:00
Jan200101
5957e1101c don't build harfbuzz when system integration is enabled 2024-12-31 21:09:13 +01:00
Mitchell Hashimoto
c74966e07e build: change object story domain to ghostty.org 2024-12-20 08:58:46 -08:00
Qwerasd
5cd214066d font(coretext): tolerate fonts without OS/2 tables
This creates big problems if we don't, since a lot of symbols end up
falling back to Apple Gothic, which doesn't have an OS/2 table.
2024-12-16 14:52:07 -05:00
Qwerasd
8a5d484729 font: more robust extraction of vertical metrics from tables
Previously always assuming the typo metrics were good caused some fonts
to have abnormally short cell heights.
2024-12-13 13:00:03 -05:00
Qwerasd
fb50143cec font(coretext): add metrics test case for CT, fix variable font init
Variable font init used to just select the first available predefined
instance, if there were any, which is often not desirable- using
createFontDescriptorFromData instead of createFontDescritorsFromData
ensures that the default variation config is selected. In the future we
should probably allow selection of predefined instances, but for now
this is the correct behavior.

I found this bug when adding the metrics calculation test case for
CoreText, hence why fixing it is part of the same commit.
2024-12-11 21:14:21 -05:00
Qwerasd
bd18452310 font: unify metrics calculations & separate sprite metrics
Unify grid metrics calculations by relying on shared logic mostly based
on values directly from the font tables, this deduplicates a lot of code
and gives us more control over how we interpret various metrics.

Also separate metrics for underlined, strikethrough, and overline
thickness and position, and box drawing thickness, so that they can
individually be adjusted as the user desires.
2024-12-11 16:55:52 -05:00
Nyaa97
7eb5563e9c Fix linking freetype and glslang 2024-10-30 16:43:41 -04:00
Mitchell Hashimoto
1aa932f810 font/coretext: use CTFontCreateForString for final codepoint fallback
Fixes #2499

We rely on CoreText's font discovery to find the best font for a
fallback by using the character set attribute. It appears that for some
codepoints, the character set attribute is not enough to find a font
that supports the codepoint.

In this case, we use CTFontCreateForString to find the font that
CoreText would use. The one subtlety here is we need to ignore the
last resort font, which just has replacement glyphs for all codepoints.

We already had a function to do this for CJK characters (#1637)
thankfully so we can just reuse that!

This also fixes a bug where CTFontCreateForString range param expects
the range length to be utf16 code units, not utf32.
2024-10-25 21:29:45 -07:00
Mitchell Hashimoto
8bb8b01e54 build: use Zig system packaging options
This allows dynamically linking against system libraries, which is
particularly useful for packaging.
2024-10-24 14:46:37 -07:00
Qwerasd
d38d0f30c4 font/sprite: replace pixman with z2d, extend Box coverage
More complete coverage of the Symbols For Legacy Computing block,
including characters from Unicode 16.0.

Pixman and the web canvas impl for Canvas have been removed in favor of
z2d for drawing, since it has a nicer API with more powerful methods,
and is in Zig with no specific platform optimizations so should compile
to wasm no problem.
2024-10-14 17:50:49 -04:00
Qwerasd
3ec36e4d23 coretext: improve strikethrough position calculation 2024-09-23 19:01:15 -06:00
Mitchell Hashimoto
c26da4ea06 pkg/macos: expose carbon API 2024-09-19 09:22:07 -07:00
Mitchell Hashimoto
35e11c09e0 pkg: add README and license 2024-09-13 19:55:11 -07:00
Jeffrey C. Ollie
f2d53b451b wuffs: fix blend mode 2024-09-04 18:23:54 -05:00
Mitchell Hashimoto
5f1c9dd0df pkg/wuffs: use proper apple include paths on darwin targets 2024-09-02 21:02:36 -07:00
Mitchell Hashimoto
781a721fc7 pkg/wuffs: fix builds for 32-bit systems 2024-09-02 20:57:23 -07:00
Mitchell Hashimoto
de612934a0 some tweaks for wuffs 2024-09-02 20:47:07 -07:00
Mitchell Hashimoto
c6e187865a pkg/wuffs: define build defines separately, not in defs.zig 2024-09-02 20:47:07 -07:00
Jeffrey C. Ollie
d6e5c8e20f remove unnecessary @constCast 2024-09-02 20:47:07 -07:00
Jeffrey C. Ollie
6edeb45e7e kitty graphics: address review comments
- move wuffs code from src/ to pkg/
- eliminate stray debug logs
- make logs a warning instead of an error
- remove initialization of some structs to zero
2024-09-02 20:47:07 -07:00
Mitchell Hashimoto
d8cc19612f crash: beforeSend needs to add contexts to the event directly 2024-09-02 09:55:57 -07:00
Mitchell Hashimoto
f0916d58e8 crash: try to attach dimensions to the crash report 2024-09-01 14:15:11 -07:00
Mitchell Hashimoto
72c1b00b0b pkg/sentry: uuid string is null-terminated 2024-08-31 14:05:55 -07:00
Mitchell Hashimoto
920a1051e5 crash: discard envelopes that do not contain a crash 2024-08-31 12:24:11 -07:00
Mitchell Hashimoto
0f35f6267e pkg/breakpad: add linux_syscall_support.h to the vendored files 2024-08-28 21:43:18 -07:00
Mitchell Hashimoto
7613e5f211 add pkg/breakpad, configure sentry to use breakpad 2024-08-28 21:43:18 -07:00
Mitchell Hashimoto
d66178718c pkg/sentry: build in unwinder 2024-08-28 21:43:18 -07:00
Mitchell Hashimoto
13f1752836 build: don't include sentry on windows 2024-08-28 21:43:18 -07:00
Mitchell Hashimoto
33e9bc14ef don't send empty envelopes 2024-08-28 21:43:18 -07:00
Mitchell Hashimoto
833efe9a81 pkg/sentry: fix darwin lib builds 2024-08-28 21:43:18 -07:00
Mitchell Hashimoto
2abdf291f4 implement sentry transport to write crash reports to XDG_STATE_HOME 2024-08-28 21:43:18 -07:00
Mitchell Hashimoto
e029490535 sentry init uses proper cache dir, sets tags 2024-08-28 21:43:18 -07:00
Mitchell Hashimoto
e4e9a19607 pkg/sentry: fix Linux builds 2024-08-28 21:43:17 -07:00
Mitchell Hashimoto
b11f0d5cc9 pkg/sentry: custom transports 2024-08-28 21:43:17 -07:00
Mitchell Hashimoto
1070068090 pkg/sentry: add more Zig APIs 2024-08-28 21:43:17 -07:00
Mitchell Hashimoto
2793cf8112 pkg/sentry: initial builds 2024-08-28 21:43:17 -07:00