ground up re-implementation of dxc with minimal dependency graph targeting dxil and spirv, will eventually directly output msl as well
Go to file
Peterino2 76a41b790b Merge branch 'ue-workgroups' 2026-11-04 08:51:52 -07:00
.github/workflows rc filter 2026-11-03 11:34:24 -08:00
docs documentation updates 2026-11-04 08:51:40 -07:00
include documentation updates 2026-11-04 08:51:40 -07:00
src documentation updates 2026-11-04 08:51:40 -07:00
tools Add semantic analysis (Sema) with dxc-derived oracles 2026-10-31 03:17:40 -07:00
vendor Add semantic analysis (Sema) with dxc-derived oracles 2026-10-31 03:17:40 -07:00
.gitignore removing the zdxc binary 2026-11-01 15:26:33 -08:00
LICENSE Add MIT LICENSE 2026-11-03 10:09:48 -08:00
README.md documentation updates 2026-11-04 08:51:40 -07:00
build.zig Add a DXC drop-in: dxc and a dxcompiler library with DXC's COM API 2026-11-01 17:59:17 -08:00
build.zig.zon zdxc: C API and static libzdxc 2026-11-01 17:15:16 -08:00

README.md

zdxc

A small, fast HLSL compiler. Built to shorten the edit–compile–run loop.

HLSL 2018 / 2021 → DXIL / SPIR-V · Written in Zig · No LLVM dependency

zdxc.org · Quick start · Manual · Manual source


zdxc is an HLSL compiler written from scratch in Zig. It supports HLSL 2018 and 2021, emits DXIL and SPIR-V, supports DXC-style command lines, and provides a DXC-compatible COM interface for existing engine integrations.

Use it as a development drop-in replacement for DXC, link its small C API directly, or import it as a Zig module. The compiler has no package dependencies and signs its own DXIL, so there is no separate dxil.dll to ship.

Fast iteration Small footprint Easy to embed
About 15× faster compilation in the Hyperion benchmark. 4.2 MB Windows drop-in, compared with 19.3 MB for DXC plus its DXIL library. A static library by default, with a C API and a native Zig module.

Quick start

Requires Zig 0.17. Build the command-line compiler and library:

git clone https://github.com/peterino2/zdxc.git
cd zdxc
zig build -Doptimize=ReleaseFast

Compile the same shader to either backend:

# DirectX / DXIL
zig-out/bin/zdxc -T ps_6_0 -E main shader.hlsl -Fo shader.dxil

# Vulkan / SPIR-V
zig-out/bin/zdxc -spirv -T ps_6_0 -E main shader.hlsl -Fo shader.spv

The build installs the compiler in zig-out/bin/, the library in zig-out/lib/, and the public header in zig-out/include/.

Documentation and downloads

Read the manual on zdxc.org for command-line options, batch compilation, the C API, DXC drop-in support, and Zig integration. The manual Markdown sources live in this repository.

For an existing DXC integration, build the drop-in executable and shared library:

zig build dropin -Doptimize=ReleaseFast

Download Windows, Linux, and macOS bundles from a successful run's Artifacts section on GitHub Actions. Each bundle includes the CLI, static C library, header, and DXC drop-in.

See the case studies for benchmark measurements and methodology. In Hyperion's Windows DXIL cook, zdxc's compile step was 15.5× faster and the complete shader cook was 2.5× faster; Unreal Engine 5.8's editor compiled its 11,156 startup shaders 4.3× faster.

Status

zdxc is alpha software. HLSL 2021 is the default; use -HV 2018 for HLSL 2018 shaders. DXIL supports work graph node shaders in lib_6_8 libraries, SM 6.8 Barrier(), and [WaveSize] metadata. Work graph nodes are not supported by the SPIR-V backend. See the command-line guide for examples.

DXC compatibility is still being developed; not every interface or feature is implemented. The drop-in manual documents the current interface coverage.

To run the unit tests:

zig build test

If you find a problem, open an issue with a minimal shader, the compiler arguments, your platform, and the expected result.


Created by Peterino as an experiment in agentic engineering. Open source, MIT licensed.