Graphics Reference
In-Depth Information
Figure 3,5. An overview of the available input slots of the input assembler.
layouts. Conceptually, we can view the input assembler as having several input slots, which
can be filled with vertex buffer resources. Figure 3.5 shows this visualization.
Each slot can be filled with a vertex buffer resource that contains one or more attri-
butes of a complete vertex. For example, one vertex buffer can contain the position data for
the vertices, and a second vertex buffer can contain all of the normal vector data. It is also
possible to provide all of the vertex data within a single vertex buffer in an array of struc-
tures. The developer can choose how to best organize the input data. There are currently 16
input slots available for the application to configure, which allows for fairly flexible stor-
age options for the needed vertex data. With the individual attributes stored separately, it
is possible to dynamically decide which vertex components will be needed for a particular
rendering. This can potentially reduce the bandwidth required for reading the vertex data,
by eliminating unused attributes from the vertices. We will discuss the details of how to
store various data in multiple buffers later in this chapter.
To bind the vertex buffers to the input assembler stage, we use the device context in-
terface. As we saw in Chapter 1, the device context is the primary interface to the complete
pipeline. The process to bind several vertex buffers to the input assembler with the ID3D11
DeviceContext:: IASetVertexBuff ers method is shown in Listing 3.2. Each of the vari-
ables declared in the listing will be filled with its appropriate buffer references, strides, and
offsets, before the set vertex buffer method is called.
UINT StartSlot;
UINT NumBuffers;
ID3DllBuffer* aBuffers[D3D11_IA_VERTEX_INPUT_RES0URCE_SL0T_C0UNT];
UINT aStrides[D3Dll_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
UINT a0ffsets[D3Dll_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT];
// Fill in all data here...
pContext->IASetVertexBuffers( StartSlot, NumBuffers., aBuffers, aStrides,
aOffsets );
Listing 3.2. How to bind several vertex buffers to the input assembler stage.
Search WWH ::




Custom Search