Graphics Reference
In-Depth Information
stream declarations. The argument can be declared as a PointStream<T>. LineStream<T>,
or TriangleStream<T>, where each T represents the format of the vertex structure that
will be passed into the stream. We will further discuss the mechanics of how these output
streams must be used in the "Geometry Shader" section.
One final input consideration is the use of two system value semantics, one that we
have seen before and one new one. The SV_PrimitiveID system value attribute is avail-
able to uniquely identify each of the primitives that are passed to the geometry shader. We
have previously seen this system value in the hull shader stage, where it can be used to
uniquely identify control patches. Since the geometry shader is invoked once per primitive,
this system value semantic also uniquely identifies the geometry shader invocations, as well.
The other system value semantic that the geometry shader can use as an input is
SV_GSInstanceID. This system value semantic works similarly to SV_InstanceID, which
we saw in the vertex shader stage, except that the instances are actually instanced in the
geometry shader stage itself, instead of in the input assembler stage. It is possible to de-
clare a static number of instances to create for each primitive that the geometry shader
receives. The SV_GSInstanceID is used to differentiate among the individual primitive
instances and take the appropriate action in the shader program. This system value must
be declared as a standalone input to the geometry shader, since it can't be declared in one
of the input streams. Since the identifier indicates which geometry shader invocation is be-
ing processed, it makes sense to not allow this to be a per-vertex streaming attribute. The
technique to enable this instancing mechanism is discussed in the "Geometry Shader State
Configuration" section, while the use of the functionality is discussed in more detail in the
"Geometry Shader Stage Processing" section.
3.8.2 Geometry Shader State Configuration
Like all of the other programmable pipeline stages, the geometry shader stage provides the
usual group of common shader core resource configurations that can be manipulated by
the application with the ID3DllDeviceContext interface. There are some key differences
in how geometry shader objects are created, due to the geometry shader stage's close rela-
tionship to the stream output stage, which we will cover briefly in this section, with a more
detailed examination in the "Stream Output" stage section.
Geometry Shader Program
The geometry shader object can be created with one of two methods. Which one must be
used depends on whether the stream output stage will be used or not. 1 7
If the stream output
stage will not be used, the geometry shader object is created in the same way that we have
1 7
The particular details of how the geometry shader writes data to the stream output stage is covered in the
"Geometry Shader Stage Processing" section.
Search WWH ::




Custom Search