> ## 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.

# D3D12_VIEW_INSTANCING_DESC

> Specifies parameters used during view instancing configuration.

Specifies parameters used during view instancing configuration.

## Syntax

```cpp theme={null}
typedef struct D3D12_VIEW_INSTANCING_DESC
{
    UINT ViewInstanceCount;
    const D3D12_VIEW_INSTANCE_LOCATION  pViewInstanceLocations;
    D3D12_VIEW_INSTANCING_FLAGS Flags;
} D3D12_VIEW_INSTANCING_DESC
```

### Members

*ViewInstanceCount*\
Type: UINT

Specifies the number of views to be used, up to D3D12\_MAX\_VIEW\_INSTANCE\_COUNT.

*pViewInstanceLocations*\
Type: const D3D12\_VIEW\_INSTANCE\_LOCATION \*

The address of a memory location that contains **ViewInstanceCount** view instance location structures that specify the location of viewport/scissor and render target details of each view instance.

*Flags*\
Type: D3D12\_VIEW\_INSTANCING\_FLAGS

Configures view instancing with additional options.

## Remarks

View instancing is declared in a PSO using this structure. The view instance count is set in the PSO to allow whole-pipeline optimization based on the number of views.

View instancing is disabled when it's not declared in the PSO or when ViewInstanceCount is set to 0. When disabled, rendering behaves as if view instancing is enabled and ViewInstanceCount is set to 1; shaders only see a value of 0 in SV\_ViewID and just one view instance is produced. This allows shaders that are aware of view instancing to still be used in PSOs that disable it. Some adapters might support shader model 6.1 (which exposes SV\_ViewID) but not view instancing; these adapters must still support shaders that input SV\_ViewID in PSOs that declare ViewInstanceCount as 0 or 1.

The shader prior to rasterization can output SV\_RenderTargetArrayIndex and SV\_ViewportArrayIndex values which don't have to depend on SV\_ViewID. To compute the final effective index of the viewport and render target where primitives will be sent, these values, when present, are added to the ViewportArrayIndex and RenderTargetArrayIndex values of the view instance locations declared in the PSO. If a computed index is out of range (that is, when the index is larger than the number of viewport or render target elements in their respective arrays) then the effective index becomes 0.

For shaders that dynamically select the viewport or render target indices, an application can set all the view instance locations declared in the PSO to a single value (such as 0) to act as a uniform base index to which the dynamically-selected SV\_RenderTargetArrayIndex and SV\_ViewportArrayIndex values are added.

## 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

[Core Structures](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/direct3d-12-structures)


## Related topics

- [D3D12_VIEW_INSTANCING_FLAGS](/reference/graphics/d3d12/enums/d3d12_view_instancing_flags_public.md)
- [D3D12_VIEW_INSTANCING_TIER](/reference/graphics/d3d12/enums/d3d12_view_instancing_tier_public.md)
- [D3D12_SHADER_RESOURCE_VIEW_DESC](/reference/graphics/d3d12/structs/d3d12_shader_resource_view_desc_public.md)
- [D3D12_CONSTANT_BUFFER_VIEW_DESC](/reference/graphics/d3d12/structs/d3d12_constant_buffer_view_desc_public.md)
- [D3D12_DEPTH_STENCIL_VIEW_DESC](/reference/graphics/d3d12/structs/d3d12_depth_stencil_view_desc_public.md)
