Graphics Reference
In-Depth Information
but we can still discuss how these buffers operate without intimate knowledge of what each
parameter means. The available indirect argument pipeline execution methods are listed
below.
• DrawInstancedIndirect( ID3D11 Buffer *pBufferForArgs,
UINT AlignedByteOffsetForArgs)
Drawlndexedlnstancedlndirect( ID3D11 Buffer *pBufferForArgs,
UINT AlignedByteOffsetForArgs)
Dispatchlndirect( ID3D11 Buffer *pBufferForArgs, UINT AlignedByteOffsetForArgs)
Each of these methods appends the Indirect term at the end of one of the stan-
dard methods, and simply replaces the arguments of the method with a reference to a
buffer resource and an offset into the buffer, which identifies where the parameters are
located in it. For example, the standard DrawInstanced() method takes four uint pa-
rameters: VertexCountPerlnstance, InstanceCount, StartVertexLocation, and
StartInstanceLocation. These arguments are passed directly in the API call to
instruct the runtime and driver what to draw and what options are desired. The
DrawInstancedIndirect() method passes these values to the runtime and driver in a
buffer resource, instead of directly passing them. For this to work, the application must
ensure that there are four consecutive uint values stored within the buffer at the location
indicated by the offset argument passed with the buffer reference. Including an offset argu-
ment in these methods allows a single buffer to be used for many different pipeline invoca-
tions, and makes it possible to store the parameters simultaneously in different locations.
Figure 2.20 shows how this scheme operates. It is also important to note that the offset into
the buffer must be 4-byte aligned to allow the individual values to stride the standard 32-bit
variable sizes.
There are many ways to update the data
in the indirect argument buffer. Any pipeline
output method or CPU manipulation tech-
nique can be used. As long as the data is
available in the buffer, it can be used to exe-
cute the pipeline. For example, one possibil-
ity is to use the AppendStructuredBuffer
resource type in a compute shader to fill it
with some GPU-generated content. The
number of items within the buffer could be
copied to the indirect argument buffer with
the ID3DllDeviceContext::CopyStructur
eCount() method, and the geometry could
Figure 2.20. The indirect arguments buffer re-
source being used to execute the rendering
pipeline.
Search WWH ::




Custom Search