886 B
886 B
D3D12Common::CreateViewport
inline D3D12_VIEWPORT CreateViewport(
float width,
float height,
float topLeftX = 0.0f,
float topLeftY = 0.0f,
float minDepth = 0.0f,
float maxDepth = 1.0f
)
创建 D3D12 视口结构。
参数:
width- 视口宽度(像素)height- 视口高度(像素)topLeftX- 视口左上角 X 坐标,默认为 0topLeftY- 视口左上角 Y 坐标,默认为 0minDepth- 最小深度值,默认为 0maxDepth- 最大深度值,默认为 1
返回: 配置好的 D3D12_VIEWPORT 结构
线程安全: ✅(纯函数)
示例:
D3D12_VIEWPORT viewport = CreateViewport(1280.0f, 720.0f, 0.0f, 0.0f, 0.0f, 1.0f);
cmdList->RSSetViewports(1, &viewport);