Graphics Reference
In-Depth Information
Figure 3.13. A depiction of vertices of a triangle strip that belong to multiple primitives.
must be passed through the vertex shader output if they are to be used later on. This is
a reasonable restriction—if the system values are generated in the input assembler, they
are directly available to the vertex shader. If that shader decides not to propagate the sys-
tem values further down the pipeline, they would not simply reappear in a later pipeline
stage that needs them. The developer must ensure that any system value semantics that are
needed later on are passed from stage to stage until they are used.
One system value semantic that is not available to the vertex shader is the SV_
PrimitiveID attribute. SV_PrimitiveID is produced by the input assembler and provides
an identifier for each primitive in the primitive stream. Vertices are processed by the vertex
shader stage one at a time, regardless of the primitive type being rendered. In addition, a
single processed output vertex produced by the vertex shader can be use in more than one
primitive, such as in triangle strips, or as seen in our discussion of indexed rendering. This
makes having a unique primitive ID for an input vertex attribute illogical, since it can be
used in multiple primitives. Figure 3.13 shows a very simple set of geometry that is submit-
ted as a triangle strip, which highlights this situation.
When geometry such as this is processed by the pipeline, each vertex would be pro-
cessed individually by the vertex shader stage. If the SV_PrimitiveID were allowed in the
vertex shader, which primitive index would be assigned to vertex v37 It belongs to multiple
primitives, and hence it would not be clear which primitive ID a shared vertex should use.
3.4.2 Vertex Shader State Configuration
As a programmable shader stage, the vertex shader implements the common shader core
functionality. This means that it provides a standard set of resource interface methods that
allow an application to provide the shader program access to the required resources. As
with all pipeline manipulations, all of the methods that can change the vertex shader stage's
Search WWH ::




Custom Search