Game Development Reference
In-Depth Information
This method provides a D3D11_MAPPED_SUBRESOURCE object, which contains a
pointer to the data you need to update, as well as some details about it. You can op-
erate on the pData attribute depending on your access permissions.
Once you're done, just unmap the data using the following call:
m_d3dContext->Unmap(resource, subresource);
The UpdateSubresource() method
There is another method that lets you update data using a single function call;
however, it does not work in all situations.
Note
For further details on when you can use the UpdateSubresource() method,
please check the MSDN documentation for ID3D11DeviceCon-
text::UpdateSubresource() at
http://msdn.microsoft.com/en-us/library/windows/desktop/ff476486
M_d3dContext->UpdateSubresource(
Resource,
Subresource,
destBox,
sourceData,
rowPitch,
depthPitch
);
Here the destBox refers to the portion of data that should be changed with this op-
eration. Rather than replacing everything you can update just a subsection of the re-
source, which can save time. If you pass nullptr to this, you will update the entire
resource.
Search WWH ::




Custom Search