Game Development Reference
In-Depth Information
Note
Only the Map() method may access a buffer created with this setting.
D3D11_USAGE_DEFAULT : This describes a buffer that gives read and write
access to the GPU. This is the most common choice for a lot of buffers,
however, in the case of vertex and index buffers this is not the most optimal
choice.
D3D11_USAGE_STAGING : Finally D3D11_USAGE_STAGING describes a buf-
fer that will be used for the staging update method. This is when you use an
intermediate buffer to update a buffer on the GPU through a resource copy.
This method has a performance benefit and avoids costly synchronization
blocks, at the cost of extra memory.
As a vertex buffer rarely changes after creation, it is strongly recommended that you
use the D3D11_USAGE_IMMUTABLE for those buffers, and pass in the data during
the creation call.
Moving on, BindFlags describes what the buffer will be, and consequently where
it will be bound in the pipeline. A handy enumeration makes it easy to set this value
and, while there are a few options to choose from, we only really care about the
D3D11_BIND_VERTEX_BUFFER and D3D11_BIND_INDEX_BUFFER .
CPUAccessFlags tells the API how the CPU will access the buffer after creation,
allowing for optimizations based on what you require. In most cases you won't
need CPU access so you can just set this to zero; however, if you want access
you will need to apply a logical OR operation to set the flag as desired. The
D3D11_CPU_ACCESS_FLAG enumeration provides you with two options for this set-
ting: D3D11_CPU_ACCESS_WRITE and D3D11_CPU_ACCESS_READ .
MiscFlags allows you to set some extra flags using a logical OR operation on val-
ues from the D3D11_RESOURCE_MISC_FLAG enumeration. In most cases you will
just set this to zero.
Search WWH ::




Custom Search