D3D12_RASTERIZER_DESC structure (d3d12.h)

Describes rasterizer state.

Syntax

typedef struct D3D12_RASTERIZER_DESC {
  D3D12_FILL_MODE                       FillMode;
  D3D12_CULL_MODE                       CullMode;
  BOOL                                  FrontCounterClockwise;
  INT                                   DepthBias;
  FLOAT                                 DepthBiasClamp;
  FLOAT                                 SlopeScaledDepthBias;
  BOOL                                  DepthClipEnable;
  BOOL                                  MultisampleEnable;
  BOOL                                  AntialiasedLineEnable;
  UINT                                  ForcedSampleCount;
  D3D12_CONSERVATIVE_RASTERIZATION_MODE ConservativeRaster;
} D3D12_RASTERIZER_DESC;

Members

FillMode

A D3D12_FILL_MODE-typed value that specifies the fill mode to use when rendering.

CullMode

A D3D12_CULL_MODE-typed value that specifies that triangles facing the specified direction are not drawn.

FrontCounterClockwise

Determines if a triangle is front- or back-facing. If this member is TRUE, a triangle will be considered front-facing if its vertices are counter-clockwise on the render target and considered back-facing if they are clockwise. If this parameter is FALSE, the opposite is true.

DepthBias

Depth value added to a given pixel. For info about depth bias, see Depth Bias.

DepthBiasClamp

Maximum depth bias of a pixel. For info about depth bias, see Depth Bias.

SlopeScaledDepthBias

Scalar on a given pixel's slope. For info about depth bias, see Depth Bias.

DepthClipEnable

Specifies whether to enable clipping based on distance.

The hardware always performs x and y clipping of rasterized coordinates. When DepthClipEnable is set to the default–TRUE, the hardware also clips the z value (that is, the hardware performs the last step of the following algorithm).


0 < w
-w <= x <= w (or arbitrarily wider range if implementation uses a guard band to reduce clipping burden)
-w <= y <= w (or arbitrarily wider range if implementation uses a guard band to reduce clipping burden)
0 <= z <= w

When you set DepthClipEnable to FALSE, the hardware skips the z clipping (that is, the last step in the preceding algorithm). However, the hardware still performs the "0 < w" clipping. When z clipping is disabled, improper depth ordering at the pixel level might result. However, when z clipping is disabled, stencil shadow implementations are simplified. In other words, you can avoid complex special-case handling for geometry that goes beyond the back clipping plane.

MultisampleEnable

Specifies whether to use the quadrilateral or alpha line anti-aliasing algorithm on multisample antialiasing (MSAA) render targets. Set to TRUE to use the quadrilateral line anti-aliasing algorithm and to FALSE to use the alpha line anti-aliasing algorithm. For more info about this member, see Remarks.

AntialiasedLineEnable

Specifies whether to enable line antialiasing; only applies if doing line drawing and MultisampleEnable is FALSE. For more info about this member, see Remarks.

ForcedSampleCount

Type: UINT

The sample count that is forced while UAV rendering or rasterizing. Valid values are 0, 1, 4, 8, and optionally 16. 0 indicates that the sample count is not forced.

Note  If you want to render with ForcedSampleCount set to 1 or greater, you must follow these guidelines:
  • Don't bind depth-stencil views.
  • Disable depth testing.
  • Ensure the shader doesn't output depth.
  • If you have any render-target views bound (D3D12_DESCRIPTOR_HEAP_TYPE_RTV) and ForcedSampleCount is greater than 1, ensure that every render target has only a single sample.
  • Don't operate the shader at sample frequency. Therefore, ID3D12ShaderReflection::IsSampleFrequencyShader returns FALSE.
Otherwise, rendering behavior is undefined.

ConservativeRaster

A D3D12_CONSERVATIVE_RASTERIZATION_MODE-typed value that identifies whether conservative rasterization is on or off.

Remarks

A D3D12_GRAPHICS_PIPELINE_STATE_DESC contains a rasterizer-state structure.

Rasterizer state defines the behavior of the rasterizer stage.

If you do not specify some rasterizer state, the Direct3D runtime uses the following default values for rasterizer state.

State Default Value
FillMode D3D12_FILL_MODE_SOLID
CullMode D3D12_CULL_MODE_BACK
FrontCounterClockwise FALSE
DepthBias 0
DepthBiasClamp 0.0f
SlopeScaledDepthBias 0.0f
DepthClipEnable TRUE
MultisampleEnable FALSE
AntialiasedLineEnable FALSE
ForcedSampleCount 0
ConservativeRaster D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF
 
Note  For feature levels 9.1, 9.2, 9.3, and 10.0, if you set MultisampleEnable to FALSE, the runtime renders all points, lines, and triangles without anti-aliasing even for render targets with a sample count greater than 1. For feature levels 10.1 and higher, the setting of MultisampleEnable has no effect on points and triangles with regard to MSAA and impacts only the selection of the line-rendering algorithm as shown in this table:
 
Line-rendering algorithm MultisampleEnable AntialiasedLineEnable
Aliased FALSE FALSE
Alpha antialiased FALSE TRUE
Quadrilateral TRUE FALSE
Quadrilateral TRUE TRUE
 

The settings of the MultisampleEnable and AntialiasedLineEnable members apply only to multisample antialiasing (MSAA) render targets (that is, render targets with sample counts greater than 1). Because of the differences in feature-level behavior and as long as you aren’t performing any line drawing or don’t mind that lines render as quadrilaterals, we recommend that you always set MultisampleEnable to TRUE whenever you render on MSAA render targets.

Requirements

Requirement Value
Header d3d12.h

See also

CD3DX12_RASTERIZER_DESC

Conservative Rasterization

Core Structures

Rasterizer Ordered Views