Commit graph

633 commits

Author SHA1 Message Date
Kovid Goyal
8adf263398
Make shader targets driver defined and program metadata reflection based
Each GPU driver now declares the shader target it consumes (glsl-140 for
the OpenGL driver), a fixed property available as soon as the driver is
loaded. setup.py compiles the built-in shaders for the targets of the
drivers it builds, into a directory per target, and custom shaders are
compiled at runtime for the target of the loaded driver. The GLSL_VERSION
constant is no longer exported to Python.

The program metadata passed to the C code is now generated from the
reflection data produced by slangc and is backend neutral: vertex input
locations, uniform names, uniform block sizes and array layouts, all
identified by their names in the Slang source. Block sizes are verified
against the driver. The only target specific part is a map from Slang
names to the identifiers in the compiled code, which the OpenGL driver
needs to look up parameters by name and which is passed to the driver
when creating a pipeline. The driver no longer needs to be queried for
uniform array layouts.

The debug config output now uses the name reported by the driver.
2026-11-19 19:57:33 +05:30
Kovid Goyal
ab98897710
Move OpenGL context creation from glfw into the GPU driver
glfw is now a windowing only library. It no longer creates OpenGL
contexts and contains no GLX, EGL, NSGL or OSMesa code. Instead it
exposes native window handles, and the GPU driver creates surfaces that
render into them, owning everything needed to render and present, such
as OpenGL contexts or, in future, Vulkan swapchains.

The GPU driver API (now version 2) gains surfaces: creation from native
X11, Wayland and Cocoa windows, making current, resizing, presenting,
swap interval, handling native view changes and recreation (macOS) and
choosing the X11 visual before window creation. The OpenGL driver
implements them with GLX on X11, EGL on Wayland and NSGL on macOS, all
ported from glfw, loading every library at runtime.

glfw gains a GLFW_X11_VISUAL_ID window hint, a native surface changed
callback (used on macOS where the NSOpenGLContext must be updated) and
glfwWindowContentsPresented(), which on Wayland commits surface state
after a frame is presented. The OpenGL context API, hints and the
share parameter of glfwCreateWindow() are removed.

The macOS (NSGL) code is untested as it could not be built.
2026-11-19 19:57:33 +05:30
Kovid Goyal
b8c266a0d4
Move the kitty OpenGL code into a dynamically loaded GPU driver
All OpenGL calls now live in gpu/opengl, which is built as kitty/opengl.so,
next to the glfw backends. glfw_init() is passed the path to the driver and
loads it. The driver is initialized once the first OpenGL context is
current. fast_data_types no longer links against libGL.

kitty/gpu.c contains the driver loader and the higher level helpers
(programs and their metadata, vertex array objects, viewport stack) that
were previously in kitty/gl.c, implemented on top of the driver API.
shaders.c and the rest of kitty use only the driver API.

Also remove the unused GL_* constants and the unused bind_program,
create_vao, etc. functions exported to Python.
2026-11-19 19:57:32 +05:30
Kovid Goyal
02dd29ad14
Add nightly version to version string for nightly builds. Fixes #10751 2026-10-27 10:43:51 +05:30
Kovid Goyal
2dfaf0cc5e
Fix #10733 2026-10-25 08:07:41 +05:30
Kovid Goyal
8f0b7eff31
Encrypt sessions saved at logout with a key in the macOS Keychain
Every snapshot is encrypted with AES-256-GCM using a random key, stored
in the login keychain under a random id. The name of every file is
authenticated, so files cannot be swapped. The key is deleted before the
snapshot whenever it is removed, so copies of the snapshot left on disk
or in backups cannot be read.

The keychain is never allowed to show any UI. If storing the key fails
nothing is saved, if reading it fails the snapshot is deleted, with the
error logged in both cases.

The key is generated, stored and read only in C, in mlocked memory that
is cleared when freed, via a new random_secret() and the Keychain
functions in cocoa_window.m.
2026-10-16 11:57:31 +05:30
Kovid Goyal
05f4024dcc
Fix pipeline files not being added when building package 2026-09-23 10:38:09 +05:30
zhaolei
c43f500c16 Revert "macos: explicitly enable modern window corners on macOS 26"
This reverts commit b16221a1d3.
2026-08-24 15:00:57 +08:00
Kovid Goyal
07ea7583ac
Improve performance of SIMD UTF-8 decoding
Optimise the AVX 2 implementation reducing number of operations per block
and also add an AVX-512 implementation used when the CPU supports it at
runtime.
2026-08-16 20:25:03 +05:30
Kovid Goyal
f5ae245f65
Switch to perf for profiling from gperftools 2026-08-16 11:24:41 +05:30
Hassan Raza
111cd86f61
Relink when linker commands change 2026-08-12 16:21:24 +05:00
Kovid Goyal
5fc4189cfd
Autodetect bundled slangc when from from a dev.sh build 2026-08-12 10:12:47 +05:30
Kovid Goyal
e862e5febd
Honor verbose flag when building shaders 2026-08-05 05:32:56 +05:30
Kovid Goyal
7f0b072f0d
autoformat 2026-08-05 05:32:56 +05:30
Kovid Goyal
3799ad76b4
pep8 2026-08-05 05:32:55 +05:30
Kovid Goyal
5802d35198
Switch over to the slang based shaders 2026-08-05 05:32:54 +05:30
Kovid Goyal
1612a23307
Get slangc working in macOS frozen build 2026-08-05 05:32:50 +05:30
Kovid Goyal
7cde77ef2c
Get freezing of slang on linux working 2026-08-05 05:32:50 +05:30
Kovid Goyal
676b838c0d
Move glfw build code into setup.py
This was on my TODO list for a long time and doing this allows the
setup.py module code to be re-used in slang.py
2026-08-05 05:32:50 +05:30
Kovid Goyal
5f082b1cee
Fix building of shaders under ASAN
We cant import fast_data_types.so into the system python in that case,
so build shaders by running the compiler under the kitty launcher.
2026-08-05 05:32:50 +05:30
Kovid Goyal
6008d09d25
Ensure shaders are built after fast_data_types.so 2026-08-05 05:32:50 +05:30
Kovid Goyal
c171ab8111
More work on slang compilation 2026-08-05 05:32:49 +05:30
Kovid Goyal
c8f74f7a56
More work on integrating slangc into the build pipeline 2026-08-05 05:32:49 +05:30
Kovid Goyal
0eb2d26a46
Setup location for compiled shaders 2026-08-05 05:32:49 +05:30
Kovid Goyal
b3781f4fa1
Use the slangc binary instead trying to get the C++ extension working everywhere is too fragile 2026-08-05 05:32:48 +05:30
Kovid Goyal
3a5b92af61
Get slangc building with clang 2026-08-05 05:32:48 +05:30
Kovid Goyal
9afa480de5
Move shaders into kitty package 2026-08-05 05:32:48 +05:30
Kovid Goyal
ca9945e547
Work on slang module compilation 2026-08-05 05:32:48 +05:30
Kovid Goyal
9f5339c6df
Stub slang module 2026-08-05 05:32:48 +05:30
Kovid Goyal
45a97ee5af
macOS: Disable macOS one time code autofill popups
Fixes #10250
2026-07-13 09:06:24 +05:30
Kovid Goyal
6614f402ee
...
Some checks are pending
CI / Linux (python=3.14 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.13 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
2026-07-05 20:03:36 +05:30
Kovid Goyal
a65b4c70a7
Migrate type checker to ty
Much faster than mypy. Matches usage of ruff from same developer.
2026-07-04 09:18:00 +05:30
Kovid Goyal
f6d1b11b29
Make arm64 binary deps available for dev.sh
Some checks are pending
CI / Linux (python=3.13 cc=clang sanitize=1) (push) Waiting to run
CI / Linux (python=3.11 cc=gcc sanitize=0) (push) Waiting to run
CI / Linux (python=3.12 cc=gcc sanitize=1) (push) Waiting to run
CI / Linux package (push) Waiting to run
CI / Bundle test (macos-latest) (push) Waiting to run
CI / Bundle test (ubuntu-latest) (push) Waiting to run
CI / macOS Brew (push) Waiting to run
CI / Test ./dev.sh and benchmark (push) Waiting to run
CodeQL / CodeQL-Build (actions, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, macos-latest) (push) Waiting to run
CodeQL / CodeQL-Build (c, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (go, ubuntu-latest) (push) Waiting to run
CodeQL / CodeQL-Build (python, ubuntu-latest) (push) Waiting to run
Depscan / Scan dependencies for vulnerabilities (push) Waiting to run
Fixes #10197
2026-06-27 17:29:31 +05:30
Kovid Goyal
2d18b88480
macOS: Switch to Tahoe style application icon 2026-04-18 13:28:22 +05:30
Kovid Goyal
c08409a981
Function to get machine ID on cocoa 2026-04-09 07:04:12 +05:30
Kovid Goyal
79cadf4a5f
... 2026-04-05 18:25:05 +05:30
Kovid Goyal
c977d1edcb
... 2026-03-17 08:22:45 +05:30
1024th
ffe8cef1a8 Fix font detection command on linux in setup.py 2026-03-13 01:03:20 +08:00
Kovid Goyal
a0709acdde
DRYer 2026-03-12 10:06:20 +05:30
Kovid Goyal
01104bac65
Fix a regression that broke `kitten update-self`
Fixes #9642
2026-03-12 08:33:20 +05:30
Kovid Goyal
c75bdc7620
Bump Go version for security vulnerabilities
Unfortunately means have to bump minimum macos version as well as Go
requires it.
2026-03-07 08:05:37 +05:30
Kovid Goyal
524fe6ae3b
Ignoring errors is the default behavior for os.walk 2026-01-31 08:28:10 +05:30
Kovid Goyal
0a01f41996
Only scan font dirs recursively if the font is not found in any top level dir 2026-01-31 08:26:57 +05:30
Mark Sisson
2035fe7fda
feat(setup): search macOS font directories recursively
Extend font lookup on macOS to scan subdirectories when the font is not found
in the top-level font directories. Permission errors during traversal are
silently ignored to avoid installation failures.
2026-01-30 14:57:07 -06:00
Kovid Goyal
3352dba735
Set building flag globally 2025-12-04 14:59:59 +05:30
Kovid Goyal
7e962f48fc
Allow simple_cli_definitions to be run on ASAN builds 2025-12-04 14:58:56 +05:30
Kovid Goyal
d7ab6ad314
Allow shader names with underscores 2025-08-13 07:10:16 +05:30
Kovid Goyal
c01df574a2
... 2025-08-13 06:49:35 +05:30
Kovid Goyal
b94d6dc713
Dont include gl.h in generated uniforms defn 2025-08-13 06:41:35 +05:30
Kovid Goyal
c06985c586
Cleanup previous PR 2025-06-30 12:09:13 +05:30