ID3D12GraphicsCommandList1::SetViewInstanceMask method (d3d12.h)

Set a mask that controls which view instances are enabled for subsequent draws.

Syntax

void SetViewInstanceMask(
  [in] UINT Mask
);

Parameters

[in] Mask

Type: UINT

A mask that specifies which views are enabled or disabled. If bit i starting from the least-significant bit is set, view instance i is enabled.

Return value

None

Remarks

The view instance mask only affects PSOs that declare view instance masking by specifying the D3D12_VIEW_INSTANCING_FLAG_ENABLE_VIEW_INSTANCE_MASKING flag during their creation. Attempting to create a PSO that declares view instance masking will fail on adapters that don't support view instancing.

The view instance mask defaults to 0 which disables all views. This forces applications that declare view instance masking to explicitly choose the views to enable, otherwise nothing will be rendered. If the view instance mask enabled all views by default the application might not remember to disable unused views, resulting in lost performance due to wasted work.

Bundles don't inherit their view instance mask from their caller, defaulting to 0 instead. This is because the mask setting must be known when the bundle is recorded if it affects how an implementation records draws. The view instance mask set by a bundle does persist to the caller after the bundle completes, however. These inheritance semantics are similar to those of PSOs.

No shader code paths that are dependent on SV_ViewID are executed at any shader stage for view instances that are masked off and no clipping, viewport processing, or rasterization is performed. Implementations that inspect the mask during rendering can incur a small performance penalty over PSOs that don't declare view instance masking at all, but usually the penalty can be overcome by the performance savings that result from skipping the work associated with the masked off views. Depending on the frequency and amount of skipped work, the performance gains can be significant.

Requirements

Requirement Value
Target Platform Windows
Header d3d12.h

See also

ID3D12GraphicsCommandList1