Graphics Reference
In-Depth Information
From this listing, we can see how the buffer description is configured differently for
different usage scenarios. The size of the buffer elements and the overall size of the buffer
remain the same in both scenarios, while the bind flags, usage flags, and CPU access flags
all vary, depending on the intended use of the buffer. We will see a similar pattern through-
out each of the buffer description specifications for the other buffer types.
Resource view requirements. Vertex buffers are bound directly to either the input assem-
bler stage or the stream output stage. Because of this, there is no need to create a resource
view when using it.
Index Buffers
The second buffer type that we will look at is the index buffer. The index buffer provides
the very useful ability to define primitives by referencing the vertex data stored in vertex
buffers. More or less, the index buffer provides a list of indices that point into the list of
vertices. Depending on the desired type of primitive (such as points, lines, and triangles)
appropriately sized groups of indices are formed to define which vertices that primitive is
made up of. Figure 2.10 depicts this operation visually.
The use of index buffers can potentially provide a significant reduction in the total
number of vertices that need to be defined. Since each adjacent primitive definition can
reference the same vertex data as its neighboring primitives, the shared vertices do not
need to be repeated in the vertex buffer. In addition, this sharing of vertices allows multiple
primitives to use the same output vertex from a vertex shader. We will discuss the vertex
shader in more detail in Chapter 3, "The Rendering Pipeline," but for now, we just need
to understand that after a vertex has been run through the vertex shader, the result can be
Figure 2.10. An index buffer creating triangles by referencing vertices.
Search WWH ::




Custom Search