It's time to write our first shader and introduce how we will employ it in the DirectX application. Open the second project of this chapter from the source code (
Shaders). Open the
VertexShader.hlsl file from
Assets/Shaders; note that in Visual Studio, you can add a shader to the project by going to
Visual Studio compiles the HLSL files and converts them to
.cso, which is usually generated in the
Debug folder (under
ProjectName in the
Projects folder) by default. You can change the output directory from the HLSL Property page.
In DirectX 11.1, you can use two ways to compile the shaders. The first and traditional way is to compile the FX files at runtime; we use the
D3DCompileFromFile function ...