SegFault The Third
SegFault The Third

Reputation: 21

How to compile HLSL 6.0 at runtime?

I am currently learning D3D12 and decided to change from using HLSL 5.0 to 6.0 to be able to use dynamic indexing. The problem is that D3DCompile and D3DCompile2 seen to only support up until HLSL 5.0, as mentioned in here: specifying compiler targets.

The only thing i thought could work is to use the directX compiler cli, but I dont think thats a good idea.

How am i suposed to do it?

Upvotes: 2

Views: 89

Answers (1)

Chuck Walbourn
Chuck Walbourn

Reputation: 41127

The Shader Model 6 compiler is Open Source hosted on GitHub.

The compiled DXC.EXE is shipped with the modern Windows SDKs, but you can also get both the latest DXC.EXE and the dxcompiler.dll / dxil.dll. For documentation, see GitHub.

You can get these three different ways:

  1. You can download a release from GitHub

  2. You can use the NuGet package Microsoft.Direct3D.DXC from nuget.org.

  3. You can use the directx-dxc port from vcpkg.

Precompiling using DXC.EXE or other offline compilation is of course strongly recommended.

Upvotes: 3

Related Questions