Skip to content

DouglasDwyer/mach-dxcompiler-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 dxcompiler = std::ptr::null_mut();
mach_dxcompiler_rs::DxcCreateInstance(&Dxc::CLSID_DxcCompiler, &Dxc::IDxcCompiler3::IID, &mut dxcompiler);
// ... use the shader compiler ...

Visual Studio Requirement

For MSVC users, ensure that your version of Visual Studio is at least 17.11 or higher. This is necessary for compatibility with the build tools and libraries used in this project.

About

Prebuilt, statically-linked DXC for Rust.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published