![]() | |
Rendering |
public void RegisterBackBufferMapping( Texture2D stagingBackBuffer, Texture2DDescription stagingBackBufferDescription, BackBufferReadyEventHandler stagingBackBufferMappedCallback )
RegisterBackBufferMapping registers the FinalBackBuffer to be accessable to the main memory.
This is done with specifying the stagingBackBuffer that is used as intermediate buffer that can be mapped and then accessed by the CPU. The stagingBackBuffer must be created with Usage set to Staging and CpuAccessFlags set to Read.
After the rendering is completed and the StagingBackBuffer is specified with this method, the CompleteRenderingStep first copies the FinalBackBuffer into the StagingBackBuffer and then maps it. This makes it accessable to the CPU. When this is done, the stagingBackBufferMappedCallback delegate is called.
It is possible to register multiple callback delegates with calling RegisterBackBufferMapping multiple times. But each call to RegisterBackBufferMapping must use the same StagingBackBuffer. To use another StagingBackBuffer, unregister the currently registered callbacks with UnregisterBackBufferMapping(BackBufferReadyEventHandler) before registering a new StagingBuffer.
To unregister back buffer mapping do one of the following:
- set the IsRegisteredForBackBufferMapping property to false in the BackBufferReadyEventHandler callback parameter or
- call the UnregisterBackBufferMapping(BackBufferReadyEventHandler) method.
After all the delegates are unregistered, the StagingBackBuffer will be set to null.