rt: a draw of lines carries DeviceLineRasterization on every device; the raster test holds the diamond-exit rule's cells

What:
- RenderCommandEncoder::LINE_NOTE (PrecisionNote::DeviceLineRasterization)
  is the static note of a draw of lines or a line strip, and of a draw of
  triangles under the Lines fill mode, on every device.
- A render pipeline state no longer carries the note; it carried it only
  under alpha to coverage or alpha to one.
- The note's text (artifact.rs, docs/API.md's catalogue, its items list
  and the accepted difference on a line's tie-break, the runtime's README)
  names its grounds, and keeps what it said of a state with alpha to
  coverage or alpha to one: there the device's default line rule draws,
  not Bresenham's mode. One note, both facts.
- The conformance side announces LINE_NOTE for each line draw and each
  Lines fill mode set. The note is among replay's NATIVE_NOTES, so it
  loosens the notices site alone.
- known-gaps-rt.tsv: the 12 primitive-type-restart-indices rows (NVIDIA,
  RX 550, Iris Xe) cite the note. Their lines run through the boundary
  point (3.5, 1.0).
- api_signatures.tsv gains the const's two rows
  (scripts/api-signatures/signatures.py --check passes).
- Tests:
  - raster.rs's Lines pass draws the triangle (-0.65, -0.675), (3, -0.675),
    (-0.65, 3) through the target's own viewport. Its edges at x 1.4 and
    y 6.7 lie inside the target with a pixel on each side, and strictly
    inside the clip volume and the viewport.
  - The pass holds the diamond-exit rule's cells exactly, column 1 and
    row 6, on every device. A device that draws another cell fails with
    the target drawn. It does not read the corner where the two lines'
    ends meet.
  - draw.rs's alpha-to-coverage test now holds that no state carries the
    note, and that LINE_NOTE is it.

Why the note: a card draws a line pixel that differs from Metal's. The 12
ledgered rows are lines through the boundary point (3.5, 1.0): Metal on an
Apple M3 Max covers the lower pixel there, NVIDIA's driver the upper. The
runtime draws lines with VK_LINE_RASTERIZATION_MODE_BRESENHAM. Its diamond
is open, so no Vulkan control decides that pixel. The Vulkan
specification's section "Bresenham Line Segment Rasterization" also lets an
implementation's fragments "not deviate by more than one unit in either x or
y framebuffer coordinates from a corresponding fragment produced by the
diamond-exit rule", with a fragment count within one. Rule 1: a line's pixels
are the device's answer, so the operation carries a static note.

Why the test changed: the old Lines pass put its bottom edge at y 7.7 through
a viewport of y -0.3 and height 8. The Iris Xe drew none of row 7 there
(m3-max-63429 at ce998742d7, m3-max-63507 at 7c1baad228). With both edges
strictly inside the clip volume and the viewport, the Iris Xe draws the
diamond-exit rule's cells, as the other cards do. The fractional viewport's
cut row is a separate item, not a line rule.

Verified, column 1 and row 6 at the test's geometry:
- Iris Xe: m3-max-63735
- RTX 2080: m3-max-63736
- lavapipe: m3-max-63737
- RX 7900 XTX: m3-max-63707, at the same edges
The exact-cell form's legs are named with its sha.

Not a regression: the Lines pass came with a5fac6fa9b (11-20 22:51), and its
viewport moved at 2a36291a80 (23:32). No Iris run of the old pass passed.
This commit is contained in:
Anees Iqbal committed 2026-11-21 08:02:39 -08:00
1 parent 1fbe4eacdb
commit 0f2067150f
12 files changed
+190 -110

No files matched your search

+23 -14
View File
@@ -1676,9 +1676,7 @@ the translated module, the pixel format, the descriptor or the state, on every d
- `ComputePipelineState::precision_notes` and `RenderPipelineState::precision_notes`: the
translator's notes of the state's modules, with `SwizzledOpaqueBlackBorder` where a function
samples through a constexpr sampler whose address mode reads an opaque-black border, and
`DeviceLineRasterization` where a render pipeline's descriptor enables alpha to coverage or
alpha to one;
samples through a constexpr sampler whose address mode reads an opaque-black border;
- `Texture::precision_note`: `CompressedTexelDecode` where the texture's own pixel format is
block-compressed;
- `SamplerState::precision_note`: `SwizzledOpaqueBlackBorder` where an address mode reads an
@@ -1688,8 +1686,10 @@ the translated module, the pixel format, the descriptor or the state, on every d
resolves;
- `BlitCommandEncoder::GENERATE_MIPMAPS_NOTE` (`DeviceFilteredMipmaps`, of `generate_mipmaps`),
`RenderCommandEncoder::DEPTH_BIAS_NOTE` (`DeviceDepthBias`, of a draw of triangles under a depth
bias) and `RenderCommandEncoder::VISIBILITY_NOTE` (`DeviceOcclusionCount`, of a `Boolean` or
`Counting` visibility result).
bias), `RenderCommandEncoder::LINE_NOTE` (`DeviceLineRasterization`, of a draw of lines or a line
strip, and of a draw of triangles under the `Lines` fill mode) and
`RenderCommandEncoder::VISIBILITY_NOTE` (`DeviceOcclusionCount`, of a `Boolean` or `Counting`
visibility result).
A note is never fatal: the work runs on every device. The runtime prints and sends no note; a
consumer reads them through these items. The translator's own API gives a stage's notes
@@ -2526,14 +2526,22 @@ bound.
NVIDIA driver reads `(0, 0, 0, 1)`, where Metal reads the border colour in the format's channels
through the swizzle. A device with the feature reads Metal's texel.
- `metal2vulkan-degrade-device-line-rasterization` (precision).
`PrecisionNote::DeviceLineRasterization`: A render pipeline state that enables alpha to coverage
or alpha to one, which carries it among its notes (`precision_notes`), decided by its descriptor
alone. Its lines are drawn by the device's default rule, not Bresenham's, which Vulkan takes with
neither (`VUID-VkGraphicsPipelineCreateInfo-lineRasterizationMode-02766`). Metal covers the
pixels whose diamond a line exits; a device whose `strictLines` is set (lavapipe, NVIDIA's
driver) covers the rectangle of the line's width instead, so the pixels at a line's two ends,
and on either side of a pixel boundary the line runs along, may differ from Metal's. Every other
state draws its lines by Bresenham's rule (`bresenhamLines`, the runtime's floor).
`PrecisionNote::DeviceLineRasterization`: A draw of lines (a line or a line strip, or a
triangle's edges under the `Lines` fill mode), on every device, which carries it
(`RenderCommandEncoder::LINE_NOTE`). Metal covers the pixels whose diamond a line exits. Lines
draw by Vulkan's Bresenham mode (`bresenhamLines`, the runtime's floor), which lets an
implementation's fragment lie up to one pixel in x or y from the diamond-exit rule's, and its
fragment count differ by one (the Vulkan specification, "Bresenham Line Segment
Rasterization"), and whose diamond is open, so no Vulkan control decides the pixel of a line that
only touches a diamond's vertex: where a line of the conformance case
`primitive-type-restart-indices` runs through the boundary point (3.5, 1.0), Metal on an Apple M3
Max covers the lower pixel and NVIDIA's driver the upper (the accepted difference "A line's
tie-break is the device's own", section 10). A state that enables alpha to coverage or alpha to one draws its lines by the device's default
rule instead, as Vulkan's Bresenham mode takes neither
(`VUID-VkGraphicsPipelineCreateInfo-lineRasterizationMode-02766`): a device whose `strictLines`
is set (lavapipe, NVIDIA's driver) covers the rectangle of the line's width, so the pixels at a
line's two ends, and on either side of a pixel boundary the line runs along, may differ from
Metal's.
- `metal2vulkan-degrade-device-pack-conversion` (precision). `PrecisionNote::DevicePackConversion`:
Native device maths (a conversion): `air.pack` or `air.unpack` of a normalized format is the
device's: `GLSL.std.450`'s `Pack`/`Unpack` `Unorm4x8`, `Snorm4x8`, `Unorm2x16` and `Snorm2x16`,
@@ -2611,7 +2619,8 @@ named states the rule in full.
no pixel whose centre lies on or past that edge and culls no point at the clip volume (the
conformance case `point-viewport-coverage`).
- **A line's tie-break is the device's own.** Lines draw by Bresenham's rule, which is Metal's
(`bresenhamLines`, the runtime's floor): the pixels whose diamond the line exits. Vulkan's
(`bresenhamLines`, the runtime's floor): the pixels whose diamond the line exits, each within
the one pixel Vulkan allows an implementation (`PrecisionNote::DeviceLineRasterization`). Vulkan's
diamond is open (`|p - x| + |q - y| < 0.5`), so a line that only touches a diamond's vertex
exits neither diamond the vertex joins, and no Vulkan control decides which pixel a conforming
driver covers there. Measured, where a line of the conformance case