Click or drag to resize
AB4D logo

RenderingContextRegisterBackBufferMapping(Texture2D, Texture2DDescription, BackBufferReadyEventHandler) Method

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. When the stagingBackBuffer is ready to be accessed (is mapped), the stagingBackBufferMappedCallback delegate is called.

Namespace: Ab3d.DirectX
Assembly: Ab3d.DXEngine (in Ab3d.DXEngine.dll) Version: 7.0.8865.1045
Syntax
C#
public void RegisterBackBufferMapping(
	Texture2D stagingBackBuffer,
	Texture2DDescription stagingBackBufferDescription,
	BackBufferReadyEventHandler stagingBackBufferMappedCallback
)

Parameters

stagingBackBuffer  Texture2D
Texture2D that specifies a StagingBackBuffer created with Usage set to Staging and CpuAccessFlags set to Read
stagingBackBufferDescription  Texture2DDescription
Texture2DDescription of the stagingBackBuffer
stagingBackBufferMappedCallback  BackBufferReadyEventHandler
Delegate that is called when the StagingBackBuffer has been mapped and is ready to be copied from GPU memory to the main memory
Remarks

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.

See Also