Graphics Reference
In-Depth Information
These flags can be combined with a bitwise OR operation to indicate if the re-
source will be read, written, or read and written by the CPU. These settings must also
take into account the usage flags that are specified for this resource as well. As shown
in the table above, a staging resource can be both read from and written to by the CPU,
allowing both of these flags to be set. In contrast, a default usage is not accessible to
the CPU at all, and hence its CPU access flags must be set to 0.
Bind Flags
Our next common resource flag is the bind flag. This property indicates where on the
pipeline a resource can be bound and includes various flags that represent each available
binding location. These flags can also be combined with a bitwise OR to allow for mul-
tiple bind locations to be defined for the same resource. If a resource is created without
the appropriate flag, and the application tries to bind the resource to the pipeline, then it
will cause an error. All of the available binding locations are shown in Listing 2.3 in the
D3D11_BIND_FLAG enumeration.
enum D3D11_BIND_FLAG {
D3D11_BIND_VERTEX_BUFFER,
D3D11_BIND_INDEX_BUFFER J
D3D11_BIND_C0NSTANT_BUFFER,
D3D11_BIND_SHADER_RES0URCE,
D3D11_BIND_STREAM_OUTPUT,
D3D11_BIND_RENDER_TARGET,
D3D11_BIND_DEPTH_STENCIL,
D3D11_BIND_UNORDERED_ACCESS
}
Listing 2.3. The D3D11 BIND FLAG enumeration.
As you can see from this list, there are only eight types of locations where re-
sources can be bound to the pipeline. The vertex and index buffer flags are used to de-
clare resources that will be attached to the input assembler stage to feed the pipeline
with geometry, while the render target and depth stencil flags allow resources to be
connected to the output merger stage to receive the rendered output from the pipe-
line. The stream output flag also allows output from the pipeline, although it receives
geometry instead of rasterized image data. These flags all represent a single binding
point on the pipeline.
In contrast, the D3D11_BIND_C0NSTANT_BUFFER, D3D11_BIND_SHADER_RES0URCE,
and D3D11_BIND_UN0RDERED_ACCESS access flags all indicate that the resource can be
Search WWH ::




Custom Search