kitty/gpu
Kovid Goyal 6a297b6f06
Add a Metal GPU driver and an MSL shader target
On macOS, kitty now tries to render using Metal, falling back to OpenGL,
see the gpu_driver option. The driver has not yet been compiled or run
on macOS, it was written on Linux and only syntax checked against stub
headers.

Shader targets of the form msl-NN (for MSL N.N) compile each program to
a single MSL source file containing the entry points for all stages,
compiled by the driver at runtime, for the built-in and custom shaders.
slangc ignores [[vk::binding]] for Metal, so the program metadata keeps
the kitty binding slots and passes the argument table indices assigned
by slangc as native names. The push constant block, emitted as an
ordinary constant buffer, is recognized by the name of its type. As
Metal has y=1 at the top in NDC, the generated code is fixed up to
negate the y coordinate of the position output by vertex entry points.
Layouts that would differ because bool is a single byte in MSL are
rejected. The MSL is validated with the Metal compiler when available.
The MSL shaders are temporarily built on all platforms, for development.

The driver follows the design of the Vulkan driver: command buffers with
serials and at most three in flight, copy on write of buffer storage the
GPU may still use, private textures uploaded with blits from staging
memory, pipeline variants created when first used and a CAMetalLayer
per window. Vertex inputs whose offset or stride is not a multiple of
four bytes, as Metal requires, are repacked into a cached copy.
2026-11-19 19:57:33 +05:30
..
metal Add a Metal GPU driver and an MSL shader target 2026-11-19 19:57:33 +05:30
opengl Use the coordinate conventions of Vulkan and Metal for the GPU API 2026-11-19 19:57:33 +05:30
vulkan Add a Vulkan GPU driver 2026-11-19 19:57:33 +05:30
api.h Add a Vulkan GPU driver 2026-11-19 19:57:33 +05:30