Preparing the vertex shader and buffers for tessellation
In this recipe, we will update the constant buffers to accept the tessellation parameters, and update the vertex shader to output a structure for input into the hull shaders in the next few recipes in this chapter.
Getting ready
For this recipe, we can begin with any Direct3D project with an existing vertex shader, the PerObject
and PerFrame
constant buffers, and their C# counterparts in ConstantBuffers.cs
.
The completed source code for this recipe can be found within the Ch05_01TessellationPrimitives
project, contained within the companion source code.
How to do it…
We will first update our HLSL (High-level Shader Language) and C# structures, and then make a new vertex shader to use with the tessellation pipeline.
Update the
PerObject
constant buffer withinCommon.hlsl
to include the following property:// Matrix to take world coordinates to view/projection // Used in the domain shader float4x4 ViewProjection;
Note
As mentioned in the recipe...