pub struct PassViewport {
pub offset: [f32; 2],
pub extent: Extent2D,
}Expand description
A clip space larger than the target it lands in, and where it lands.
A layer records its draws before anything is known about how much of the
target they will cover. The geometry and every material go into clip space
as they are recorded — docs/architecture.md states that a recording is
tessellated geometry rather than a command list — so by the time the extent
could be narrowed, narrowing it would mean rewriting all of that.
This narrows the target instead and leaves the recording alone. The
viewport keeps the extent the geometry was recorded against, and offset
slides it so that the wanted sub-rectangle lands on the target. Clip space
maps onto the viewport, not onto the target, so the picture is cropped
rather than scaled and every recorded coordinate still means what it meant.
offset is normally negative: a target holding the region starting at
device (x, y) of the recorded space offsets by (-x, -y).
Fields§
§offset: [f32; 2]Where the recorded space’s origin sits, in target pixels.
extent: Extent2DThe extent the geometry was recorded against.