Defines the dimensions of a viewport.
typedef struct D3D11_VIEWPORT {
FLOAT TopLeftX;
FLOAT TopLeftY;
FLOAT Width;
FLOAT Height;
FLOAT MinDepth;
FLOAT MaxDepth;
} D3D11_VIEWPORT;
TopLeftX
X position of the left hand side of the viewport. Ranges between D3D11_VIEWPORT_BOUNDS_MIN and D3D11_VIEWPORT_BOUNDS_MAX.
TopLeftY
Y position of the top of the viewport. Ranges between D3D11_VIEWPORT_BOUNDS_MIN and D3D11_VIEWPORT_BOUNDS_MAX.
Width
Width of the viewport.
Height
Height of the viewport.
MinDepth
Minimum depth of the viewport. Ranges between 0 and 1.
MaxDepth
Maximum depth of the viewport. Ranges between 0 and 1.
In all cases, Width and Height must be >= 0 and TopLeftX + Width and TopLeftY + Height must be <= D3D11_VIEWPORT_BOUNDS_MAX.
Viewport Sizes and Feature Level Support Differences between Direct3D 11 and Direct3D 10: The range for the minimum and maximum viewport size is dependent on the feature level defined by D3D_FEATURE_LEVEL.
|
Note
Even though you specify float values to the members of the D3D11_VIEWPORT structure for the pViewports array in a call to ID3D11DeviceContext::RSSetViewports for feature levels 9_x, RSSetViewports uses DWORDs internally. Because of this behavior, when you use a negative top left corner for the viewport, the call to RSSetViewports for feature levels 9_x fails. This failure occurs because RSSetViewports for 9_x casts the floating point values into unsigned integers without validation, which results in integer overflow.
For operator overload functions, see D3D11_VIEWPORT Helper Functions.
Header: Declared in d3d11_x.h (d3d11.h on other Windows platforms).