rules_vulkan 0.9.0Latest published 4.2mo ago
MODULE.bazel
bazel_dep(name = "rules_vulkan", version = "0.9.0")
README

rules_vulkan

CI License Release

rules_vulkan is a set of Bazel rules for integrating the Vulkan SDK into your builds. It streamlines downloading, installing, and using Vulkan SDKs across major platforms.

Features

  • Fully automated SDK installation.
  • Maintains a list of currently available SDK versions on LunarG with automated nightly updates.
  • Toolchains and rules for GLSL, HLSL, and Slang.
  • Supports optional SDK components such as Volk and VMA.
  • Unit and integration tests on CI.
  • Available on BCR.
  • 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_dep(name = "rules_vulkan", version = "0.1")

vulkan_sdk = use_extension("@rules_vulkan//vulkan:extensions.bzl", "vulkan_sdk")

vulkan_sdk.toolchain(version = "1.4.313")
use_repo(vulkan_sdk, "vulkan_sdk_1.4.313")

register_toolchains("@vulkan_sdk_1.4.313//:all")

Then use it in your BUILD files:

load("@rules_vulkan//vulkan:defs.bzl", "hlsl_shader", "glsl_shader")

hlsl_shader(
    name = "hello_hlsl",
    src = "shader.hlsl",
    entry = "CSMain",
    target = "cs_6_0",
    opts = ["-spirv"],
    hdrs = [":common_headers"],
)

glsl_shader(
    name = "hello_glsl",
    src = "shader.glsl",
    stage = "comp",
)

cc_binary(
    name = "app",
    srcs = ["main.c"],
    data = [":hello_hlsl", ":hello_glsl"],
    deps = ["@vulkan_sdk_1.4.313//:vulkan"],
)

# Since the SDK repo exports all binaries, you can manually wrap any SDK binary not directly exposed
native_binary(
    name = "spirv_cross",
    src = select({
        "@platforms//os:windows": "@vulkan_sdk_1.4.313//:sdk/Bin/spirv-cross.exe",
        "//conditions:default": "@vulkan_sdk_1.4.313//:sdk/bin/spirv-cross",
    }),
)

[!WARNING] This project is under active development and no API stability is guaranteed until 1.0. Expect breaking changes during upgrades. Breaking changes are marked with the breaking label on pull requests.

⚡ Direct Binary Invocation

You can invoke SDK binaries directly using their pre-configured targets:

bazelisk run @vk_sdk//:spirv_cross -- --help
bazelisk run @vk_sdk//:glslc -- --version
bazelisk run @vk_sdk//:dxc -- --version
bazelisk run @vk_sdk//:slangc -- -h

Refer to e2e project here for a more complete setup.

License

The project itself is licensed under Apache 2.0 license.

[!NOTE] This project downloads packages from LunarG, please ensure you comply with their license terms.

About

Bazel rules to build Vulkan applications

@mxpv/rules_vulkan@mxpv
Homepage
8stars
Thursday, June 4, 2026
@mxpv#9129 rules_vulkan@0.9.0 (#9129)

Languages

Python9.3%
C4%
Slang0.4%
GLSL0.3%
HLSL0.3%

Maintainers

@mxpv

Compatibility

Versions

0.9.0 +2.7mo2026-06-04
0.8.0 +3.3mo2026-03-15
0.7.0 +3.7mo2025-12-05
0.6.1 +29d2025-08-15
0.5.0 +27d2025-07-16
0.4.0 +6d2025-06-19
0.3.0 +21h2025-06-12
0.2.0 +1d2025-06-11
0.1.12025-06-10