This repo hosts the source for the DirectX Shader Compiler which is based on LLVM/Clang.
  • C++ 72.1%
  • HLSL 12%
  • LLVM 8.6%
  • C 4.7%
  • Python 1.3%
  • Other 1%
Find a file
Frank Mayer bacbfaa660
Fix StringRef build failure with newer libc++ (#8307)
Fixes #8306.
## Summary
Building DXC with newer Apple toolchains fails in
`include/llvm/ADT/StringRef.h` because libc++ now rejects user
specializations of certain standard library traits. DXC currently
specializes:
- `std::is_nothrow_constructible<std::string, llvm::StringRef>`
- `std::is_nothrow_constructible<std::string, llvm::StringRef &>`
- `std::is_nothrow_constructible<std::string, const llvm::StringRef &>`
On Xcode 26.4 / Apple clang 21 / libc++, that now produces an error
like:
> `is_nothrow_constructible` cannot be specialized: Users are not
allowed to specialize this standard library entity
## What this changes
This patch keeps the existing HLSL workaround for non-libc++ standard
libraries, but disables those `std::is_nothrow_constructible`
specializations when building against libc++:
```cpp
#if !defined(_LIBCPP_VERSION)
...
#endif
```
Why this fixes the issue
The failure is caused by the specializations themselves, not by any
runtime behavior in StringRef.
For libc++:
- the specializations are now ill-formed and rejected at parse time
- libc++ already computes std::is_nothrow_constructible<std::string,
llvm::StringRef> correctly without the workaround
So the fix is to stop declaring the forbidden specialization on libc++,
while preserving the existing behavior everywhere else.
Why I chose this approach
I looked at the HLSL-specific block in StringRef.h and tested the
current Apple libc++ behavior directly. Without the manual
specialization, libc++ still reports the relevant
is_nothrow_constructible cases as false, which matches the intent of the
original workaround.
That made this the narrowest safe fix:
- it resolves the Xcode/libc++ build break in #8306
- it does not change runtime code generation or ABI
- it preserves the original workaround for non-libc++ environments where
it may still be needed
Validation
I verified:
- the original header fails to compile with current Xcode/libc++
- after this change, the header compiles cleanly
- on libc++, the relevant std::is_nothrow_constructible instantiations
still evaluate to false
2026-04-23 14:07:37 -07:00
.github Update checkout from target branch to main (#8276) 2026-03-19 15:23:09 -07:00
autoconf Add LoongArch 64 bit (#7020) 2025-05-30 10:43:08 -04:00
azure-pipelines Remove DXC.Release pipeline (#5073) 2023-03-01 17:56:34 -08:00
cmake Make HLSL_COPY_GENERATED_SOURCES copy DxilCounters.cpp (#8296) 2026-03-28 01:25:55 +00:00
docs Emit an error when attempting add a user-defined conversion function (#8206) 2026-04-14 16:20:00 -07:00
examples Clean up mistakes made when fixing copyright banners. 2017-01-25 14:36:50 -08:00
external [SPIR-V] Import SPIRV-Tools (#8357) 2026-04-10 09:54:17 -04:00
gcp-pipelines Enable lit by default. (#5133) 2023-06-05 10:35:24 -07:00
include Fix StringRef build failure with newer libc++ (#8307) 2026-04-23 14:07:37 -07:00
lib [PIX] Instrument DebugBreak() calls for PIX (#8349) 2026-04-16 19:11:31 +00:00
projects Change scope nested CFG passes to use a stack instead of recursion (#8227) 2026-04-07 10:20:06 -07:00
resources Generate new version for each DX Compiler build (#2200) 2019-06-28 15:16:34 -07:00
test Fix GVN and SROA miscompilation of min precision vector element access (#8269) 2026-04-01 12:24:07 -07:00
tools [SM6.10][Bugfix][Exec] Final test tweaks for preview (#8393) 2026-04-20 20:26:24 -06:00
unittests Recommit: Add support for prefix-only CLI options 2026-03-11 14:33:26 -07:00
utils [PIX] Instrument DebugBreak() calls for PIX (#8349) 2026-04-16 19:11:31 +00:00
.clang-format first commit 2016-12-28 11:52:27 -08:00
.clang-tidy first commit 2016-12-28 11:52:27 -08:00
.gitattributes Adding line ending settings to .gitattributes (#4026) 2021-10-20 20:58:43 -05:00
.gitignore [NFC] Update .gitignore (#8120) 2026-01-30 20:07:33 +00:00
.gitmodules [lit][SPIRV] convert runCodeTest to lit and remove dependence on effcee (#6077) 2023-12-14 06:50:32 -08:00
azure-pipelines.yml Fix GCC 13 Release build test failures (#7364) (#8176) 2026-03-10 16:37:34 -07:00
CMakeLists.txt Add HctGen of DXIL.rst back to build without LLVM_BUILD_DOCS required (#7346) 2025-04-15 15:43:10 -07:00
CMakeSettings.json [BUILD] add clang-cl to CMakeSettings (#5596) 2023-08-28 20:13:06 +00:00
CONTRIBUTING.md Update DXC's CONTRIBUTING file (#7265) 2025-04-03 08:56:07 -05:00
LICENSE.TXT Inline sub-licenses into root license file (#5569) 2023-08-21 10:05:09 -04:00
LLVMBuild.txt Revert license text in banner comments to original llvm verbage (#33) 2017-01-24 17:54:00 -08:00
README.md [Metal] Add experimental Metal support (#6805) 2025-03-07 17:27:47 -06:00
SECURITY.md Adding Microsoft SECURITY.MD (#4464) 2022-05-19 11:49:07 -07:00
ThirdPartyNotices.txt Add heading text for ThirdPartyNotices.txt 2017-02-24 16:30:31 -08:00

DirectX Shader Compiler

The DirectX Shader Compiler project includes a compiler and related tools used to compile High-Level Shader Language (HLSL) programs into DirectX Intermediate Language (DXIL) representation. Applications that make use of DirectX for graphics, games, and computation can use it to generate shader programs.

For more information, see the Wiki.

Visit the DirectX Landing Page for more resources for DirectX developers.

Features and Goals

The starting point of the project is a fork of the LLVM and Clang projects, modified to accept HLSL and emit a validated container that can be consumed by GPU drivers.

At the moment, the DirectX HLSL Compiler provides the following components:

  • dxc.exe, a command-line tool that can compile HLSL programs for shader model 6.0 or higher

  • dxcompiler.dll, a DLL providing a componentized compiler, assembler, disassembler, and validator

  • dxilconv.dll, a DLL providing a converter from DXBC (older shader bytecode format)

  • dxv.exe, a command-line tool that validates DXIL IR (compiled HLSL programs).

  • various other tools based on the above components

The Microsoft Windows SDK releases include a supported version of the compiler and validator.

The goal of the project is to allow the broader community of shader developers to contribute to the language and representation of shader programs, maintaining the principles of compatibility and supportability for the platform. It's currently in active development across two axes: language evolution (with no impact to DXIL representation), and surfacing hardware capabilities (with impact to DXIL, and thus requiring coordination with GPU implementations).

Pre-built Releases

Development kits containing only the dxc.exe driver app, the dxcompiler.dll, and the dxil.dll signing binary are available here, or in the releases tab.

SPIR-V CodeGen

As an example of community contribution, this project can also target the SPIR-V intermediate representation. Please see the doc for how HLSL features are mapped to SPIR-V, and the wiki page for how to build, use, and contribute to the SPIR-V CodeGen.

Metal CodeGen

When built from source DXC can utilize the Metal Shader Converter if it is available during build and configuration time. This allows DXC to generate Metal shader libraries directly using the -metal flag.

Note: DXC cannot currently disassemble Metal shaders so the -Fc flag cannot be used in conjunction with the -Fo flag.

Building Sources

See the full documentation for Building and testing DXC for detailed instructions.

Running Shaders

To run shaders compiled as DXIL, you will need support from the operating system as well as from the driver for your graphics adapter. Windows 10 Creators Update is the first version to support DXIL shaders. See the Wiki for information on using experimental support or the software adapter.

Hardware Support

Hardware GPU support for DXIL is provided by the following vendors:

NVIDIA

NVIDIA's r396 drivers (r397.64 and later) provide release mode support for DXIL 1.1 and Shader Model 6.1 on Win10 1709 and later, and experimental mode support for DXIL 1.2 and Shader Model 6.2 on Win10 1803 and later. These drivers also support DXR in experimental mode.

Drivers can be downloaded from geforce.com.

AMD

AMDs driver (Radeon Software Adrenalin Edition 18.4.1 or later) provides release mode support for DXIL 1.1 and Shader Model 6.1. Drivers can be downloaded from AMD's download site.

Intel

Intel's 15.60 drivers (15.60.0.4849 and later) support release mode for DXIL 1.0 and Shader Model 6.0 as well as release mode for DXIL 1.1 and Shader Model 6.1 (View Instancing support only).

Drivers can be downloaded from the following link Intel Graphics Drivers

Direct access to 15.60 driver (latest as of this update) is provided below:

Installer

Release Notes related to DXIL

Making Changes

To make contributions, see the CONTRIBUTING.md file in this project.

Documentation

You can find documentation for this project in the docs directory. These contain the original LLVM documentation files, as well as two new files worth nothing:

License

DirectX Shader Compiler is distributed under the terms of the University of Illinois Open Source License.

See LICENSE.txt and ThirdPartyNotices.txt for details.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.