Compare commits
6 Commits
bfc0e58319
...
cedf1b46e9
| Author | SHA1 | Date |
|---|---|---|
|
|
cedf1b46e9 | |
|
|
00adb5a617 | |
|
|
8cec70db9e | |
|
|
610737354c | |
|
|
57800241e9 | |
|
|
c5742db4e3 |
|
|
@ -24,12 +24,13 @@ jobs:
|
||||||
include:
|
include:
|
||||||
- name: windows-x86_64
|
- name: windows-x86_64
|
||||||
target: x86_64-windows-gnu
|
target: x86_64-windows-gnu
|
||||||
|
archive: zip
|
||||||
- name: linux-x86_64
|
- name: linux-x86_64
|
||||||
target: x86_64-linux-gnu.2.28
|
target: x86_64-linux-gnu.2.28
|
||||||
|
archive: tar.gz
|
||||||
- name: macos-aarch64
|
- name: macos-aarch64
|
||||||
target: aarch64-macos.13.0
|
target: aarch64-macos.13.0
|
||||||
- name: macos-x86_64
|
archive: zip
|
||||||
target: x86_64-macos.13.0
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out source
|
- name: Check out source
|
||||||
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
|
||||||
|
|
@ -49,24 +50,29 @@ jobs:
|
||||||
-Dcpu=baseline
|
-Dcpu=baseline
|
||||||
--prefix zig-out/${{ matrix.name }}
|
--prefix zig-out/${{ matrix.name }}
|
||||||
|
|
||||||
# A tar archive preserves executable permissions inside the uploaded ZIP.
|
- name: Package Linux build
|
||||||
- name: Package build
|
if: matrix.archive == 'tar.gz'
|
||||||
run: >-
|
run: >-
|
||||||
tar -czf zdxc-${{ matrix.name }}.tar.gz
|
tar -czf zdxc-${{ matrix.name }}.tar.gz
|
||||||
-C zig-out/${{ matrix.name }} bin lib include
|
-C zig-out/${{ matrix.name }} bin lib include
|
||||||
|
|
||||||
|
- name: Package Windows and macOS builds
|
||||||
|
if: matrix.archive == 'zip'
|
||||||
|
working-directory: zig-out/${{ matrix.name }}
|
||||||
|
run: zip -r ../../zdxc-${{ matrix.name }}.zip bin lib include
|
||||||
|
|
||||||
- name: Upload build
|
- name: Upload build
|
||||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
||||||
with:
|
with:
|
||||||
name: zdxc-${{ matrix.name }}
|
name: zdxc-${{ matrix.name }}
|
||||||
path: zdxc-${{ matrix.name }}.tar.gz
|
path: zdxc-${{ matrix.name }}.${{ matrix.archive }}
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
retention-days: 14
|
retention-days: 14
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Publish release binaries
|
name: Publish release binaries
|
||||||
needs: build
|
needs: build
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-rc')
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
permissions:
|
permissions:
|
||||||
|
|
@ -86,8 +92,8 @@ jobs:
|
||||||
TAG: ${{ github.ref_name }}
|
TAG: ${{ github.ref_name }}
|
||||||
run: |
|
run: |
|
||||||
if gh release view "$TAG" >/dev/null 2>&1; then
|
if gh release view "$TAG" >/dev/null 2>&1; then
|
||||||
gh release upload "$TAG" artifacts/*.tar.gz --clobber
|
gh release upload "$TAG" artifacts/*.tar.gz artifacts/*.zip --clobber
|
||||||
else
|
else
|
||||||
gh release create "$TAG" artifacts/*.tar.gz \
|
gh release create "$TAG" artifacts/*.tar.gz artifacts/*.zip \
|
||||||
--verify-tag --title "zdxc $TAG" --generate-notes
|
--verify-tag --title "zdxc $TAG" --generate-notes
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 Peter Li
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Files under vendor/ are third-party and remain under their own licenses; see
|
||||||
|
vendor/PROVENANCE.md and vendor/hlsl-headers/LICENSE.txt.
|
||||||
79
README.md
79
README.md
|
|
@ -1,5 +1,5 @@
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="docs/assets/logo.svg" width="320" alt="zdxc" />
|
<img src="docs/assets/logo.svg" width="100" alt="zdxc" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
|
|
@ -13,9 +13,8 @@
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://zdxc.org">zdxc.org</a> ·
|
<a href="https://zdxc.org">zdxc.org</a> ·
|
||||||
<a href="#quick-start">Quick start</a> ·
|
<a href="#quick-start">Quick start</a> ·
|
||||||
<a href="docs/dropin.md">DXC drop-in</a> ·
|
<a href="https://zdxc.org/manual.html">Manual</a> ·
|
||||||
<a href="docs/c-api.md">C API</a> ·
|
<a href="docs/manual/">Manual source</a>
|
||||||
<a href="docs/batch.md">Batch compilation</a>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -30,7 +29,7 @@ signs its own DXIL, so there is no separate `dxil.dll` to ship.
|
||||||
|
|
||||||
| Fast iteration | Small footprint | Easy to embed |
|
| Fast iteration | Small footprint | Easy to embed |
|
||||||
| :--- | :--- | :--- |
|
| :--- | :--- | :--- |
|
||||||
| About **14× faster compilation** in the Hyperion benchmark below. | **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. |
|
| About **14× 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
|
## Quick start
|
||||||
|
|
||||||
|
|
@ -55,76 +54,32 @@ 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
|
The build installs the compiler in `zig-out/bin/`, the library in
|
||||||
`zig-out/lib/`, and the public header in `zig-out/include/`.
|
`zig-out/lib/`, and the public header in `zig-out/include/`.
|
||||||
|
|
||||||
### Automated builds
|
## Documentation and downloads
|
||||||
|
|
||||||
Pushes to `main` run the [cross-platform build workflow](.github/workflows/build.yml)
|
Read the [manual on zdxc.org](https://zdxc.org/manual.html) for command-line
|
||||||
with Zig 0.17.0. It cross-compiles ReleaseFast builds on Linux for Windows x86-64,
|
options, batch compilation, the C API, DXC drop-in support, and Zig integration.
|
||||||
Linux x86-64 (glibc 2.28 or newer), and macOS 13 or newer on both Apple Silicon
|
The [manual Markdown sources](docs/manual/) live in this repository.
|
||||||
and Intel. Each artifact contains the CLI, static C library, header, and DXC
|
|
||||||
drop-in. These are build checks; they do not run the binaries on each target OS.
|
|
||||||
|
|
||||||
Download the `.tar.gz` bundles from a successful run's **Artifacts** section
|
For an existing DXC integration, build the drop-in executable and shared library:
|
||||||
on [GitHub Actions](https://github.com/peterino2/zdxc/actions). Artifacts are
|
|
||||||
retained for 14 days. The workflow can also be started manually.
|
|
||||||
|
|
||||||
## Use it your way
|
|
||||||
|
|
||||||
### Replace DXC in an existing integration
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
zig build dropin -Doptimize=ReleaseFast
|
zig build dropin -Doptimize=ReleaseFast
|
||||||
```
|
```
|
||||||
|
|
||||||
This builds `dxc` and the platform's `dxcompiler` shared library. Place them
|
Download Windows, Linux, and macOS bundles from a successful run's **Artifacts**
|
||||||
where your application looks for DXC. The library exports `DxcCreateInstance`
|
section on [GitHub Actions](https://github.com/peterino2/zdxc/actions).
|
||||||
and `DxcCreateInstance2`, including support for `IDxcCompiler3::Compile`.
|
Each bundle includes the CLI, static C library, header, and DXC drop-in.
|
||||||
|
|
||||||
See the [drop-in guide](docs/dropin.md) for supported interfaces and behavior.
|
See the [Hyperion case study](https://zdxc.org/case-studies.html) for benchmark
|
||||||
|
measurements and methodology. In that Windows DXIL workload, zdxc's compile
|
||||||
### Link the compiler into your application
|
step was **13.9× faster** and the complete shader cook was **2.5× faster**.
|
||||||
|
|
||||||
The default build produces a static library with a [small C API](docs/c-api.md).
|
|
||||||
Pass source and options in; get compiled objects and diagnostics back in
|
|
||||||
memory. Supply an include callback to integrate with your own filesystem.
|
|
||||||
|
|
||||||
Prefer a shared library? Build with `-Dlinkage=dynamic`. Zig projects can
|
|
||||||
import the `zdxc` module and supply an allocator directly to the compilation
|
|
||||||
API.
|
|
||||||
|
|
||||||
### Compile a whole batch
|
|
||||||
|
|
||||||
```sh
|
|
||||||
zig-out/bin/zdxc --job=shaders.json
|
|
||||||
```
|
|
||||||
|
|
||||||
Compile many shaders in one process, with parallel workers and output files
|
|
||||||
specified per job. See the [batch guide](docs/batch.md) for the JSON format
|
|
||||||
and threading options.
|
|
||||||
|
|
||||||
## Performance in an engine
|
|
||||||
|
|
||||||
In a Windows DXIL benchmark, Hyperion cooked Glide's 2,688 shader assets
|
|
||||||
using either DXC or zdxc through the engine's existing compiler interface.
|
|
||||||
The machine used a Ryzen 9 7900 with 24 threads; the DXC version was 1.8.2505.
|
|
||||||
|
|
||||||
| Measurement | DXC | zdxc | Speedup |
|
|
||||||
| :--- | ---: | ---: | ---: |
|
|
||||||
| Complete shader cook, wall time | 58.9 s | 23.2 s | **2.5×** |
|
|
||||||
| Compile step, summed across workers | 241.3 s | 17.4 s | **13.9×** |
|
|
||||||
| Median compile call | 12.6 ms | 1.0 ms | **12.7×**¹ |
|
|
||||||
|
|
||||||
¹ Ratios use the unrounded measurements.
|
|
||||||
|
|
||||||
These are measurements of one engine workload, not a universal speedup.
|
|
||||||
The complete cook includes preprocessing and asset processing, so its
|
|
||||||
improvement is smaller than the compile step's. Both builds rendered the
|
|
||||||
same tested scene; compilation throughput is separate from GPU performance.
|
|
||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
zdxc is **alpha software**, focused on HLSL 2021 (`-HV 2021`). DXC compatibility
|
zdxc is **alpha software**, focused on HLSL 2021 (`-HV 2021`). DXC compatibility
|
||||||
is still being developed; not every DXC interface or feature is implemented.
|
is still being developed; not every DXC interface or feature is implemented.
|
||||||
The [drop-in guide](docs/dropin.md) documents the current interface coverage.
|
The [drop-in manual](https://zdxc.org/manual.html#section-dxc-drop-in) documents
|
||||||
|
the current interface coverage.
|
||||||
|
|
||||||
To run the unit tests:
|
To run the unit tests:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,5 @@
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 232 72" fill="none">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 72 72" fill="none">
|
||||||
<title>zdxc — tiny directx shader compiler</title>
|
<title>zdxc — tiny directx shader compiler</title>
|
||||||
<style>
|
|
||||||
.wordmark { stroke: #111110; }
|
|
||||||
@media (prefers-color-scheme: dark) { .wordmark { stroke: #f4f4ee; } }
|
|
||||||
</style>
|
|
||||||
<rect x="4" y="4" width="64" height="64" rx="12" fill="#111110"/>
|
<rect x="4" y="4" width="64" height="64" rx="12" fill="#111110"/>
|
||||||
<path d="M20 20h32v8L32 44h20v8H20v-8l20-16H20Z" fill="#f4f4ee"/>
|
<path d="M20 20h32v8L32 44h20v8H20v-8l20-16H20Z" fill="#f4f4ee"/>
|
||||||
<path class="wordmark" d="M90 30h24L90 54h24M146 18v36h-22V30h22M158 30l24 24m0-24-24 24M214 30h-20v24h20" stroke-width="5" stroke-linecap="square" stroke-linejoin="miter"/>
|
|
||||||
</svg>
|
</svg>
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 579 B After Width: | Height: | Size: 271 B |
|
|
@ -0,0 +1,19 @@
|
||||||
|
---
|
||||||
|
type: guide
|
||||||
|
order: 1
|
||||||
|
title: Introduction
|
||||||
|
---
|
||||||
|
|
||||||
|
zdxc is a from-scratch HLSL 2021 compiler written in Zig. It emits DXIL and
|
||||||
|
SPIR-V and has no package dependencies. The same compiler is available through
|
||||||
|
four interfaces:
|
||||||
|
|
||||||
|
| Interface | Use |
|
||||||
|
| --- | --- |
|
||||||
|
| `zdxc` | A dxc-style command-line compiler. |
|
||||||
|
| `libzdxc` | A small C API that returns compilation outputs in memory. |
|
||||||
|
| `zdxc` Zig module | Direct access to the compiler from a Zig build. |
|
||||||
|
| `dxc` / `dxcompiler` | Drop-in names and entry points for existing DXC clients. |
|
||||||
|
|
||||||
|
The source language is HLSL 2021; `-HV 2021` is the only language version.
|
||||||
|
DXIL output is signed by zdxc itself, so no separate `dxil` library is needed.
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
---
|
||||||
|
type: guide
|
||||||
|
order: 2
|
||||||
|
title: Getting started
|
||||||
|
---
|
||||||
|
|
||||||
|
```quickstart
|
||||||
|
{
|
||||||
|
"title": "Quick start",
|
||||||
|
"tabs": [
|
||||||
|
{
|
||||||
|
"label": "Download",
|
||||||
|
"steps": [
|
||||||
|
{"title": "Get the bundle", "code": "unzip zdxc-VERSION-PLATFORM.zip && cd zdxc-VERSION-PLATFORM", "text": "Download it for your platform from the [releases](https://github.com/peterino2/zdxc/releases). `bin/` holds `zdxc` and the DXC drop-in; `lib/` and `include/` hold `libzdxc` and `zdxc.h`."},
|
||||||
|
{"title": "Drop in for DXC", "code": "cp bin/dxc* bin/*dxcompiler* ENGINE/bin/", "text": "Put `dxc` and `dxcompiler` where your engine looks for DXC's. There is no `dxil.dll` to copy."},
|
||||||
|
{"title": "Compile a shader", "code": "bin/zdxc -T ps_6_0 -E main shader.hlsl -Fo shader.dxil", "text": "dxc's command line. Add `-spirv` for SPIR-V, or compile many shaders at once with `--job`."}
|
||||||
|
],
|
||||||
|
"links": [
|
||||||
|
{"href": "https://github.com/peterino2/zdxc/releases", "label": "Releases"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Build from source",
|
||||||
|
"steps": [
|
||||||
|
{"title": "Get the source", "code": "git clone https://github.com/peterino2/zdxc.git && cd zdxc", "text": "One Zig codebase with no dependencies."},
|
||||||
|
{"title": "Build", "code": "zig build -Doptimize=ReleaseFast", "text": "Needs Zig 0.17 and nothing else. You get `zdxc`, `libzdxc.a` and `zdxc.h` in `zig-out`."},
|
||||||
|
{"title": "Drop in for DXC", "code": "zig build dropin -Doptimize=ReleaseFast", "text": "Builds `dxc` and `dxcompiler`. Put them where your engine looks for DXC's; there is no `dxil.dll` to copy."},
|
||||||
|
{"title": "Compile a shader", "code": "zig-out/bin/zdxc -T ps_6_0 -E main shader.hlsl -Fo shader.dxil", "text": "dxc's command line. Add `-spirv` for SPIR-V, or compile many shaders at once with `--job`."}
|
||||||
|
],
|
||||||
|
"links": [
|
||||||
|
{"href": "https://github.com/peterino2/zdxc", "label": "Source on GitHub"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
Install Zig 0.17.0 or newer. zdxc has no library or package dependencies.
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
Run the build from the zdxc package directory:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
zig build -Doptimize=ReleaseFast
|
||||||
|
```
|
||||||
|
|
||||||
|
The default install contains:
|
||||||
|
|
||||||
|
```text
|
||||||
|
zig-out/bin/zdxc command-line compiler
|
||||||
|
zig-out/lib/libzdxc.a static C library
|
||||||
|
zig-out/include/zdxc.h public C header
|
||||||
|
```
|
||||||
|
|
||||||
|
Build a shared C library instead with `-Dlinkage=dynamic`. Cross-compilation
|
||||||
|
uses Zig's usual target option:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
zig build -Dtarget=x86_64-windows-gnu -Doptimize=ReleaseFast
|
||||||
|
```
|
||||||
|
|
||||||
|
## Compile a shader
|
||||||
|
|
||||||
|
The command line follows dxc. Specify a target profile, entry point, input,
|
||||||
|
and output file:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./zig-out/bin/zdxc -T cs_6_0 -E main shader.hlsl -Fo shader.dxil
|
||||||
|
./zig-out/bin/zdxc -T vs_6_0 -E main -spirv shader.hlsl -Fo shader.spv
|
||||||
|
```
|
||||||
|
|
||||||
|
Use `zdxc -help` for the complete option list and `zdxc --version` for the
|
||||||
|
compiler version.
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
---
|
||||||
|
type: guide
|
||||||
|
order: 3
|
||||||
|
title: Command line
|
||||||
|
---
|
||||||
|
|
||||||
|
zdxc accepts dxc command-line arguments. A compilation can read its input from
|
||||||
|
a file or, through the library interfaces, from memory.
|
||||||
|
|
||||||
|
| Option | Meaning |
|
||||||
|
| --- | --- |
|
||||||
|
| `-T <profile>` | Target profile, such as `vs_6_0`, `ps_6_0`, or `cs_6_0`. |
|
||||||
|
| `-E <name>` | Shader entry point. |
|
||||||
|
| `-D <name[=value]>` | Define a preprocessor macro. |
|
||||||
|
| `-I <directory>` | Add an include search directory. |
|
||||||
|
| `-Fo <file>` | Write the object to a file. |
|
||||||
|
| `-Fi <file>` | Write preprocessed output when used with `-P`. |
|
||||||
|
| `-Frs <file>` | Write a root-signature container. |
|
||||||
|
| `-P` | Preprocess instead of compiling. |
|
||||||
|
| `-spirv` | Emit SPIR-V instead of DXIL. |
|
||||||
|
| `-Zpr` / `-Zpc` | Select row- or column-major matrix packing. |
|
||||||
|
| `-O0` … `-O3`, `-Od` | Select the optimization level. |
|
||||||
|
| `--job=<file>` | Compile a JSON batch of shaders in one process. |
|
||||||
|
|
||||||
|
DXIL is the default backend. Add `-spirv` for SPIR-V, with the `-fvk-*` and
|
||||||
|
`-fspv-*` options controlling Vulkan bindings, layout, and target environment.
|
||||||
|
|
||||||
|
## Diagnostics and exit status
|
||||||
|
|
||||||
|
Diagnostics follow dxc's command-line format. Exit status is 0 for success,
|
||||||
|
1 for bad options or input/output failures, and 5 for source compilation
|
||||||
|
errors. Warnings can appear in successful compilations.
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
---
|
||||||
|
type: guide
|
||||||
|
order: 4
|
||||||
|
title: Batch compilation
|
||||||
|
---
|
||||||
|
|
||||||
|
`zdxc --job=build/shaders.json` compiles every shader a job file lists in
|
||||||
|
one process, on all cores. Starting a process costs more than compiling most
|
||||||
|
shaders (about 2 ms against a few hundred microseconds), so a build with many
|
||||||
|
shaders is much faster this way than with one compiler run per shader.
|
||||||
|
|
||||||
|
On the 1,481 corpus shaders zdxc compiles (10-core M-series Mac, release
|
||||||
|
build):
|
||||||
|
|
||||||
|
| How | Wall time |
|
||||||
|
| ------------------------------------------- | --------: |
|
||||||
|
| `zdxc --job`, all cores | 0.064 s |
|
||||||
|
| `zdxc --job`, `"threads": 1` | 0.24 s |
|
||||||
|
| one `zdxc` per shader, 10 in parallel | 1.09 s |
|
||||||
|
| one `dxc` per shader, 10 in parallel | 1.68 s |
|
||||||
|
|
||||||
|
## The job file
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"threads": 8,
|
||||||
|
"args": ["-HV", "2021", "-I", "shaders/include"],
|
||||||
|
"jobs": [
|
||||||
|
{ "args": ["-T", "cs_6_0", "shaders/blur.hlsl", "-Fo", "out/blur.dxo"] },
|
||||||
|
{ "args": ["-T", "ps_6_0", "-E", "PS", "shaders/mesh.hlsl", "-Fo", "out/mesh_ps.dxo"] },
|
||||||
|
{ "args": ["-T", "vs_6_0", "-E", "VS", "-spirv", "shaders/mesh.hlsl", "-Fo", "out/mesh_vs.spv"] }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- `jobs` (required): each job's `args` is a dxc command line without the
|
||||||
|
program name — any option zdxc accepts on its own command line.
|
||||||
|
- `args` (optional): options shared by every job.
|
||||||
|
- `threads` (optional): how many shaders compile at once. Defaults to the
|
||||||
|
number of CPUs.
|
||||||
|
|
||||||
|
A job's full command line is the file's `args`, then any options given next
|
||||||
|
to `--job` on the real command line, then the job's own `args`. So
|
||||||
|
`zdxc --job=shaders.json -O3 -Qstrip_debug` adds `-O3 -Qstrip_debug` to every
|
||||||
|
job, and a job can override a shared option where a later option wins on the
|
||||||
|
command line. Unknown fields are errors, reported with their line and column.
|
||||||
|
|
||||||
|
Paths in the file are relative to the current directory, as on the command
|
||||||
|
line, not to the job file. `--job` cannot appear inside a job file.
|
||||||
|
|
||||||
|
## Output and exit code
|
||||||
|
|
||||||
|
Every job writes its own `-Fo` / `-Fh` / ... outputs. What a job prints —
|
||||||
|
diagnostics, and text output such as `-P` without a file — comes out
|
||||||
|
exactly as one zdxc run of that command line would print it, kept together
|
||||||
|
and in job order, whatever order the jobs finish in. The outputs are
|
||||||
|
byte-identical to separate runs.
|
||||||
|
|
||||||
|
When jobs fail, the other jobs still run, and a last line says how many
|
||||||
|
failed:
|
||||||
|
|
||||||
|
```text
|
||||||
|
zdxc: 2 of 112 jobs failed
|
||||||
|
```
|
||||||
|
|
||||||
|
The exit code is 0 when every job succeeds; otherwise 1 if any job failed
|
||||||
|
on its command line or on I/O (a missing input, an unwritable output), else
|
||||||
|
5 (compile errors) — the codes one zdxc run uses.
|
||||||
|
|
||||||
|
Reading and writing files is kept off the compiling threads: one thread
|
||||||
|
reads the jobs' input files ahead of the compiles, and another writes
|
||||||
|
their outputs after them. Files the jobs include are read once for the
|
||||||
|
whole run, so a header that every shader includes is opened once (a file
|
||||||
|
that changes while the run is going is not read again). An output that
|
||||||
|
cannot be written is reported after every job's output, and fails its job.
|
||||||
|
|
@ -0,0 +1,86 @@
|
||||||
|
---
|
||||||
|
type: guide
|
||||||
|
order: 5
|
||||||
|
title: The C API
|
||||||
|
---
|
||||||
|
|
||||||
|
zdxc is also a library with a small C API, [`include/zdxc.h`](source.html).
|
||||||
|
Unlike dxcompiler, it links statically: there is no DLL to ship or load, no
|
||||||
|
COM, and nothing to link besides the platform's C library.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
zig build # zig-out/lib/libzdxc.a, zig-out/include/zdxc.h
|
||||||
|
zig build -Dlinkage=dynamic # libzdxc.so / .dylib / zdxc.dll instead
|
||||||
|
zig build -Dtarget=x86_64-windows-gnu -Doptimize=ReleaseFast
|
||||||
|
```
|
||||||
|
|
||||||
|
Link `libzdxc.a` like any static library (`cc app.c -Izig-out/include
|
||||||
|
zig-out/lib/libzdxc.a`). It exports
|
||||||
|
only the `zdxc_*` functions; the compiler runtime it carries is hidden. For
|
||||||
|
a macOS binary you ship, give the target a minimum version
|
||||||
|
(`-Dtarget=aarch64-macos.13.0`), or the linker warns that the library was
|
||||||
|
built for a newer macOS than the app.
|
||||||
|
|
||||||
|
## Compiling
|
||||||
|
|
||||||
|
A compilation is a dxc command line, with the outputs returned in memory:
|
||||||
|
|
||||||
|
```c
|
||||||
|
#include <zdxc.h>
|
||||||
|
|
||||||
|
const char *args[] = {"-T", "ps_6_0", "-E", "PS", "-D", "SHADOWS=1"};
|
||||||
|
zdxc_compile_info info = {
|
||||||
|
.size = sizeof info,
|
||||||
|
.args = args,
|
||||||
|
.arg_count = 6,
|
||||||
|
.source = text,
|
||||||
|
.source_size = text_size,
|
||||||
|
.source_name = "mesh.hlsl",
|
||||||
|
};
|
||||||
|
zdxc_result *r = zdxc_compile(&info);
|
||||||
|
if (!r) return OUT_OF_MEMORY;
|
||||||
|
|
||||||
|
const char *diags = zdxc_result_output(r, ZDXC_OUTPUT_DIAGNOSTICS, NULL);
|
||||||
|
if (diags) fputs(diags, stderr); /* errors, or warnings on success */
|
||||||
|
|
||||||
|
if (zdxc_result_status(r) == ZDXC_STATUS_OK) {
|
||||||
|
size_t size;
|
||||||
|
const void *dxil = zdxc_result_output(r, ZDXC_OUTPUT_OBJECT, &size);
|
||||||
|
upload(dxil, size);
|
||||||
|
}
|
||||||
|
zdxc_result_free(r);
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Options** are exactly the command line's (`-T`, `-E`, `-D`, `-I`,
|
||||||
|
`-spirv`, `-fvk-*`, `-Zpr`, `-O3`, ...), without the program name.
|
||||||
|
- **The source** is in memory (`source`, with or without a trailing NUL),
|
||||||
|
or, when `source` is NULL, the input file named in the options.
|
||||||
|
- **Files** — the input when given by name, and every `#include` candidate —
|
||||||
|
are read from disk relative to the current directory, unless you pass a
|
||||||
|
`read_file` callback. The callback gets each candidate path (the
|
||||||
|
including file's directory, then each `-I` directory) and returns 0 with
|
||||||
|
the file's bytes, or nonzero to try the next candidate. Returned memory
|
||||||
|
only has to last until `zdxc_compile` returns.
|
||||||
|
- **Status** is `ZDXC_STATUS_OK` (0), `ZDXC_STATUS_FAILED` (1: bad options,
|
||||||
|
unreadable input) or `ZDXC_STATUS_COMPILE_FAILED` (5: errors in the
|
||||||
|
source) — the command line's exit codes. `zdxc_compile` returns NULL only
|
||||||
|
when out of memory.
|
||||||
|
- **Outputs** are `OBJECT` (a DXIL container or SPIR-V module),
|
||||||
|
`DIAGNOSTICS`, `PREPROCESSED` (`-P`), `ROOT_SIGNATURE` (`-Frs`) and `TEXT`
|
||||||
|
(`-help`, `--version`). Each is NUL-terminated for convenience and lives
|
||||||
|
until `zdxc_result_free`. `zdxc_result_output_name` gives the name an
|
||||||
|
option assigned (`-Fo`, `-Fi`, `-Frs`); zdxc never writes files.
|
||||||
|
|
||||||
|
The output is byte-for-byte what the command line writes for the same
|
||||||
|
options and files.
|
||||||
|
|
||||||
|
## Threads
|
||||||
|
|
||||||
|
zdxc has no global state. Any number of threads may call `zdxc_compile` at
|
||||||
|
once, and a result may be read or freed on any thread.
|
||||||
|
|
||||||
|
## Zig
|
||||||
|
|
||||||
|
Zig projects can skip the C API: depend on this package and import the
|
||||||
|
`zdxc` module, whose `compile.compile(arena, request)` is what the C API
|
||||||
|
wraps.
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
---
|
||||||
|
type: guide
|
||||||
|
order: 6
|
||||||
|
title: The DXC drop-in
|
||||||
|
---
|
||||||
|
|
||||||
|
Programs that run DXC usually do it in one of two ways: they call the `dxc`
|
||||||
|
executable, or they load `dxcompiler` (`dxcompiler.dll`,
|
||||||
|
`libdxcompiler.so`, `libdxcompiler.dylib`) and call `DxcCreateInstance`.
|
||||||
|
SDL_shadercross, for one, does the second. The `dropin` step builds both on
|
||||||
|
top of zdxc, so these programs can use zdxc without being changed:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
zig build dropin # zig-out/bin/dxc, zig-out/lib/libdxcompiler.{so,dylib}
|
||||||
|
zig build dropin -Dtarget=x86_64-windows-gnu -Doptimize=ReleaseFast
|
||||||
|
# zig-out/bin/dxc.exe, dxcompiler.dll, lib/dxcompiler.lib
|
||||||
|
```
|
||||||
|
|
||||||
|
Put them where the program looks for DXC, in place of DXC's files. There is
|
||||||
|
no `dxil.dll`: zdxc signs DXIL itself.
|
||||||
|
|
||||||
|
- `dxc` is the zdxc command line under DXC's name.
|
||||||
|
- `dxcompiler` exports `DxcCreateInstance` and `DxcCreateInstance2`, with
|
||||||
|
`dxcapi.h`'s ABI. On Windows it imports only `kernel32` and `ntdll`. On
|
||||||
|
other platforms it links the C library and nothing else.
|
||||||
|
|
||||||
|
## What the library implements
|
||||||
|
|
||||||
|
| Class | Interfaces |
|
||||||
|
|---|---|
|
||||||
|
| `CLSID_DxcCompiler` | `IDxcCompiler3` (`Compile`), `IDxcVersionInfo` (reports 1.11) |
|
||||||
|
| `CLSID_DxcUtils` (also reached as `CLSID_DxcLibrary`) | `IDxcUtils`: blob creation, `LoadFile`, `CreateDefaultIncludeHandler`, `GetBlobAsUtf8` / `GetBlobAsWide`, `GetDxilContainerPart` |
|
||||||
|
|
||||||
|
`Compile` takes the same arguments as the command line and follows DXC:
|
||||||
|
|
||||||
|
- **Status.** A compile error is a successful call whose status is
|
||||||
|
`E_FAIL`. A bad option has status `E_INVALIDARG`.
|
||||||
|
- **Outputs.** The result holds the same outputs DXC's does: the object,
|
||||||
|
the errors (UTF-8, empty when there are none), the shader hash for DXIL,
|
||||||
|
the root signature, `-P` text, and the names given with `-Fo`, `-Fi` and
|
||||||
|
`-Frs`.
|
||||||
|
- **Includes.** Includes go through the `IDxcIncludeHandler` you pass,
|
||||||
|
with paths spelled the way DXC spells them (`./inc/common.hlsli`). With no
|
||||||
|
handler, includes fail, as they do in DXC.
|
||||||
|
- **Accepted-but-ignored options.** Options that zdxc accepts but does not
|
||||||
|
act on yet produce no note here. Many clients treat any diagnostic text
|
||||||
|
as a warning.
|
||||||
|
|
||||||
|
Classes and methods that are not implemented return `REGDB_E_CLASSNOTREG`
|
||||||
|
or `E_NOTIMPL`. These include:
|
||||||
|
- the legacy `IDxcCompiler` and `IDxcCompiler2` interfaces;
|
||||||
|
- `Disassemble`;
|
||||||
|
- `CreateReflection`, `BuildArguments` and `GetPDBContents`;
|
||||||
|
- the validator, linker, container and PDB classes.
|
||||||
|
|
||||||
|
The result has no `DXC_OUT_REFLECTION` output (the reflection container
|
||||||
|
that `CreateReflection` reads).
|
||||||
|
|
||||||
|
Language support is zdxc's own: HLSL 2021, with `-HV 2021` as the only
|
||||||
|
version.
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
---
|
||||||
|
type: guide
|
||||||
|
order: 7
|
||||||
|
title: Zig integration
|
||||||
|
---
|
||||||
|
|
||||||
|
Declare zdxc as a package dependency, then make its module available to your
|
||||||
|
executable or library:
|
||||||
|
|
||||||
|
```zig
|
||||||
|
const zdxc = b.dependency("zdxc", .{
|
||||||
|
.target = target,
|
||||||
|
.optimize = optimize,
|
||||||
|
});
|
||||||
|
exe.root_module.addImport("zdxc", zdxc.module("zdxc"));
|
||||||
|
```
|
||||||
|
|
||||||
|
Import the module and call the same compilation layer used by the command line
|
||||||
|
and C API:
|
||||||
|
|
||||||
|
```zig
|
||||||
|
const std = @import("std");
|
||||||
|
const zdxc = @import("zdxc");
|
||||||
|
|
||||||
|
pub fn compileShader(arena: std.mem.Allocator, io: std.Io, source: []const u8) !zdxc.compile.Result {
|
||||||
|
return zdxc.compile.compile(arena, .{
|
||||||
|
.args = &.{ "-T", "ps_6_0", "-E", "PS", "-D", "SHADOWS=1" },
|
||||||
|
.source = source,
|
||||||
|
.source_name = "mesh.hlsl",
|
||||||
|
.io = io,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The returned result contains the status, object, diagnostics, and any requested
|
||||||
|
auxiliary outputs. Its allocations belong to the supplied arena. The compiler
|
||||||
|
does not write files; `-Fo`, `-Fi`, and `-Frs` only name the corresponding
|
||||||
|
in-memory outputs.
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
---
|
||||||
|
type: guide
|
||||||
|
order: 8
|
||||||
|
title: API reference
|
||||||
|
---
|
||||||
|
|
||||||
|
The public C API is declared in [`zdxc.h`](source.html). Each symbol below has
|
||||||
|
its declaration, ownership rules, and a link to the corresponding source line.
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
type: api
|
||||||
|
order: 1
|
||||||
|
title: ZDXC_API_VERSION
|
||||||
|
kind: macro
|
||||||
|
line: 41
|
||||||
|
---
|
||||||
|
|
||||||
|
```c
|
||||||
|
#define ZDXC_API_VERSION 1
|
||||||
|
```
|
||||||
|
|
||||||
|
The public C API version. The current version is 1.
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
type: api
|
||||||
|
order: 2
|
||||||
|
title: zdxc_result
|
||||||
|
kind: type
|
||||||
|
line: 43
|
||||||
|
---
|
||||||
|
|
||||||
|
```c
|
||||||
|
typedef struct zdxc_result zdxc_result;
|
||||||
|
```
|
||||||
|
|
||||||
|
An opaque compilation result. It owns the object, diagnostics, and other
|
||||||
|
outputs returned by `zdxc_compile`. Read its outputs with
|
||||||
|
`zdxc_result_output` and release it with `zdxc_result_free`.
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
---
|
||||||
|
type: api
|
||||||
|
order: 3
|
||||||
|
title: zdxc_status
|
||||||
|
kind: type
|
||||||
|
line: 46
|
||||||
|
---
|
||||||
|
|
||||||
|
```c
|
||||||
|
typedef enum zdxc_status {
|
||||||
|
ZDXC_STATUS_OK = 0,
|
||||||
|
ZDXC_STATUS_FAILED = 1,
|
||||||
|
ZDXC_STATUS_COMPILE_FAILED = 5
|
||||||
|
} zdxc_status;
|
||||||
|
```
|
||||||
|
|
||||||
|
A compilation's outcome. The values match dxc's command-line exit codes.
|
||||||
|
|
||||||
|
### ZDXC_STATUS_OK
|
||||||
|
|
||||||
|
Compilation succeeded. Diagnostics may still contain warnings.
|
||||||
|
|
||||||
|
### ZDXC_STATUS_FAILED
|
||||||
|
|
||||||
|
Bad options or an input that could not be read.
|
||||||
|
|
||||||
|
### ZDXC_STATUS_COMPILE_FAILED
|
||||||
|
|
||||||
|
The source contains compilation errors.
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
---
|
||||||
|
type: api
|
||||||
|
order: 4
|
||||||
|
title: zdxc_output
|
||||||
|
kind: type
|
||||||
|
line: 54
|
||||||
|
---
|
||||||
|
|
||||||
|
```c
|
||||||
|
typedef enum zdxc_output {
|
||||||
|
ZDXC_OUTPUT_OBJECT = 0,
|
||||||
|
ZDXC_OUTPUT_DIAGNOSTICS = 1,
|
||||||
|
ZDXC_OUTPUT_PREPROCESSED = 2,
|
||||||
|
ZDXC_OUTPUT_ROOT_SIGNATURE = 3,
|
||||||
|
ZDXC_OUTPUT_TEXT = 4
|
||||||
|
} zdxc_output;
|
||||||
|
```
|
||||||
|
|
||||||
|
Selects one output from a compilation result.
|
||||||
|
|
||||||
|
### ZDXC_OUTPUT_OBJECT
|
||||||
|
|
||||||
|
The DXIL container or SPIR-V module.
|
||||||
|
|
||||||
|
### ZDXC_OUTPUT_DIAGNOSTICS
|
||||||
|
|
||||||
|
Errors, warnings, and notes in command-line format.
|
||||||
|
|
||||||
|
### ZDXC_OUTPUT_PREPROCESSED
|
||||||
|
|
||||||
|
Preprocessed source requested with `-P`.
|
||||||
|
|
||||||
|
### ZDXC_OUTPUT_ROOT_SIGNATURE
|
||||||
|
|
||||||
|
The root-signature container requested with `-Frs`.
|
||||||
|
|
||||||
|
### ZDXC_OUTPUT_TEXT
|
||||||
|
|
||||||
|
Other command-line text, such as `-help` or `--version`.
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
type: api
|
||||||
|
order: 5
|
||||||
|
title: zdxc_read_file_fn
|
||||||
|
kind: callback
|
||||||
|
line: 75
|
||||||
|
---
|
||||||
|
|
||||||
|
```c
|
||||||
|
typedef int (*zdxc_read_file_fn)(void *user, const char *path, const char **data, size_t *size);
|
||||||
|
```
|
||||||
|
|
||||||
|
Reads the main input or an `#include` candidate. On success, set `data` and
|
||||||
|
`size` and return 0. Return nonzero to let zdxc try the next candidate. The
|
||||||
|
returned bytes need only remain valid until `zdxc_compile` returns.
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
---
|
||||||
|
type: api
|
||||||
|
order: 6
|
||||||
|
title: zdxc_compile_info
|
||||||
|
kind: struct
|
||||||
|
line: 77
|
||||||
|
---
|
||||||
|
|
||||||
|
```c
|
||||||
|
typedef struct zdxc_compile_info {
|
||||||
|
uint32_t size;
|
||||||
|
const char *const *args;
|
||||||
|
size_t arg_count;
|
||||||
|
const char *source;
|
||||||
|
size_t source_size;
|
||||||
|
const char *source_name;
|
||||||
|
zdxc_read_file_fn read_file;
|
||||||
|
void *user;
|
||||||
|
} zdxc_compile_info;
|
||||||
|
```
|
||||||
|
|
||||||
|
Describes one in-memory or file-based compilation. Initialize `size` to
|
||||||
|
`sizeof(zdxc_compile_info)` so later API versions can add fields.
|
||||||
|
|
||||||
|
### size
|
||||||
|
|
||||||
|
The structure size in bytes; use `sizeof(zdxc_compile_info)`.
|
||||||
|
|
||||||
|
### args
|
||||||
|
|
||||||
|
dxc command-line options without the program name.
|
||||||
|
|
||||||
|
### arg_count
|
||||||
|
|
||||||
|
Number of arguments in `args`.
|
||||||
|
|
||||||
|
### source
|
||||||
|
|
||||||
|
The main source text, or NULL to read the named input file.
|
||||||
|
|
||||||
|
### source_size
|
||||||
|
|
||||||
|
Source byte length; a trailing NUL is allowed.
|
||||||
|
|
||||||
|
### source_name
|
||||||
|
|
||||||
|
Name used in diagnostics and relative include resolution.
|
||||||
|
|
||||||
|
### read_file
|
||||||
|
|
||||||
|
Optional file callback; NULL reads from disk.
|
||||||
|
|
||||||
|
### user
|
||||||
|
|
||||||
|
Opaque pointer passed to `read_file`.
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
type: api
|
||||||
|
order: 7
|
||||||
|
title: zdxc_compile
|
||||||
|
kind: function
|
||||||
|
line: 99
|
||||||
|
---
|
||||||
|
|
||||||
|
```c
|
||||||
|
zdxc_result *zdxc_compile(const zdxc_compile_info *info);
|
||||||
|
```
|
||||||
|
|
||||||
|
Runs one compilation. It returns NULL only for an invalid or too-small
|
||||||
|
descriptor, or when memory is exhausted. Every compilation failure is reported
|
||||||
|
by the result's status and diagnostics.
|
||||||
|
|
||||||
|
The compiler has no global state. Independent calls may run concurrently on
|
||||||
|
any number of threads.
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
type: api
|
||||||
|
order: 8
|
||||||
|
title: zdxc_result_status
|
||||||
|
kind: function
|
||||||
|
line: 101
|
||||||
|
---
|
||||||
|
|
||||||
|
```c
|
||||||
|
zdxc_status zdxc_result_status(const zdxc_result *result);
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns the compilation's `zdxc_status`.
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
type: api
|
||||||
|
order: 9
|
||||||
|
title: zdxc_result_output
|
||||||
|
kind: function
|
||||||
|
line: 106
|
||||||
|
---
|
||||||
|
|
||||||
|
```c
|
||||||
|
const void *zdxc_result_output(const zdxc_result *result, zdxc_output output, size_t *size);
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns the selected output's bytes. The bytes are followed by a NUL for
|
||||||
|
convenience; `size` does not count that terminator and may be NULL. If the
|
||||||
|
output was not produced, returns NULL and stores zero in `size`.
|
||||||
|
|
||||||
|
The pointer remains valid until `zdxc_result_free`. Binary object outputs can
|
||||||
|
contain interior NUL bytes; always use the returned size.
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
type: api
|
||||||
|
order: 10
|
||||||
|
title: zdxc_result_output_name
|
||||||
|
kind: function
|
||||||
|
line: 109
|
||||||
|
---
|
||||||
|
|
||||||
|
```c
|
||||||
|
const char *zdxc_result_output_name(const zdxc_result *result, zdxc_output output);
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns the file name assigned by `-Fo`, `-Fi`, or `-Frs`, or NULL when the
|
||||||
|
output has no assigned name. zdxc does not write that file itself.
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
---
|
||||||
|
type: api
|
||||||
|
order: 11
|
||||||
|
title: zdxc_result_free
|
||||||
|
kind: function
|
||||||
|
line: 111
|
||||||
|
---
|
||||||
|
|
||||||
|
```c
|
||||||
|
void zdxc_result_free(zdxc_result *result);
|
||||||
|
```
|
||||||
|
|
||||||
|
Releases a result and all of its outputs. Any output pointers previously
|
||||||
|
obtained from it become invalid.
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
type: api
|
||||||
|
order: 12
|
||||||
|
title: zdxc_version
|
||||||
|
kind: function
|
||||||
|
line: 114
|
||||||
|
---
|
||||||
|
|
||||||
|
```c
|
||||||
|
const char *zdxc_version(void);
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns zdxc's version as a NUL-terminated string, such as `0.1.0`.
|
||||||
Loading…
Reference in New Issue