Files
metal2vulkan/crates
Anees Iqbal 38d67fc285 runtime: apply the translator's private sample mask to render pipelines
The translator states GraphicsState::sample_mask: the descriptor's private sampleMask and
sampleCoverage as one Vulkan pSampleMask word, wherever Vulkan's mask keeps the samples Metal's
keeps (otherwise the fragment function applies the masks itself, or the translator refuses the
pipeline). The runtime's render pipelines dropped it. make() chained no pSampleMask, and neither
refuse() nor unbuilt() named the field, so a state made with a guest's private mask wrote every
sample: at one sample with bit 0 clear, Metal draws no colour and the runtime drew all of it. The
consumer passes the guest's private sample mask and coverage to the runtime's descriptor. The
deleted runtime applied the field (pipeline/graphics.rs in 5d725aeec7^, the multisample state's
sample_mask), so the cutover dropped it.

Fixed now carries the mask and make() chains it, as ceil(samples / 32) words, Vulkan's length for
pSampleMask; a word past the first keeps every sample. A pipeline needs no new key: the content key
(queried_render_descriptor_key) already destructures PrivateRenderState in full and hashes
sample_mask, sample_coverage and sample_coverage_invert, so two masks are two contents, each with
its own VkPipelines. The new_render_pipeline_state doc said "one sample" and that the runtime
refuses everything else the translator states; it now lists the raster sample count, the private
sample mask and coverage, and the logic operation.

Test: every_device_keeps_only_the_samples_of_a_private_sample_mask (device cfgs). spc_num_samples
fills an R32Uint target that a pass clears to 0. The state without a mask, made first, draws 1 at
one sample. The state with mask 0 on the same device leaves every pixel at 0, which fails without
this change. At 4 samples, mask 0b0101 writes samples 0 and 2 only (4, 0, 4, 0 per pixel, read
back by ido_samples). Compile and lavapipe jobs are named in the landing note.
2026-11-20 16:01:49 -08:00
..