Draw every width Apple's setLineWidth: takes, as Metal draws it
RenderCommandEncoder::set_line_width refused every width but 1 (AppleOnly::LineWidth). Measured on the Apple M3 Max under macOS 27.0.1 (probes/line_widths.m): each encoder starts at 1 and the width holds across draws and pipeline states; Metal draws w' = floor(16 w) / 16 clamped to [0, 16] (NaN and negatives as 0, infinity as 16); at w' = 1 its ordinary diamond-exit lines; at every other w' Vulkan's non-strict parallelogram (major axis the larger extent, x on a tie; minor-axis edges through the endpoints, w' long and centred; ends not extended; centres inside, top-left ties; the width not rounded); at 0 exactly the pixel centres on the segment; one parallelogram per strip segment with no joins; triangles in fill mode Lines draw their edges so; at 4 samples every width is the parallelogram at the sample positions. The runtime (render/line_width.rs) keeps the quantized width in the encoder state and routes each draw at w' != 1: - the device's own lines (lineWidth w', no Bresenham mode) where it enables wideLines and w' lies in lineWidthRange above 0: exact where strictLines is unset, nonStrictWideLinesUseParallelogram set, w' > 1 and on lineWidthGranularity; elsewhere announced device-wide-lines under the default DevicePolicy::wide_lines = WideLinePolicy::Device, and the band under WideLinePolicy::Exact (exact_answers() selects it); - the pipeline's band variant otherwise (no wideLines, MoltenVK among them; w' outside the range; w' = 0 at half a width of 2^-subPixelPrecisionBits): cull none, the band's front face, fill mode, a PATCH_LIST of two points, viewport 0's half extent pushed with the half width; strips and loops listed as their segments (ListGap::WideLines), flat inputs under the last provoking vertex read from the list led by the last vertex, which covers the same pixels. Refused: Unsupported(WideLines) needing tessellationShader where neither route draws a line; NotImplemented(RuntimeGap::WideLines) for a triangle's edges or a mesh draw's lines the device's lines do not draw, an amplified band, a rate-mapped pass and an execution's commands. Counted: WorkCounts::device_wide_line_draws, line_band_draws. The lane test runtime_lane::line_widths draws the probe's cases through owned fixtures and compares every pixel with Metal's answers (line_widths_m3_max.txt, the probe's output), checks each wide draw took a route, and that every fragment is front-facing; its site WIDE_LINES holds the new kind in the lane's degrade-notice closure. Docs: FAST-PATHS.md's row for wide_lines and a known-gap bullet (edges and mesh lines on devices without wideLines, near-plane cuts, band fragments' inputs uncompared, width 1 on multisampled targets off MoltenVK); API.md's policy bullet and degrade catalogue; the runtime README's Line widths; RUNTIME-PORTING's row; REFUSALS.md regenerated (reach rows for feature and gap WideLines, apple LineWidth gone). Validation: the line limits the device description gained describe execution and are not compared in a profile's subset check; the generator's CORE_PROPERTIES and roadmap-2022's m2v_layer_presentation state them at the reader's absent values; opened_chains reblessed (one member more, wide_lines, on every device with it); golden_hashes' profile fingerprints reblessed (no output cell moved); api_signatures and api_surface name WideLinePolicy and LineBandState. RUNTIME_VERSION 1712; the runtime-sources pin rewritten. Verified on the M3 Max under MoltenVK 1.4.2 through maclock with the validation layer: runtime_lane::line_widths, 4 tests pass. Default and exact policies each: 102 cases, 100 matched pixel for pixel, 2 refused (the two fill-mode Lines cases at width 4, NotImplemented(WideLines)), 0 announced; 46 draws took the band, 0 the device's lines (MoltenVK has no wideLines). a_band_needs_tessellation (tessellationShader withheld: width 0 refused needing it, width 2 refused, width 1 matches) and the_lane_s_maps_tell_the_widths_apart pass. Negative control: the band widened by 1/16 of a pixel fails both runs at LANE lines 0.5. Also cargo clippy --workspace --all-targets --all-features -D warnings, plain and with --cfg m2v_gpu; nextest of metal2vulkan, -air, -runtime and -devtools (4954 run, the one failure the missing lane site, now declared), of metal2vulkan-validation (the failures the profile rules, chains and pin fixed here, rerun green) and of metal2vulkan-conformance (1007 pass). Not run: lavapipe, RADV, ANV and NVIDIA lanes, which take the device route. (Carried to development from steelbrain/reims-graphics-kext b16d03150c.)
This commit is contained in:
1 parent
fe22294b09
commit
eb41a55e82
40 files changed
+3032
-156
No files matched your search
+20
-2
@@ -100,8 +100,8 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`:
|
||||
with their bounds. On MoltenVK on an Apple GPU, whose sampler and `float` functions are Metal's
|
||||
own, most of them change nothing.
|
||||
- `DevicePolicy::exact_answers()` selects Metal's answer for each of the runtime's choices that
|
||||
offers one (the batch order and render lowering below, the heap texture compression, command
|
||||
buffer completion and textures over host pages) and the AIR's rounding of each `half` operation
|
||||
offers one (the batch order, render lowering and wide lines below, the heap texture
|
||||
compression, command buffer completion and textures over host pages) and the AIR's rounding of each `half` operation
|
||||
on a device without `shaderFloat16` (below), each listed in [FAST-PATHS.md](FAST-PATHS.md)
|
||||
with its bound and the measured cost of its exact form.
|
||||
- **`half` chains held at `float` precision without `shaderFloat16`** (`HalfChainPolicy::AtExits`,
|
||||
@@ -193,6 +193,15 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`:
|
||||
recording. `pipeline_waits = PipelineWaitPolicy::Exact`, which `exact_answers()` selects, makes
|
||||
the predicted pipeline before the creation returns, as Metal compiles there, and waits for
|
||||
every draw's and dispatch's until made.
|
||||
- **A wide line the device's own** (`WideLinePolicy::Device`, the default; the runtime's choice,
|
||||
no pipeline's code differs). A line Apple's `setLineWidth:` widens is drawn by the device's own
|
||||
lines wherever it draws the width (`wideLines`, inside `lineWidthRange`), exact where they are
|
||||
Metal's parallelogram (`strictLines` unset, `nonStrictWideLinesUseParallelogram` set, the width
|
||||
on `lineWidthGranularity` and above 1), announced `device-wide-lines` where not.
|
||||
`wide_lines = WideLinePolicy::Exact`, which `exact_answers()` selects, draws those as the
|
||||
pipeline's band variant instead (section 4), two triangles over Metal's parallelogram, on a
|
||||
device with `tessellationShader`. Every other width other than 1 is the band under either value
|
||||
(the runtime's README, line widths).
|
||||
|
||||
Loops run as written: no execution bound is translated in.
|
||||
|
||||
@@ -2705,6 +2714,15 @@ bound.
|
||||
direct draw, an indirect one, or an indirect command's in an execution. Cost: the points rasterize
|
||||
nothing, the vertex function run for each, where what Metal draws is undefined: most of its draws
|
||||
draw nothing, and some a few of the points or a box.
|
||||
- `metal2vulkan-degrade-device-wide-lines` (precision). `DeviceWideLines`: A draw of lines at a
|
||||
width other than 1 (Apple's `setLineWidth:`), or of a triangle's edges in fill mode `Lines` or of
|
||||
a mesh draw, drawn by the device's own lines where they are not Metal's parallelogram: strict
|
||||
lines (the rectangle the width spans across the segment, square ends), lines Vulkan does not
|
||||
state as parallelograms (`nonStrictWideLinesUseParallelogram` unset, or a width below 1), or a
|
||||
width off the device's `lineWidthGranularity`, which rounds it. Under `WideLinePolicy::Exact` a
|
||||
draw of lines takes the band variant there instead, on a device with `tessellationShader`.
|
||||
Cost: the lines can cover pixels Metal's parallelogram does not, and miss others, at each end
|
||||
and along each edge.
|
||||
- `metal2vulkan-degrade-provoking-vertex-lines` (precision). `ProvokingVertexLines`: A draw of
|
||||
lines, or an emulated mesh draw of lines, under Apple's last provoking vertex
|
||||
(`setProvokingVertexMode:` 1), of a pipeline state that reads it (a flat input, or a slice or
|
||||
|
||||
Reference in new issue
Block a user