https://github.com/mxpv/rules_vulkan
Bazel rules to build Vulkan applications
https://github.com/mxpv/rules_vulkan
bazel bazel-rules vulkan-sdk
Last synced: 4 months ago
JSON representation
Bazel rules to build Vulkan applications
- Host: GitHub
- URL: https://github.com/mxpv/rules_vulkan
- Owner: mxpv
- License: apache-2.0
- Created: 2025-06-05T16:21:44.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-10T06:11:26.000Z (about 1 year ago)
- Last Synced: 2025-06-10T06:32:52.349Z (about 1 year ago)
- Topics: bazel, bazel-rules, vulkan-sdk
- Language: Starlark
- Homepage:
- Size: 75.2 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rules_vulkan
[](https://github.com/mxpv/rules_vulkan/actions/workflows/ci.yml)
[](./LICENSE)
`rules_vulkan` is a set of [Bazel](https://bazel.build) rules for integrating the [Vulkan SDK](https://vulkan.lunarg.com/)
into your builds. It streamlines downloading, installing, and using Vulkan SDKs across major platforms.
- [Documentation](./docs/index.md)
- [Download SDK](https://vulkan.lunarg.com)
## Features
- Fully automated SDK installation.
- Maintains a list of [currently available](./vulkan/private/versions.bzl) SDK versions on `LunarG`.
- Toolchains for `GLSL`, `HLSL`, and `Slang`.
- Unit and integration tests on CI.
- A nice-looking AI-generated logo!
## :beginner: Getting started
To get started, you’ll need to fetch the Vulkan SDK and register the toolchains.
Add the following to your `MODULE.bazel` file:
```bazel
module(name = "hello")
bazel_dep(name = "rules_vulkan", version = "0.1")
vulkan_sdk = use_extension("@rules_vulkan//vulkan:extensions.bzl", "vulkan_sdk")
vulkan_sdk.download(version = "1.4.313.0")
use_repo(vulkan_sdk, "vulkan_sdk_1.4.313.0")
register_toolchains("@vulkan_sdk_1.4.313.0//:all")
```
Then use it in your `BUILD` files:
```bazel
load("@rules_vulkan//hlsl:shader.bzl", "hlsl_shader")
hlsl_shader(
name = "hello_hlsl",
src = "shader.hlsl",
entry = "CSMain",
target = "cs_6_0",
spirv = True,
)
cc_binary(
name = "app",
srcs = ["main.c"],
data = [":hello_hlsl"],
deps = ["@vulkan_sdk_1.4.313.0//:vulkan"],
)
```
Refer to `e2e` project [here](./e2e/smoke/) for a more complete setup.
## :cockroach: Known issues
- End-to-end tests on `Windows` are currently disabled in CI due to the missing `vulkan-1.dll`,
which is not included in the SDK package. This DLL is distributed separately as part of the Vulkan "runtime"
package and requires additional handling.
- On Windows, `dxc.exe` fails due to symlink issues—native_binary does not copy `dxcompiler.dll` to the output directory.
See [failed CI job](https://github.com/mxpv/rules_vulkan/actions/runs/15526978807/job/43708453464) for details.
- Slang doesn't like Linux (see [failed CI job](https://github.com/mxpv/rules_vulkan/actions/runs/15544365318/job/43762431714))
and requires deeper investigation.
## License
The project itself is licensed under [`Apache 2.0`](./LICENSE) license.
> [!NOTE]
> This project downloads packages from LunarG, please ensure you comply with their license terms.