Skip to content

Fork of Microsoft/DirectXShaderCompiler built with Zig and including Zig / MinGW compatability patches from hexops/DirectXShaderCompiler

License

Notifications You must be signed in to change notification settings

sinnwrig/DirectXShaderCompiler-zig

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DirectX Shader Compiler built with Zig

Overview

This repository is a fork of Microsoft's DirectXShaderCompiler modified to allow cross-platform and static building powered by Zig's build system. Zig enables DXC to be built in a much more straightforward way, by combining several cross-platform compiler toolchains into one buildsystem powered by a single build language.

Much to all of the work needed to do this was made possible by the Mach Engine and their own fork of DXC and DXC Built with Zig, which fixes several annoying quirks that make DXC difficult to compile as a static or dynamic library for Windows, Linux, and MacOS. In fact, this repository still relies on several external libraries that have been modified to work with Zig, provided by Stephen Gutekanst (the creator of mach-dxcompiler) and the folks at Hexops.

Differences from microsoft/DirectXShaderCompiler

As a result of the wonderful work by the people behind mach-dxcompiler, DXC can now be built for multiple platforms using Zig as its build-system (See Stephen Gutekanst's 'Building the DirectX shader compiler better than Microsoft?' for details on what they do different). Some of the biggest differences are a removal of the dependency on dxil.dll, a proprietry code-signing blob, and changes to make DXC correctly work as a static library.

Differences between mach-dxcompiler and DirectXShaderCompiler:

  • Add support for building a statically linked dxcompiler library and dxc executables.
  • Removal of dependency on proprietary dxil.dll code-signing blob (see: Mach Siegbert Vogt DXCSA)
  • Additional support for macOS and aarch64 Linux binaries.
  • Addition of C API as an alternative to the traditional COM API.

Differences from hexops/dxc and mach-dxcompiler

Unfortunately, the Hexops fork of DXC does not attempt to keep up-to-date with source DXC and is primarily designed to serve the purpose of a DXIL bytecode generator for the Mach Engine and not as a standalone library. As such, it lacks features such as SPIR-V bytecode generation, which are essential for developers seeking to cross-compile HLSL for several platforms.

Mach also does not integrate the zig buildsystem directly with DXC source and keeps their buildsystem one level above. This project will instead attempt to integrate directly into DXC and maintain relatively up-to-date with upstream DXC as long as there are no issues. It will provide the option to build with SPIR-V bytecode generation, and modify the C API to adopt the general DXC naming conventions.

Differences between DirectXShaderCompiler-zig and mach-dxcompiler:

  • Direct integration of build.zig file into DXC source repository.
  • Options to enable SPIR-V bytecode generation.
  • Attempts to keep up-to-date with upstream DXC and SPIRV-Tools (at the potential detriment to stability).
  • Renamed the C API and internal functions to follow a more general DXC/C naming convention.
  • Removed MSVC builds due to the lack of support these libraries have for non-windows platforms. PRs welcome which re-add suppor, but I am uninterested and currently unable to add support for them from Linux.
  • Moved SPIRV-Tools external dependency from hexops/spirv-tools to SPIRV-Tools-zig.
  • Addition of -Dregenerate_headers flag, which rebuilds python generated and tablegen'ned headers used by LLVM, Clang, and DXC into generated-include.

About

Fork of Microsoft/DirectXShaderCompiler built with Zig and including Zig / MinGW compatability patches from hexops/DirectXShaderCompiler

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 72.8%
  • HLSL 10.4%
  • LLVM 7.4%
  • C 6.8%
  • Python 1.2%
  • C# 0.4%
  • Other 1.0%