Condividi tramite


Intro to the DirectX Shader Compiler Editor

One of the goodies that you get when you build the GitHub DirectX Shader Compiler yourself is the DirectX Shader Compiler Editor, casually referred to by its executable name 'dndxc'.

https://blogs.msdn.microsoft.com/marcelolr/2017/02/01/building-the-directx-compiler-sources/

In case you're wondering, that's "dot net dxc" - it started off as a way to show how to call into the compiler from a C# project. There is very little work going on besides user interface management - pretty much every interesting thing that happens is delegated to the dxcompiler.dll component.

The basic UI is as follows: there's a code editor on the left-hand side, and options to operate on that code in the menu, and additional tools on the right-hand side.

Probably the most basic thing to do is to compile a shader and look at its disassembly. To do this quickly, press Ctrl+N to start with a new shader template, and then Ctrl+F7 to compile it. You'll see the Disassembly tab come to the foreground with color-coded disassembly.

If something goes wrong, you'll get error messages in the output instead.

This is simply exercising the IDxcCompiler APIs to compile and disassembly a blob. Next time, we'll look around some more.

Enjoy!