> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SetViewInstanceMask

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

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

## Syntax

```cpp theme={null}
void SetViewInstanceMask(
    UINT Mask
)
```

### Parameters

*Mask \[in]*\
Type: UINT

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

### Return value

Type: void

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

**Header:** d3d12\_xs.h or d3d12\_x.h\
**Library:** d3d12\_xs.lib or d3d12\_x.lib\
**Supported Platforms**: XBOX Series consoles and XBOX One family

## See Also

[ID3D12GraphicsCommandList1](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist1/id3d12graphicscommandlist1_public)


## Related topics

- [D3D12_VIEW_INSTANCING_TIER](/reference/graphics/d3d12/enums/d3d12_view_instancing_tier_public.md)
- [D3D12_VIEW_INSTANCE_LOCATION](/reference/graphics/d3d12/structs/d3d12_view_instance_location_public.md)
- [D3D12_VIEW_INSTANCING_DESC](/reference/graphics/d3d12/structs/d3d12_view_instancing_desc_public.md)
- [D3D12_GRAPHICS_STATES](/reference/graphics/d3d12/enums/d3d12_graphics_states_public.md)
- [D3D12_RAYTRACING_INSTANCE_DESC (XBOX Series consoles)](/reference/graphics/d3d12/structs/d3d12_raytracing_instance_desc_public.md)
