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

> 描述视口的尺寸。

描述视口的尺寸。

## 语法

```cpp theme={null}
typedef struct D3D12_VIEWPORT
{
    FLOAT TopLeftX;
    FLOAT TopLeftY;
    FLOAT Width;
    FLOAT Height;
    FLOAT MinDepth;
    FLOAT MaxDepth;
} D3D12_VIEWPORT
```

### 成员

*TopLeftX*\
类型：FLOAT

视口左侧的 X 位置。

*TopLeftY*\
类型：FLOAT

视口顶部的 Y 位置。

*Width*\
类型：FLOAT

视口的宽度。

*Height*\
类型：FLOAT

视口的高度。

*MinDepth*\
类型：FLOAT

视口的最小深度。取值范围在 0 到 1 之间。

*MaxDepth*\
类型：FLOAT

视口的最大深度。取值范围在 0 到 1 之间。

## 备注

将这些结构的数组作为 <i>pViewports</i> 参数传递给 [ID3D12GraphicsCommandList::RSSetViewports](/reference/graphics/d3d12/interfaces/id3d12graphicscommandlist/methods/id3d12graphicscommandlist_rssetviewports_public) 调用，以设置用于显示的视口。

## 要求

**头文件：** 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_FEATURE_DATA_D3D12_OPTIONS13](/zh-CN/reference/graphics/d3d12/structs/d3d12_feature_data_d3d12_options13_public.md)
- [D3D12_FEATURE_DATA_D3D12_OPTIONS6](/zh-CN/reference/graphics/d3d12/structs/d3d12_feature_data_d3d12_options6_public.md)
- [D3D12_VIEW_INSTANCE_LOCATION](/zh-CN/reference/graphics/d3d12/structs/d3d12_view_instance_location_public.md)
- [D3D12_VIEW_INSTANCING_DESC](/zh-CN/reference/graphics/d3d12/structs/d3d12_view_instancing_desc_public.md)
- [D3D12_GRAPHICS_STATES](/zh-CN/reference/graphics/d3d12/enums/d3d12_graphics_states_public.md)
