Scoped mapped subresource. More...
#include <buffer.hpp>
Public Member Functions | |
Mapped_Subresource (ID3D11DeviceContext_ptr context, ID3D11Resource_ptr resource, UINT subresource=0, D3D11_MAP type=D3D11_MAP_WRITE_DISCARD) | |
Blocking constructor. | |
~Mapped_Subresource () | |
Unmap subresource if it is mapped (destructor). | |
void | map (D3D11_MAP type=D3D11_MAP_WRITE_DISCARD) |
Map the subresource. | |
void | unmap () |
Unmap the subresource. |
Scoped mapped subresource.
Helper class for mapping a subresource for accessing its data. This class calls ID3D11DeviceContext::Map and ID3D11DeviceContext::Unmap so that the subresource is mapped for the lifetime of an instance of this class. This is helpful for writing exception-safe code.
tk11::Mapped_Subresource::Mapped_Subresource | ( | ID3D11DeviceContext_ptr | context, | |
ID3D11Resource_ptr | resource, | |||
UINT | subresource = 0 , |
|||
D3D11_MAP | type = D3D11_MAP_WRITE_DISCARD | |||
) |
Blocking constructor.
Maps the specified subresource. If the device is still rendering, then this constructor will block.
context | Interface of device contex | |
resource | Interface of resource to be mapped | |
subresource | Index of subresource to be mapped | |
type | Mapping type |
void tk11::Mapped_Subresource::map | ( | D3D11_MAP | type = D3D11_MAP_WRITE_DISCARD |
) |
Map the subresource.
The subresource must not be mapped already. If the device is still rendering, then this method will block.
type | Type of mapping, see Direct3D11 documentation |