Click or drag to resize
AB4D logo

RenderingContext Class

RenderingContext defines the context of the current rendering pass.
Inheritance Hierarchy
SystemObject
  Ab3d.DirectXRenderingContext
    Ab3d.DirectXCustomRenderingContext

Namespace: Ab3d.DirectX
Assembly: Ab3d.DXEngine (in Ab3d.DXEngine.dll) Version: 7.0.8865.1045
Syntax
C#
public class RenderingContext : IDisposable

The RenderingContext type exposes the following members.

Constructors
Properties
 NameDescription
Public propertyCurrentBackBuffer Gets the currently used BackBuffer as Texture2D. The value of CurrentBackBuffer is initialized from DXScene.BackBuffer or DXScene.MSAABackBuffer (when multisampling is used) in the InitializeRenderingStep. The value can be changed with the SetBackBuffer(Texture2D, Texture2DDescription, RenderTargetView, DepthStencilView, Int32, Boolean) method.
Public propertyCurrentBackBufferDescription Gets the description of the currently used BackBuffer. The value of CurrentBackBufferDescription is initialized from DXScene.BackBufferDescription or DXScene.MSAABackBufferDescription (when multisampling is used) in the InitializeRenderingStep. The value can be changed with the SetBackBuffer(Texture2D, Texture2DDescription, RenderTargetView, DepthStencilView, Int32, Boolean) method.
Public propertyCurrentDepthStencilView Gets the currently used DepthStencilView. The value of CurrentDepthStencilView is initialized from DXScene.DepthStencilView in the InitializeRenderingStep. The value can be changed with the SetBackBuffer(Texture2D, Texture2DDescription, RenderTargetView, DepthStencilView, Int32, Boolean) method.
Public propertyCurrentRenderingStep Gets currently executing RenderingStep
Public propertyCurrentRenderTargetView Gets the currently used RenderTargetView. The value of CurrentRenderTargetView is initialized from DXScene.RenderTargetView in the InitializeRenderingStep. The value can be changed with the SetBackBuffer(Texture2D, Texture2DDescription, RenderTargetView, DepthStencilView, Int32, Boolean) method.
Public propertyCurrentSupersamplingCount Gets a super-sampling count that is used by the current BackBuffer (how much more pixels are rendered for each final pixel). Value 1 indicates no super-sampling. This value is set by the SetBackBuffer(Texture2D, Texture2DDescription, RenderTargetView, DepthStencilView, Int32, Boolean) method.
Public propertyCurrentSupersamplingFactor Gets the factor by which width and height are multiplied because of the used super-sampling. This value is calculated by using Sqrt function of the CurrentSupersamplingCount value.
Public propertyCurrentViewport Gets or sets the current Viewport that is used for the next DrawCall. The value of CurrentViewport is initialized from DXScene.Viewport in the InitializeRenderingStep.
Public propertyFinalBackBuffer Gets the Texture2D that represents the BackBuffer that will contain the finally rendered image. FinalBackBuffer must not use multisampling and should not be a staging buffer. When you need to copy the FinalBackBuffer to the main memory, set StagingBackBuffer. FinalBackBuffer can be set with SetFinalBackBufferInternal(Texture2D, Texture2DDescription, RenderTargetView) method that can be available from a class derived from RenderingContext - for example CustomRenderingContext.
Public propertyFinalBackBufferDescription Gets the description of the FinalBackBuffer.
Public propertyFinalRenderTargetView Gets the RenderTargetView of the FinalBackBuffer.
Public propertyFrameNumber Current frame number
Public propertyIsCollectingBackBufferChanges Gets or sets a Boolean that specifies if all changes to BackBuffer are collected and can be get with calling the GetBackBufferChangesReport method.
Public propertyName Gets the name the this RenderingContext (usually indicates a background or main thread)
Public propertyRenderReason Gets or sets ChangeNotifications flags that were set on DXScene with NotifyChange method and describe the changes that lead to render
Public propertySSAABackBuffer Gets super-sampled back buffer that is used for super-sampling. This property is set by SetSupersamplingBackBuffers(Texture2D, ShaderResourceView, RenderTargetView) method.
Public propertySSAARenderTargetView Gets super-sampled back buffer RenderTargetView that is used for super-sampling. This property is set by SetSupersamplingBackBuffers(Texture2D, ShaderResourceView, RenderTargetView) method.
Public propertySSAAShaderResourceView Gets super-sampled back buffer ShaderResourceView that is used for super-sampling. This property is set by SetSupersamplingBackBuffers(Texture2D, ShaderResourceView, RenderTargetView) method.
Public propertyStagingBackBuffer StagingBackBuffer is used to allow coping the FinalBackBuffer to the main memory. This is done in the CompleteRenderingStep where the FinalBackBuffer is first copied to StagingBackBuffer and then the StagingBackBuffer is mapped so that it can be accessed by the CPU and copied to main memory. The StagingBackBuffer is set with RegisterBackBufferMapping(BackBufferReadyEventHandler) or RegisterBackBufferMapping(Texture2D, Texture2DDescription, BackBufferReadyEventHandler) methods.
Public propertyStagingBackBufferDescription Gets the description of the StagingBackBuffer.
Public propertyStagingBackBufferMappedCallbacks Get a list of BackBufferReadyEventHandler delegate that are called when the StagingBackBuffer has been mapped and is ready to be copied from GPU memory to the main memory. A delagate is added to this list with RegisterBackBufferMapping(BackBufferReadyEventHandler) or RegisterBackBufferMapping(Texture2D, Texture2DDescription, BackBufferReadyEventHandler) methods.
Public propertySwapChain Gets the SwapChain when DXEngine is using SwapChain or null when SwapChain is not used.
Public propertyUsedCamera Gets or sets a camera that will be used to view the scene. Usually UsedCamera is set in the InitializeRenderingStep from the DXScene's Camera property.
Public propertyVirtualRealityContext Gets the current VirtualRealityContext that is set when DXDEngine is using rendering for virtual reality (different images for left and right eye).
Top
Methods
 NameDescription
Public methodDispose Dispose
Public methodGetBackBufferChangesReport GetBackBufferChangesReport returns a string that contains all the BackBuffer changes and the RenderingStep names. To get results first set IsCollectingBackBufferChanges to true, render the scene again and then call this method. DebugName for DirectX resources need to be set to see any meaningful reports.
Public methodRegisterBackBufferMapping(BackBufferReadyEventHandler) RegisterBackBufferMapping method is used to register a specified callback delegate that is called only once when the next frame is rendered. The render frame is also rendered into a special staging back buffer and that buffer is mapped so it can be accessed by the CPU (copied into main memory). This method creates an ad-hoc staging back buffer that is disposed after the stagingBackBufferMappedCallback is called. If you want to get multiple frames or specify your own staging back buffer the use the RegisterBackBufferMapping(Texture2D, Texture2DDescription, BackBufferReadyEventHandler) method.
Public methodRegisterBackBufferMapping(Texture2D, Texture2DDescription, BackBufferReadyEventHandler) 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.
Public methodSetBackBuffer Changes the current BackBuffer and its RenderTargetView and DepthStencilView. With setting bindNewRenderTargetsToDeviceContext to true, it is also possible to call SetRenderTargets method on the DeviceContext.OutputMerger and change the currently bind RenderTargetView and DepthStencilView. The specified back buffer will be used for the following rendering steps. If the specified back buffer is different from the FinalBackBuffer, then the back buffer will be copied or resolved (in case of MSAA back buffer) into FinalBackBuffer at the end of rendering.
Public methodSetSupersamplingBackBuffers Sets the CurrentSupersamplingCount and the super-sampled back buffer and its ShaderResourceView.
Public methodUnregisterAllBackBufferMappings Unregisters all delegates that were registered with the RegisterBackBufferMapping(Texture2D, Texture2DDescription, BackBufferReadyEventHandler) methods. The method also sets the StagingBackBuffer to null and resets the StagingBackBufferDescription to empty values.
Public methodUnregisterBackBufferMapping Unregisters the stagingBackBufferMappedCallback delegate that was registered with the RegisterBackBufferMapping(Texture2D, Texture2DDescription, BackBufferReadyEventHandler) method. When all the callbacks are unregistered the StagingBackBuffer and StagingBackBufferMappedCallbacks are set to null and StagingBackBufferDescription is reset to empty values.
Top
Fields
 NameDescription
Public fieldCommonStates Currently used CommonStates
Public fieldContextStatesManager Currently used DeviceContext
Public fieldDeviceContext Currently used DeviceContext
Public fieldDXDevice Used DXDevice
Public fieldDXScene Parent DXScene
Top
See Also