Click or drag to resize
AB4D logo

ContextStatesManager Class

ContextStatesManager is a helper class that is used to set the current BlendStates, DepthStencilStates, RasterizerState and SamplerStates. Before each state change it checks if the state already has the new state value and in this case prevents the actual DirectX state change call to improve performance. ContextStatesManager also collect state changes statistics.
Inheritance Hierarchy
SystemObject
  Ab3d.DirectXDXResourceBase
    Ab3d.DirectXDisposableDXResource
      Ab3d.DirectXContextStatesManager

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

The ContextStatesManager type exposes the following members.

Properties
 NameDescription
Public propertyBlendState Gets or sets the current BlendState
Public propertyConstantBufferChangesCount Gets number of times constant buffer is changed after last call to ResetChangesCount.
Public propertyDepthStencilState Gets or sets the current DepthStencilState
Public propertyGeometryShader Gets or sets the current GeometryShader
Public propertyIndexBuffersChangesCount Gets number of times index buffer is changed after last call to ResetChangesCount.
Public propertyInputLayout Gets or sets the current InputLayout
Public propertyIsBlendStateLocked If set to true than the current BlendState cannot be changed until IsBlendStateLocked is set to false.
Public propertyIsDepthStencilStateLocked If set to true than the current DepthStencilState cannot be changed until IsDepthStencilStateLocked is set to false.
Public propertyIsFrontCounterClockwise Gets a boolean that is the same as the IsFrontCounterClockwise value in RasterizerState (this is an cached value and do not require a native GetDescription call on each getter call)
Public propertyIsRasterizerStateLocked If set to true than the current RasterizerState cannot be changed until IsRasterizerStateLocked is set to false.
Public propertyIsSamplerStateLocked If set to true than the current SamplerState cannot be changed until IsSamplerStateLocked is set to false.
Public propertyPixelShader Gets or sets the current PixelShader
Public propertyPrimitiveTopology Gets or sets the current PrimitiveTopology
Public propertyRasterizerState Gets or sets the current RasterizerState
Public propertyShaderChangesCount Gets number of times shader is changes after last call to ResetChangesCount.
Public propertyStateChangesCount Gets number of state changes after last call to ResetChangesCount.
Public propertyVertexBuffersChangesCount Gets number of times vertex buffer is changed after last call to ResetChangesCount.
Public propertyVertexShader Gets or sets the current VertexShader
Top
Methods
 NameDescription
Public methodGetGeometryShaderConstantBuffer Gets the constant buffer as Buffer for the specified slot in the geometry shader
Public methodGetPixelShaderConstantBuffer Gets the constant buffer as Buffer for the specified slot in the pixel shader
Public methodGetPixelShaderResource Gets the ShaderResourceView for the specified slot in the pixel shader
Public methodGetSamplerState Gets the SamplerState for the specified slot
Public methodGetVertexShaderConstantBuffer Gets the constant buffer as Buffer for the specified slot in the vertex shader
Public methodReset(Boolean) Resets all the cached resource states. This is usually called at the beginning of rendering a frame because we do not know if any state changes were set after the last frame was rendered.
Public methodReset(ContextStatesManagerResetType, Boolean, Boolean) Resets the specified cached resource states. This can be called if some state were not set by ContextStatesManager but were directly set by the application so the current values stored in ContextStatesManager are not valid any more.
Public methodResetChangesCount Resets the counter that counts how many state changes appeared in this ContextStatesManager
Public methodSetGeometryShader Sets the geometry shader if it is different as previously set geometry shader. The same as setter for GeometryShader property but this method returns true if geometry shader was changed.
Public methodSetGeometryShaderConstantBuffer Sets the constant buffer for the specified slot in the geometry shader
Public methodSetIndexBuffer SetIndexBuffer sets the index buffer to the new index buffer if it is changed.
Public methodSetPixelShader Sets the pixel shader if it is different as previously set pixel shader. The same as setter for PixelShader property but this method returns true if pixel shader was changed.
Public methodSetPixelShaderConstantBuffer Sets the constant buffer for the specified slot in the pixel shader
Public methodSetPixelShaderResource Sets the ShaderResourceView for the specified slot in the pixel shader
Public methodSetRasterizerState It is possible to call this method to set rasterizer stat and also set the cached value of IsFrontCounterClockwise. This eliminates the need to call the native GetDescription call when IsFrontCounterClockwise check is needed.
Public methodSetSamplerState Sets the SamplerState for the specified slot
Public methodSetVertexBuffer Sets vertex buffer.
Public methodSetVertexShader Sets the vertex shader if it is different as previously set vertex shader. The same as setter for VertexShader property but this method returns true if vertex shader was changed.
Public methodSetVertexShaderConstantBuffer Sets the constant buffer for the specified slot in the vertex shader
Top
See Also