Graphics Reference
In-Depth Information
As seen in Listing 3.15, the input control patch is declared as a const input parame-
ter, since it can't be modified. Due to this read-only access, any modifications or additional
data that must be included in the control patch for the domain shader program to create the
output vertices must be provided by the hull shader program before this stage.
In addition to the control patch, the domain shader program also receives the domain
location that it is supposed to implement from the tessellator stage. This data is provided
as the SV_Domainl_ocation system value semantic. The format of this attribute varies,
depending on which domain type is specified, with a float2 used for isoline and quad
domains, and a float3 for tri domains. These values represent where within the domain
this domain shader invocation should generate vertex data. In this respect, the coordinate
location defines a sampling point over a virtual surface determined by the function that
the domain shader program implements. We will investigate this concept further in the
processing portion of this section.
The final set of input data that the domain shader program receives is the constants that
were produced by the patch constant function of the hull shader stage. The data contained
within this structure varies, according to what is calculated in the patch constant function, but
it will remain the same for each domain shader program invocation for a given control patch.
To provide a high-level view of what the domain shader program is required to do,
we can examine its input from the pipeline. All of the input control patch data is provided
to every invocation of the domain shader program. In addition, the data received from the
patch constant function is also constant across a complete control patch. This means that
the only input that varies between invocations of a domain shader for a complete control
patch is the domain location. This makes sense, since the number of points produced by
the tessellator stage will vary, but the control patch data input doesn't change with a vary-
ing tessellation level. The separation of these two functionalities in the hull shader stage
provides a clear distinction in this regard.
3.7.2 Domain Shader State Configuration
As a programmable pipeline stage, the domain shader stage can use the standard set of con-
figurations available to all programmable stages. Again, these configurations are set by the
application through the ID3D11DeviceContext interface with the familiar method names,
with the exception that the beginning of the method names use DS to indicate that they will af-
fect the domain shader stage. Since these methods and their usage characteristics have already
been discussed, we won't repeat the code listings here. Further details on using these methods
can be found in the "Vertex Shader" section. The methods are listed here for reference.
ID3DllDeviceContext::DSSetShader()
ID3DllDeviceContext::DSSetConstantBuffens()
Search WWH ::




Custom Search