Friday, December 28, 2012

Shader Compilation in Visual Studio 2012

One of the new features of D3D11.1 was the offline shader compilation and the debugging utilities. I decided to try this out on Visual Studio 2012.

The shader compilation is pretty good. The only thing is you have write each shader separately and build them in separate files (unless you use effects). For each file you have to specify the shader model, entry point, which shader type etc by right clicking on the file and choosing properties. The good thing is once all that is done, only thing remaining is to load the shader binary into a blob at runtime, and rest is the same. You can also specify where the compiled shader binaries should go.

One way to design the shaders now is to put only the entry points in separate files and put all the functions, constant buffers, samplers in a common file. This way, you can avoid recoding the same functions.

Unfortunately i was not able to check out the debugging utilities as I had the express version, and the utilities are only available in the Retail versions :(.

No comments: