mach-dxcompiler-rs

Crates.iomach-dxcompiler-rs
lib.rsmach-dxcompiler-rs
version
sourcesrc
created_at2024-11-21 02:57:14.212648
updated_at2024-12-02 01:29:01.216084
descriptionPrebuilt, statically-linked DXC.
homepage
repositoryhttps://github.com/DouglasDwyer/mach-dxcompiler-rs
max_upload_size
id1455636
Cargo.toml error:TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Douglas Dwyer (DouglasDwyer)

documentation

README

mach-dxcompiler-rs

Crates.io Docs.rs

This library allows for statically linking prebuilt binaries from mach-dxcompiler into a Rust project. The mach-dxcompiler repository is a fork of Microsoft's DirectXShaderCompiler that replaces the CMake build system with Zig. This allows for building the project statically and linking it into existing applications - but the core logic comes from the original DXC library.

Usage

The curl.exe and tar.exe command line utilities are required for this crate's build script. They should be installed by default in Windows 10 and 11.

First, add this crate to the project: cargo add mach-dxcompiler-rs

Next, use the DxcCreateInstance function to create DXC COM objects. Once created, these objects are usable with the normal COM windows API.

use windows::Win32::Graphics::Direct3D::Dxc;

let mut obj = std::ptr::null_mut();
mach_dxcompiler_rs::DxcCreateInstance(&Dxc::CLSID_DxcCompiler, &Dxc::CLSID_DxcUtils, &mut object);
// ... use the shader compiler ...
Commit count: 32

cargo fmt