Translator, runtime: supportsTextureSampleCount: answers 8 where the device renders it into a colour, a depth and a stencil attachment

The planner's ruling: raster_sample_counts, which supportsTextureSampleCount:,
getDefaultSamplePositions:count: and programmableSamplePositionsSupported read, is the device's
framebufferColorSampleCounts, framebufferDepthSampleCounts and framebufferStencilSampleCounts,
intersected with 1, 2, 4 and 8. A query answer, not a second form: a device that renders 8 into
all three attachments answers yes for 8, as a Mac's AMD GPU does (an AMD Radeon Pro 5300M under
macOS 26.7.1, job 82204) and Apple10 does, where the Apple9 table answered 1, 2 and 4 alone.
TEXTURE_SAMPLE_COUNTS leaves the apple_gpu table, whose other answers are Apple9's.

Nothing else capped at 4: a texture's samples are its format's own (Limit::TextureSamples), the
pipeline link maps 8, the sample mask takes a word, Vulkan's standard locations hold 8, and
interpolate_at_sample reads index & (n - 1).

Metal at 8, measured on the 5300M (job 82239), and where ours can differ:
- interpolate_at_sample: indices 0 to 9, 15, 16, 100, 2^31 - 1 and 2^32 - 1 read sample
  index mod 8, the runtime's answer; InterpolantAt::Sample's doc says so.
- Alpha to coverage: the 5300M covers a pixel at one sample at an alpha of 1/2 or above, every
  pixel alike, and at two, four and eight samples floor(alpha * n + 1 - t), t 1/8 and 3/8 at even
  and odd x of an even row, 5/8 and 3/8 of an odd one; every pixel floor(alpha * n) or
  ceil(alpha * n). The device's own mapping may differ: PrecisionNote::DeviceAlphaCoverage (and
  docs/API.md's catalogue) now states the 5300M's rule beside the M3 Max's and that eight
  samples are unmeasured on every device.
- Default positions at 8: the 5300M's answer is Vulkan's standard 8 locations.

Docs that said 1, 2 and 4: Device::supports_texture_sample_count and default_sample_positions,
the floor's standardSampleLocations line, RenderPassDescriptor::sample_positions, positions.rs,
the runtime README (default positions, the floor table) and metal_properties' field.

Verified: the stacked gate (m3-max-82337, this change on the (i)+(b) hand-over): fmt, clippy in
three configurations, rustdoc, doctests, the validation suite 1322 passed (3 skipped), the
product suite 3725 passed with the five reds development's next bless takes (none of this
change's), the runtime's lavapipe suite 974 passed (4 skipped); the red commit's tests green on
lavapipe (2 translator, 9 runtime). On an RTX 3090 (m3-max-82314), an RX 7900 XTX and a 780M
(m3-max-82315) and an Iris Xe (m3-max-82316), the same patch on 8a2acc84fb: the runtime's 9
sample-count and sample-position tests pass, each device answers yes for 8 with Vulkan's
standard 8 default positions and answers programmableSamplePositionsSupported yes.
This commit is contained in:
Anees Iqbal committed 2026-12-02 23:12:42 -08:00
1 parent fda1e3602e
commit efe893738c
10 files changed
+53 -32

No files matched your search

+5 -2
View File
@@ -2217,14 +2217,17 @@ bound.
framebuffer coordinates"). Metal, measured over 639 alphas a sample count on an Apple M3 Max under
macOS 27.0.1, covers a pixel at one sample above an alpha of 1/2, and at two and four samples
`ceil(alpha * n - t)` samples, `t` a 2x2 ordered dither of the pixel's window coordinates (1/8,
5/8; 7/8, 3/8), either count within an `f32` ulp of a threshold. Recorded bound, pixel by pixel
5/8; 7/8, 3/8), either count within an `f32` ulp of a threshold. Metal's rule is the GPU's own: an
AMD Radeon Pro 5300M under macOS 26.7.1 covers a pixel at one sample at an alpha of 1/2 or above,
and at two, four and eight samples `floor(alpha * n + 1 - t)` samples (1/8, 3/8; 5/8, 3/8); on
both, every pixel covers `floor(alpha * n)` or `ceil(alpha * n)`. Recorded bound, pixel by pixel
against Metal's reading: on lavapipe (Mesa 26.0.8, arm64) every pixel covers `floor(alpha * n)` or
`ceil(alpha * n)` samples, so within one sample of Metal's and Metal's where `alpha * n` is an
integer; at one sample, where lavapipe dithers too, a whole fragment is stored or dropped where
its alpha lies between its own threshold and 1/2 (2,560 of the sweep's 10,224 pixels); at four
samples a pixel is one sample apart only within an `f32` ulp of a threshold (96 of 10,224). An
NVIDIA RTX 5080 Laptop GPU stores a fragment of alpha 1/2 at one sample, where Metal drops it;
every other device and count is unmeasured.
every other device and count is unmeasured, eight samples on every device included.
- `metal2vulkan-degrade-rotated-blend-rounding` (precision). `PrecisionNote::RotatedBlendRounding`:
A fragment function writes an attachment held with its channels rotated (`ARGB8Unorm`) whose blend
is not exact by construction (`LoweringInputs::rotated_blends`): every blend but a minimum, a