| 1 |
KosmicKrisp |
| 2 |
########### |
| 3 |
|
| 4 |
KosmicKrisp is a Vulkan conformant implementation for macOS on Apple Silicon |
| 5 |
hardware. It is implemented on top of Metal 4, which requires macOS 26 and up. |
| 6 |
|
| 7 |
No iOS support is present as of now. However, iOS was taken into consideration |
| 8 |
during development to support A14 Bionic GPUs and upwards. |
| 9 |
|
| 10 |
Building |
| 11 |
******** |
| 12 |
|
| 13 |
The following build instructions assume Homebrew as the package manager to |
| 14 |
install dependencies. Homebrew homepage https://brew.sh/ |
| 15 |
Homebrew install command line: |
| 16 |
|
| 17 |
.. code-block:: sh |
| 18 |
|
| 19 |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
| 20 |
|
| 21 |
Terminal restart is recommended after Homebrew installation. |
| 22 |
|
| 23 |
Requirements |
| 24 |
============ |
| 25 |
|
| 26 |
- Xcode and Xcode command line tools |
| 27 |
- Homebrew packages |
| 28 |
- meson (1.9.1+, can also be installed as a Python package) |
| 29 |
- cmake |
| 30 |
- pkg-config |
| 31 |
- libclc |
| 32 |
- llvm |
| 33 |
- spirv-llvm-translator |
| 34 |
|
| 35 |
Due to potential conflicts, Homebrew will not add `llvm` to the path. To add |
| 36 |
`llvm` to future terminal instances: |
| 37 |
|
| 38 |
.. code-block:: sh |
| 39 |
|
| 40 |
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc |
| 41 |
|
| 42 |
To add `llvm` to current terminal instance: |
| 43 |
|
| 44 |
.. code-block:: sh |
| 45 |
|
| 46 |
export PATH="/opt/homebrew/opt/llvm/bin:$PATH" |
| 47 |
|
| 48 |
- Python |
| 49 |
- Python packages |
| 50 |
- mako |
| 51 |
- packaging |
| 52 |
- pyyaml |
| 53 |
- meson (1.9.1+, if not installed through Homebrew) |
| 54 |
|
| 55 |
Since Homebrew manages the Python environment, it is encouraged to create a |
| 56 |
Python virtual environment and install all packages in that environment. To |
| 57 |
create a Python virtual environment (e.g. ``$HOME/venv_mesa``): |
| 58 |
|
| 59 |
.. code-block:: sh |
| 60 |
|
| 61 |
python3 -m venv $HOME/venv_mesa |
| 62 |
|
| 63 |
To enable a Python virtual environment: |
| 64 |
|
| 65 |
.. code-block:: sh |
| 66 |
|
| 67 |
source $HOME/venv_mesa/bin/activate |
| 68 |
|
| 69 |
Build instructions |
| 70 |
================== |
| 71 |
|
| 72 |
Out of tree build directory is recommended. |
| 73 |
|
| 74 |
Once all requirements have been installed, the following command line can be |
| 75 |
used to create a debug build: |
| 76 |
|
| 77 |
.. code-block:: sh |
| 78 |
|
| 79 |
meson setup <path/to/mesa> --buildtype=debug -Dplatforms=macos -Dvulkan-drivers=kosmickrisp -Dgallium-drivers= -Dopengl=false -Dzstd=disabled |
| 80 |
|
| 81 |
Environment variables |
| 82 |
********************* |
| 83 |
|
| 84 |
KosmicKrisp specific environment variables: |
| 85 |
|
| 86 |
- ``MESA_KK_DEBUG``: ``msl`` to log all generated Metal Shading Language (MSL) shaders. ``force_robustness`` to force robustness on all shaders. |
| 87 |
- ``MESA_KK_GPU_CAPTURE``: Starts Metal capture at device create and ends it at device destroy. Set to ``1`` to activate. |
| 88 |
- ``MESA_KK_GPU_CAPTURE_DIRECTORY``: Metal capture will be saved to the specified directory. Defaults to Xcode if no path is provided. |
| 89 |
- ``MESA_KK_DISABLE_WORKAROUNDS``: Provide ``all`` to disable all workarounds. Otherwise, provide a comma separated list to disable wanted workarounds e.g. ``1,3,4`` to disable workaround 1, 3 and 4. |
| 90 |
|
| 91 |
Metal workarounds |
| 92 |
***************** |
| 93 |
|
| 94 |
Different workarounds are applied throughout the project to avoid issues such |
| 95 |
as: |
| 96 |
|
| 97 |
- Metal API and Vulkan API discrepancies |
| 98 |
- Metal bugs |
| 99 |
- MSL compiler bugs |
| 100 |
- MSL compiler crashes |
| 101 |
|
| 102 |
These workarounds can be found in: |
| 103 |
|
| 104 |
.. toctree:: |
| 105 |
:maxdepth: 1 |
| 106 |
|
| 107 |
kosmickrisp/workarounds |