diff --git a/bypy/linux/__main__.py b/bypy/linux/__main__.py index 6d7cd3611..04d7d0411 100644 --- a/bypy/linux/__main__.py +++ b/bypy/linux/__main__.py @@ -127,6 +127,22 @@ def copy_libs(env) -> None: shutil.copy2(os.path.join(BIN, 'slangc'), env.bin_dir) +def check_gpu_drivers(env) -> None: + # Both GPU drivers must be part of the build, along with the built-in + # shaders compiled for their shader targets, otherwise kitty silently + # falls back to whichever driver is present + print('Checking GPU drivers...') + ext_dir = os.path.join(env.lib_dir, 'kitty-extensions') + shaders_dir = os.path.join(env.lib_dir, 'kitty', 'shaders') + for driver, target_prefix in (('opengl', 'glsl-'), ('vulkan', 'spirv-')): + path = os.path.join(ext_dir, f'kitty.{driver}.so') + if not os.path.isfile(path): + raise SystemExit(f'The {driver} GPU driver was not built, {path} does not exist') + targets = [x for x in os.listdir(shaders_dir) if x.startswith(target_prefix) and os.path.isfile(os.path.join(shaders_dir, x, 'cell.json'))] + if not targets: + raise SystemExit(f'The built-in shaders were not compiled for the {driver} GPU driver in {shaders_dir}') + + def add_ca_certs(env) -> None: print('Downloading CA certs...') from urllib.request import urlopen @@ -258,6 +274,7 @@ def main() -> None: env = Env(os.path.join(ext_dir, kitty_constants['appname'])) copy_libs(env) copy_python(env) + check_gpu_drivers(env) iv['build_frozen_launcher']([path_to_freeze_dir(), env.obj_dir]) files = find_binaries(env) fix_permissions(files) diff --git a/bypy/sources.json b/bypy/sources.json index 411888403..2980dc8d0 100644 --- a/bypy/sources.json +++ b/bypy/sources.json @@ -298,6 +298,16 @@ } }, + { + "name": "vulkan-headers 1.4.363", + "os": "linux", + "unix": { + "file_extension": "tar.gz", + "hash": "sha256:cbaf687d3c59b9666fe080e7f8396b6b4f4d344a768ee6b337c59852f4526b68", + "urls": ["https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v{version}.{file_extension}"] + } + }, + { "name": "wayland-protocols 1.49", "os": "linux", diff --git a/docs/build.rst b/docs/build.rst index e4579f3c6..8cf1bcb0d 100644 --- a/docs/build.rst +++ b/docs/build.rst @@ -106,6 +106,8 @@ Build-time dependencies: * ``gcc`` or ``clang`` * ``simde`` * ``shader-slang`` +* ``vulkan-headers`` (needed only on Linux and BSD, to build the Vulkan GPU driver, + without them kitty uses only OpenGL) * ``go`` >= _build_go_version (see :file:`go.mod` for go packages used during building) * ``pkg-config`` * Symbols NERD Font Mono either installed system-wide or placed in :file:`fonts/SymbolsNerdFontMono-Regular.ttf`