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

> 指定与视图实例关联的视口/模板和渲染目标。

指定与视图实例关联的视口/模板和渲染目标。

## 语法

```cpp theme={null}
typedef struct D3D12_VIEW_INSTANCE_LOCATION
{
    UINT ViewportArrayIndex;
    UINT RenderTargetArrayIndex;
} D3D12_VIEW_INSTANCE_LOCATION
```

### 成员

*ViewportArrayIndex*\
类型：UINT

与此位置关联的视图实例要使用的视口数组中的视口索引。

*RenderTargetArrayIndex*\
类型：UINT

与此位置关联的视图实例要使用的渲染目标数组中的渲染目标索引。

## 备注

在光栅化之前，可将视图实例位置结构中指定的值加到着色器输出的 ViewportArrayIndex 和 RenderTargetArrayIndex 值上，以计算用于发送图元的视口和渲染目标的最终有效索引。如果计算得到的索引超出范围（即索引大于对应数组中视口或渲染目标元素的数量），则有效索引变为 0。

对于动态选择视口或渲染目标索引的着色器，应用程序可以将 PSO 中声明的所有视图实例位置设置为相同的值，以作为所有视图的统一基准值。

## 要求

**头文件：** d3d12\_xs.h 或 d3d12\_x.h\
**库：** d3d12\_xs.lib 或 d3d12\_x.lib\
**支持的平台**：XBOX Series 主机及 XBOX One 系列

## 另请参阅

[核心结构](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/direct3d-12-structures)


## Related topics

- [D3D12_VIEW_INSTANCING_DESC](/zh-CN/reference/graphics/d3d12/structs/d3d12_view_instancing_desc_public.md)
- [D3D12_VIEW_INSTANCING_FLAGS](/zh-CN/reference/graphics/d3d12/enums/d3d12_view_instancing_flags_public.md)
- [D3D12_VERTEX_BUFFER_VIEW](/zh-CN/reference/graphics/d3d12/structs/d3d12_vertex_buffer_view_public.md)
- [D3D12_STREAM_OUTPUT_BUFFER_VIEW](/zh-CN/reference/graphics/d3d12/structs/d3d12_stream_output_buffer_view_public.md)
- [D3D12_INDEX_BUFFER_VIEW](/zh-CN/reference/graphics/d3d12/structs/d3d12_index_buffer_view_public.md)
