set_viewport and set_viewports refused, as Gap::Draw of DrawKind::Viewport, every viewport that
VkViewport's valid usage forbids: an extent past maxViewportDimensions, a corner past
viewportBoundsRange (VUID-VkViewport-width-01771, -height-01773, -x-01774, -x-01232, -y-01775,
-y-01776, -y-01777, -y-01233), a negative width, and depths past [0, 1] (the runtime enables no
VK_EXT_depth_range_unrestricted). Metal documents no such limit. A user met the refusal four times
in one session, and a WebGL 1 page reaches it with a far gl.viewport: 32768 is the bounds range on
the 780M and Iris profiles, 65536 on NVIDIA's.
No other Vulkan viewport maps clip space as one of these does, since a viewport's transform is
fixed by its own origin and extent. But where such a viewport covers no pixel of Metal's render
area, Metal draws nothing through it, as the rt draws nothing through a viewport of no extent. So
checked() now keeps a viewport Vulkan takes as it is, makes one it does not take that covers no
pixel (viewport_pixels) a viewport of no width or height at the area's origin with its depths cut
to [0, 1], which Vulkan takes and whose draws record an empty scissor, and refuses the rest. With
the bounds Vulkan requires (at least twice the largest extent past either side of the origin) and
an area no larger than maxViewportDimensions, a viewport past the bounds within that extent covers
a pixel only where its edge lies inside the last pixel of an area of the largest size; WebGL's
integer origins never do. What stays refused: a negative width over the area (Metal mirrors it), a
depth range past [0, 1] over it, an extent past maxViewportDimensions over it, and that last-pixel
edge. DrawKind::Viewport, set_viewport and the runtime README (Render encoders, and its known gaps)
say so. docs/REFUSALS.md regenerates unchanged: the Gap::Draw row and its checked() site stay.
The refusal test's mirrored viewport now lies over the target (origin x 4, width -4); at origin 0
it covered no pixel and now draws nothing, as Metal's. The new test also sets a mirrored viewport
and one with depths past [0, 1], both off the target.
Verified:
- Red: the test commit 17aa4279b3 on lavapipe (job m3-max-78333): 0 passed, 1 failed, at
draw.rs:501, the set_viewport of the first far viewport.
- Green, this commit's tree (fd7df2eccb), run as a scratch commit of the same tree: lavapipe (job
m3-max-78345) 3 passed, 868 skipped: the new test, the triangle test and the refusal test, under
the validation layer, "10 viewports past bounds [-32768, 32768] and dimensions [16384, 16384]
drew nothing". The same three tests from one msi-built gpucfg archive under the carried
validation layer 1.4.363.0, each 3 passed, 870 skipped: Radeon 780M, RADV, Mesa 26.2.6 (job
m3-max-78347, bounds [-32768, 32767], dimensions 16384); Iris Xe, ANV, Mesa 26.2.6 (job
m3-max-78348, the same limits); RTX 3090, NVIDIA 620.70.06 (job m3-max-78349, bounds
[-65536, 65536], dimensions 32768); RX 7900 XTX, RADV, Mesa 26.2.6 (job m3-max-78350, bounds
[-32768, 32767], dimensions 16384).
- Job m3-max-78346: clippy -D warnings on metal2vulkan-runtime, all targets and features, plain,
--cfg m2v_gpu and --cfg m2v_cpu_icd, each exit 0; the runtime's whole suite on lavapipe, 868
passed, 3 skipped. Job m3-max-78371: the runtime's rustdoc with warnings denied, public and with
private items, 0 diagnostics. scripts/api-signatures/signatures.py --check and
refusal_surface.py --check pass. cargo fmt --all.