Commit Graph

11 Commits

Author SHA1 Message Date
Uzair Aftab
4a22eed6d9 renderer/metal: fix 2x sizeof over-allocation in Buffer.sync
Buffer.sync and Buffer.syncFromArrayLists computed the new buffer size
in bytes (req_bytes * 2) and then multiplied by @sizeOf(T) again when
passing it to newBufferWithLength:, allocating data.len * sizeOf(T)^2 * 2
bytes. For the 32-byte CellText buffers this is a 64x over-allocation
and for the 4-byte CellBg buffers 8x, per swap-chain frame (e.g. ~9.4MB
instead of ~300KB per frame for a full 120x40 screen of text).

Match the OpenGL buffer implementation: track the new length in units
of T and multiply by @sizeOf(T) exactly once.
2026-07-27 23:42:06 +02:00
Mitchell Hashimoto
dbfc3eb679 Remove unused imports 2025-11-27 13:37:53 -08:00
Qwerasd
6d5b4a3426 perf: replace std.debug.assert with inlined version
See doc comment in `quirks.zig` for reasoning
2025-11-17 12:13:56 -07:00
Qwerasd
371d62a82c renderer: big rework, graphics API abstraction layers, unified logic
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.
2025-06-20 15:18:41 -06:00
Qwerasd
ea16890fd3 Metal: use "Managed" resource storage mode on discrete GPUs
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.
2025-02-07 13:15:18 -05:00
Łukasz Niemier
f9be02a20f chore: clean up typos 2024-08-05 13:56:57 +02:00
Mitchell Hashimoto
910ef97080 renderer/metal: zig fmt 2024-07-23 10:02:02 -07:00
Qwerasd
adf211f5d5 renderer/Metal: ArrayList cell Contents rows
This will allow for unlimited glyphs per row, eliminating the issue run in to with multi-substitution glyphs and combining characters which can result in more glyphs in a row than there are columns.
2024-05-07 19:19:06 -04:00
Mitchell Hashimoto
4f2ee95ecd renderer/metal: docs 2024-05-01 20:31:49 -07:00
Mitchell Hashimoto
1d41a3ccff renderer/metal: start setting up per-frame state 2024-04-22 10:42:35 -07:00
Mitchell Hashimoto
5229cb93d2 renderer/metal: extract helpers for shaders/buffers 2023-08-22 08:49:34 -07:00