Graphics Reference
In-Depth Information
how to bind these resources to the vertex shader stage. Listing 3.9 shows how to bind one
or more constant buffers to the vertex shader stage.
ID3DllBuffer* cbuffePS[D3Dll_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT];
// Fill each element of the array with buffers here
pContext->VSSetConstantBuffers( 0 , count , cbuffers );
Listing 3.9. Binding an array of constant buffers to the vertex shader stage.
Listing 3.9 shows how to set multiple constant buffers with a single device context
method. In fact, this example shows how to set all of the available constant buffer slots.
This can be an advantageous technique if all of the elements of the ID3D11Buffer* array
are initialized to NULL. Then any constant buffers that were previously attached to this
stage are automatically detached when the NULL value is bound in its place. Figure 3.14
depicts the constant buffers slots in the vertex shader before and after such a "complete"
state setting. The array of constant buffer pointers that are currently set in the vertex shader
stage can also be retrieved with a corresponding ID3D11DeviceContext:: VSGetConstant
Figure 3.14. Unbinding unused constant buffers by using an array of buffer resource pointers initialized to
NULL.
Search WWH ::




Custom Search