Commit Graph

8 Commits

Author SHA1 Message Date
Peterino2 610737354c new readme, and updated workflows 2026-11-03 09:18:17 -07:00
Peterino2 57800241e9 shorter readme, new manual 2026-11-03 09:15:14 -07:00
Peterino2 951777a23d Udated readme, adding github actions 2026-11-02 13:58:46 -07:00
Peter Li c6d58c0017 Add a DXC drop-in: dxc and a dxcompiler library with DXC's COM API
zig build dropin installs the command line as bin/dxc and builds
dxcompiler (libdxcompiler.so / .dylib, dxcompiler.dll) exporting
DxcCreateInstance and DxcCreateInstance2. It implements IDxcCompiler3,
IDxcVersionInfo and IDxcUtils over compile, with DXC's result shapes,
status codes and include-path spellings, so programs that load DXC's
library (SDL_shadercross, for one) run on zdxc unchanged.

compile.Request gains compat_notes, off for the drop-in: its clients
read any diagnostic text as a warning.
2026-11-01 17:59:17 -08:00
Peter Li 31f3293380 zdxc: C API and static libzdxc
include/zdxc.h: compile a dxc command line in memory and read the
outputs (object, diagnostics, -P, -Frs) from a result; an optional
callback serves the input and #include files. No global state, so any
number of threads can compile at once. zig build installs libzdxc.a
(-Dlinkage=dynamic for a shared library) with the compiler runtime
bundled and only the zdxc_* symbols visible. docs/c-api.md describes it.

The pipeline moves from main.zig into compile.zig, which returns its
outputs instead of writing files; the command line and the C API both
use it, and produce the same bytes. The executable's build step is now
zdxc-cli so that artifact("zdxc") names the library; it still installs
as bin/zdxc. Writing an output file now fails with a message instead of
an error trace.
2026-11-01 17:15:16 -08:00
Peter Li badcdd8593 zdxc: make the tree a clean public source drop
Move the oracle tests, the benchmark and the libzdxc investigation
notes to the zdxc-internal development repo, which builds
this tree as a path dependency. The public build keeps install, run and
test. build.zig.zon now lists tools/ (the build needs its generators)
and docs/.
2026-11-01 15:39:53 -08:00
Peter Li a7f86d1a88 zdxc: --job=<job.json> batch mode
Compile every shader a JSON job file lists in one process, on all cores.
Each job is a dxc command line; shared args come first. Outputs are
byte-identical to separate runs and each job's diagnostics print together
in job order. 1481 corpus shaders: 0.064 s, against 1.09 s for one zdxc
per shader on 10 cores and 1.68 s for dxc.

Also: an unreadable input exits 1 as in dxc (was 5), and stdout/stderr
write in streaming mode so `2>> log` appends instead of overwriting.
2026-11-01 09:46:47 -08:00
Peter Li 88fe78bb3d dxc-compatible command line
zdxc now accepts dxc's command line as-is, so it can replace dxc in build
scripts.

- vendor/dxc/HLSLOptions.td (dxc's option definitions) is turned into a
  Zig table at build time by tools/gen_options.zig (no tablegen/Python).
- src/options.zig parses with LLVM OptTable's rules, as dxc does: `-`,
  `/` and `--` prefixes; flags, joined, separate, joined-or-separate,
  multi-arg and comma-joined options; longest spelling first; aliases;
  case-sensitive; `/`-prefixed non-options are input paths; the last input
  wins. `-T cs_6_0`, `/T cs_6_0` and `-Tcs_6_0` are all accepted.
- Every dxc option has a support level:
  - implemented (-T -E -Fo -D -I -P -Fi -HV -spirv -enable-16bit-types
    -WX -no-warnings -W[no-]x -fdiagnostics-format= -ferror-limit=
    -fdiagnostics-color[=] -O0..3 -Od -Vd -help --version -nologo ...),
  - accepted with a one-line note, no effect yet (-Zpr, -Gis, -Qstrip_*,
    -Fh, -fvk-*, -fspv-target-env=, ... ),
  - rejected with a reason: dropped features (-Zi/-Fd debug info,
    -Fc/-dumpbin disassembly, -recompile, -link, -verify, -ast-dump, LLVM
    internals) or "not supported by zdxc yet".
- Errors match dxc's: "unknown argument: '-x'", "argument to '-T' is
  missing"; exit codes 1 (command line / I/O) and 5 (compile errors).
- -help lists dxc's groups and help text for what zdxc accepts.
- zdxc-only options (-zdxc-*, -f[no-]color-diagnostics) use names dxc
  does not define.
- `zig build oracle-cli`: all 5873 `RUN: %dxc` command lines in the DXC
  test corpus parse; 3392 are accepted and 2481 rejected only for
  deliberately unsupported features, with 0 unknown/missing arguments.
2026-10-31 02:27:52 -07:00