Runtime README: KosmicKrisp's indirect patch draws of more than one instance as a known gap

The Mac host leg of the runtime's device tests failed two patch tests with indirect true only:
every_device_reads_a_patch_draw_s_base_instance_after_tessellation and
every_device_reads_a_patch_s_position_as_its_primitive_id_under_a_patch_index_buffer (M3 Max
under KosmicKrisp, job m3-max-81082). Both draw 2 patches in 2 instances, and in both the second
instance's second patch is missing.

The cause is in the driver, not in the runtime. The runtime records an indirect patch draw as one
vkCmdDrawIndirect on Metal's argument buffer, the same on every device, with no compute pass in
front of it. KosmicKrisp (Mesa 26.3.1) emulates tessellation in compute. For an indirect draw,
libkk_tess_setup_indirect writes the vertex grid as {count, instances, 1} and the control grid as
{patches * output vertices, instances, 1}. kk_dispatch_compute then runs both through
dispatchThreadgroupsWithIndirectBuffer, so each word counts threadgroups (64 threads for the
vertex grid), where the direct draw passes the same words to dispatchThreads as thread counts.
Neither stage bounds the extra work, so it overwrites the next instance's vertices and control
points. This was read from the driver's source, not instrumented.

A bare Vulkan program (no runtime code) draws 2 patches of 3 control points in 1 and then 2
instances, direct and from the host-written VkDrawIndirectCommand, 8 rounds each. Under
KosmicKrisp the second instance's second patch was wrong in 3 of 8 indirect draws, and right in
all 8 direct draws and in every one-instance draw. Under MoltenVK on the same M3 Max, every draw
was right (job m3-max-81189). The tests' indirect arms pass on RADV on the RX 7900 XTX and the
Radeon 780M (m3-max-80750) and on lavapipe (m3-max-80990).

Docs only: one known-gap bullet under "Known gaps of render encoders". The README is not part of
any crate's Rustdoc, and its tests read only the floor tables.
This commit is contained in:
Anees Iqbal committed 2026-12-02 18:17:42 -08:00
1 parent 6b939ef793
commit d69a0bda18
1 file changed
+13
+13
View File
@@ -5234,6 +5234,19 @@ cache is answered compile-required on both.
`VkBuffer`, so such a draw reads the block's later bytes as indices, and a count past the block's
end is outside Vulkan's valid usage without `robustBufferAccess2`, which the floor does not
require (`VUID-vkCmdDrawIndexedIndirect-robustBufferAccess2-08798`).
- On the Mac host (KosmicKrisp, Mesa 26.3.1, on an Apple M3 Max), an indirect patch draw
(`draw_patches_indirect`, `draw_indexed_patches_indirect`) of more than one instance can draw a
patch of an instance past the first from the wrong control points, so it is missing where it
belongs; which patch varies from one draw to the next. The runtime records the draw as one
`vkCmdDrawIndirect` of Metal's arguments, as on every device. The driver runs tessellation as
compute work, and for an indirect draw dispatches the vertex and control-point grid sizes it
computes in threads as that many threadgroups, so the extra work overwrites the next instance's
vertices and control points (read from the driver's source, not instrumented). A bare Vulkan
program of 2 patches in 2 instances, with no runtime code, lost the second instance's second
patch in 3 of 8 indirect draws and in none of 8 direct ones under KosmicKrisp, and in none under
MoltenVK on the same GPU; its indirect draws of one instance were right (job m3-max-81189). The
runtime's two device tests of it fail there with `indirect` true (m3-max-81082), and pass on RADV
on the RX 7900 XTX and the Radeon 780M (m3-max-80750) and on lavapipe (m3-max-80990).
- Refused by `Gap::Draw`, naming its `DrawKind`: the triangle fill mode `Lines` on a device
without `fillModeNonSolid` (KosmicKrisp on the M3 Max, of the venues dumped, m3-max-48737)
(`FillMode`, `set_triangle_fill_mode`), and no viewport or scissor rectangle, or more than 16