Files
metal2vulkan/scripts
Anees Iqbal 08447f8aff ICB: a kernel's patch draws into an indirect command buffer, executed through a layout of patch draws
The owner's 3406 order, the planner's next indirect command kind: MTLIndirectCommandTypeDrawPatches.

Translator (lower/access/icb.rs): a render_command's draw_patches writes VkDrawIndirectCommand (the
patch count, the instances, the patch start and the base instance) where a plain draw's goes, and
in the index token's 16 bytes, which a buffer of patch draws does not read as a token, the
tessellation factors' Metal address and the patch indices' (0 for the null pointer). The records
stay one shape for every kind (pipeline::IndirectDrawLayout::factors and ::patch_indices name the
two places). The control-point count is not read, as a direct patch draw does not read it; the
factors' instance stride and the factor scale are read only under a per-instance step function or
tessellationFactorScaleEnabled, which the runtime refuses at the pipeline state. A
post-tessellation vertex function of a state made for indirect command buffers is compiled under
LoweringInputs::indirect_range (pipeline/compile.rs), so each evaluation tests its command against
the execution range as a plain vertex function does.

Runtime: Device::new_indirect_command_buffer takes DRAW_PATCHES alone, the buffer's kind
CommandDraw::Patches. Its command layout pushes the factors' and patch indices' addresses where
the state's control stage reads them (FieldValue::TessellationFactors, FieldValue::PatchIndices),
holds no index buffer token and ends in TOKEN_DRAW; the layout and each execution name the
tessellation control and evaluation stages beside the vertex and fragment ones
(dgc::PATCH_STAGES). An execution of patch draws draws a patch list with a post-tessellation state
and reads no tessellation factor buffer of the encoder's; a state that is not post-tessellation
is Refusal::PatchDraw, as is a post-tessellation state with a buffer of other draws, and a state
of a control-point index type Refusal::PatchDrawWithIndexType, as for a direct patch draw.

VUID-vkCmdExecuteGeneratedCommandsEXT-supportedIndirectCommandsShaderStages-11060 requires the
bound stages in the device's supportedIndirectCommandsShaderStages, so the floor reads whether
they hold the tessellation stages (IndirectCommandLimits::tessellation_stages) and a buffer of
patch draws is refused without them, a new kind, IndirectCommandsKind::TessellationStages.
Mesa's source answers VK_SHADER_STAGE_ALL_GRAPHICS on RADV and VK_SHADER_STAGE_ALL on lavapipe.

Two draw kinds together, DRAW_INDEXED_PATCHES and the rest stay CommandTypes.

Docs: the runtime README's ICB section and refusal line; the API guide's section 1; METAL-COVERAGE
(coverage.tsv); CONFORMANCE-COVERAGE regenerated; the API signature table blessed for the new
field, methods and variant. REFUSALS.md regenerated with no change.

Tests: the red commit's engine test and runtime device test, with the device test's arm for the
TessellationStages refusal; a unit test of the patch tokens; the floor's limits test reads the
tessellation stages.
2026-12-02 21:06:54 -08:00
..