<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ghostty.git/src/renderer/metal/api.zig, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/'/>
<entry>
<title>renderer: big rework, graphics API abstraction layers, unified logic</title>
<updated>2025-06-20T21:18:41+00:00</updated>
<author>
<name>Qwerasd</name>
<email>qwerasd205@users.noreply.github.com</email>
</author>
<published>2025-06-16T23:44:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=371d62a82ce26a6dd7c61d0175759f2d53771065'/>
<id>371d62a82ce26a6dd7c61d0175759f2d53771065</id>
<content type='text'>
This commit is very large, representing about a month of work with many
interdependent changes that don't separate cleanly in to atomic commits.

The main change here is unifying the renderer logic to a single generic
renderer, implemented on top of an abstraction layer over OpenGL/Metal.

I'll write a more complete summary of the changes in the description of
the PR.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This commit is very large, representing about a month of work with many
interdependent changes that don't separate cleanly in to atomic commits.

The main change here is unifying the renderer logic to a single generic
renderer, implemented on top of an abstraction layer over OpenGL/Metal.

I'll write a more complete summary of the changes in the description of
the PR.
</pre>
</div>
</content>
</entry>
<entry>
<title>chore: improve Metal API definitions a bit</title>
<updated>2025-06-20T21:18:41+00:00</updated>
<author>
<name>Qwerasd</name>
<email>qwerasd205@users.noreply.github.com</email>
</author>
<published>2025-01-19T21:47:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=f40cd3cae3469da4c5a70e637c3243d7a4c2f804'/>
<id>f40cd3cae3469da4c5a70e637c3243d7a4c2f804</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix(Metal): use sRGB texture format for gamma correct interpolation</title>
<updated>2025-05-15T18:44:44+00:00</updated>
<author>
<name>Qwerasd</name>
<email>qwerasd205@users.noreply.github.com</email>
</author>
<published>2025-05-15T18:06:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=e2f3b6211f87ff81c38043d66de21c73e577bebf'/>
<id>e2f3b6211f87ff81c38043d66de21c73e577bebf</id>
<content type='text'>
otherwise images will be too dark when scaled
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
otherwise images will be too dark when scaled
</pre>
</div>
</content>
</entry>
<entry>
<title>Lots of 0.14 changes</title>
<updated>2025-03-12T16:55:52+00:00</updated>
<author>
<name>Mitchell Hashimoto</name>
<email>m@mitchellh.com</email>
</author>
<published>2025-03-12T16:55:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=0f4d2bb2375c707182dba8cf2dd7723a2e918e79'/>
<id>0f4d2bb2375c707182dba8cf2dd7723a2e918e79</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Metal: use "Managed" resource storage mode on discrete GPUs</title>
<updated>2025-02-07T18:15:18+00:00</updated>
<author>
<name>Qwerasd</name>
<email>qwerasd205@users.noreply.github.com</email>
</author>
<published>2025-02-07T17:19:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=ea16890fd3388781c6cfe3b62d7222a9da620401'/>
<id>ea16890fd3388781c6cfe3b62d7222a9da620401</id>
<content type='text'>
Discrete GPUs cannot use the "shared" storage mode. This causes
undefined behavior right now, and I believe it's what's causing a
problem on Intel systems with discrete GPUs with "inverted" cells.

This commit also sets the CPU cache mode to "write combined" for our
resources since we don't read them back so Metal can optimize them
further with this hint.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Discrete GPUs cannot use the "shared" storage mode. This causes
undefined behavior right now, and I believe it's what's causing a
problem on Intel systems with discrete GPUs with "inverted" cells.

This commit also sets the CPU cache mode to "write combined" for our
resources since we don't read them back so Metal can optimize them
further with this hint.
</pre>
</div>
</content>
</entry>
<entry>
<title>Metal: blend in Display P3 color space, add option for linear blending</title>
<updated>2025-01-13T21:50:29+00:00</updated>
<author>
<name>Qwerasd</name>
<email>qwerasd205@users.noreply.github.com</email>
</author>
<published>2025-01-10T18:43:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=fca336c32d6e6659b04803c7e3a1f1ad1378b840'/>
<id>fca336c32d6e6659b04803c7e3a1f1ad1378b840</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>iOS: Fix crash on device</title>
<updated>2025-01-06T14:01:41+00:00</updated>
<author>
<name>yonihemi</name>
<email>2340723+yonihemi@users.noreply.github.com</email>
</author>
<published>2025-01-06T14:01:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=63a47d0ba573fea37a6d96630aba1a7e466f9e93'/>
<id>63a47d0ba573fea37a6d96630aba1a7e466f9e93</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>renderer/metal: prefer low‐power GPUs</title>
<updated>2024-11-04T00:35:21+00:00</updated>
<author>
<name>Emily</name>
<email>hello@emily.moe</email>
</author>
<published>2024-11-02T17:48:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=20a77123d43841fc873dc3b57d337ae6cad51868'/>
<id>20a77123d43841fc873dc3b57d337ae6cad51868</id>
<content type='text'>
Some Intel MacBook Pro laptops have both an integrated and discrete
GPU and support automatically switching between them. The system
uses the integrated GPU by default, but the default Metal device on
those systems is the discrete GPU. This means that Metal‐using
applications activate it by default, presumably as the intended
audience is high‐performance graphics applications.

This is unfortunate for productivity applications like terminals,
however, as the discrete GPU decreases battery life and worsens the
thermal throttling problems these machines have always had. Prefer
to use an integrated GPU when present and not using an external GPU.

The behaviour should be unchanged on Apple Silicon, as the platform
only supports one GPU. I have confirmed that the resulting app runs,
works, and doesn’t activate the AMD GPU on my MacBook Pro, but have
not done any measurements of the resulting performance impact. If
it is considered sufficiently noticeable, a GPU preference setting
could be added.

See &lt;https://github.com/zed-industries/zed/issues/5124&gt;,
&lt;https://github.com/zed-industries/zed/pull/13685&gt;,
&lt;https://github.com/zed-industries/zed/pull/14738&gt;, and
&lt;https://github.com/zed-industries/zed/pull/14744&gt; for discussion,
measurements, and changes relating to this issue in the Zed
project. The logic implemented here reflects what Zed ended up
settling on.

The [Metal documentation] recommends using
`MTLCopyAllDevicesWithObserver` to receive notifications of when
the list of available GPUs changes, such as when [external GPUs
are connected or disconnected]. I didn’t bother implementing that
because it seemed like a lot of fussy work to deal with migrating
everything to a new GPU on the fly just for a niche use case on a
legacy platform. Zed doesn’t implement it and I haven’t heard
about anyone complaining that their computer caught fire when they
unplugged an external GPU, so hopefully it’s fine.

[Metal documentation]: https://developer.apple.com/documentation/metal/gpu_devices_and_work_submission/multi-gpu_systems/finding_multiple_gpus_on_an_intel-based_mac
[external GPUs are connected or disconnected]: https://developer.apple.com/documentation/metal/gpu_devices_and_work_submission/multi-gpu_systems/handling_external_gpu_additions_and_removals

Closes: #2572
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some Intel MacBook Pro laptops have both an integrated and discrete
GPU and support automatically switching between them. The system
uses the integrated GPU by default, but the default Metal device on
those systems is the discrete GPU. This means that Metal‐using
applications activate it by default, presumably as the intended
audience is high‐performance graphics applications.

This is unfortunate for productivity applications like terminals,
however, as the discrete GPU decreases battery life and worsens the
thermal throttling problems these machines have always had. Prefer
to use an integrated GPU when present and not using an external GPU.

The behaviour should be unchanged on Apple Silicon, as the platform
only supports one GPU. I have confirmed that the resulting app runs,
works, and doesn’t activate the AMD GPU on my MacBook Pro, but have
not done any measurements of the resulting performance impact. If
it is considered sufficiently noticeable, a GPU preference setting
could be added.

See &lt;https://github.com/zed-industries/zed/issues/5124&gt;,
&lt;https://github.com/zed-industries/zed/pull/13685&gt;,
&lt;https://github.com/zed-industries/zed/pull/14738&gt;, and
&lt;https://github.com/zed-industries/zed/pull/14744&gt; for discussion,
measurements, and changes relating to this issue in the Zed
project. The logic implemented here reflects what Zed ended up
settling on.

The [Metal documentation] recommends using
`MTLCopyAllDevicesWithObserver` to receive notifications of when
the list of available GPUs changes, such as when [external GPUs
are connected or disconnected]. I didn’t bother implementing that
because it seemed like a lot of fussy work to deal with migrating
everything to a new GPU on the fly just for a niche use case on a
legacy platform. Zed doesn’t implement it and I haven’t heard
about anyone complaining that their computer caught fire when they
unplugged an external GPU, so hopefully it’s fine.

[Metal documentation]: https://developer.apple.com/documentation/metal/gpu_devices_and_work_submission/multi-gpu_systems/finding_multiple_gpus_on_an_intel-based_mac
[external GPUs are connected or disconnected]: https://developer.apple.com/documentation/metal/gpu_devices_and_work_submission/multi-gpu_systems/handling_external_gpu_additions_and_removals

Closes: #2572
</pre>
</div>
</content>
</entry>
<entry>
<title>renderer: metal shaders rework</title>
<updated>2024-08-07T21:39:31+00:00</updated>
<author>
<name>Qwerasd</name>
<email>qwerasd205@users.noreply.github.com</email>
</author>
<published>2024-08-07T21:39:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=6339f9bae959398f81f356ba923555b9fdf6462a'/>
<id>6339f9bae959398f81f356ba923555b9fdf6462a</id>
<content type='text'>
- 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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- 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.
</pre>
</div>
</content>
</entry>
<entry>
<title>renderer/metal: grid pos for bg/text should be ushort2</title>
<updated>2024-04-26T02:16:40+00:00</updated>
<author>
<name>Mitchell Hashimoto</name>
<email>mitchell.hashimoto@gmail.com</email>
</author>
<published>2024-04-26T02:16:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/ghostty.git/commit/?id=ced8776120d2dbd7ebeab6d538a9958e44fb44ff'/>
<id>ced8776120d2dbd7ebeab6d538a9958e44fb44ff</id>
<content type='text'>
This saves 50% memory per vertex.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This saves 50% memory per vertex.
</pre>
</div>
</content>
</entry>
</feed>
