Emulated meshes go: a device without VK_EXT_mesh_shader refuses mesh and object functions

The planner's ruling: a mesh render pipeline is native or refused. With VK_EXT_mesh_shader and
meshShader (taskShader for an object function), the stages are task and mesh shaders, as before.
The emulation was a second form for devices without them: the object and mesh functions ran as
compute entries, which wrote each threadgroup's vertices and primitives as records into a
per-draw buffer or the command buffer's records pool, and a synthesized vertex stage drew those
records. The runtime never takes that path. Now a mesh or object function on such a device is
refused at lowering (Unsupported{MeshShading}, needing VK_EXT_mesh_shader and the stage's feature
where the profile lacks them), and so is its pipeline. The command line compiles no mesh pipeline
and answers FALLBACK for a mesh or object function on every device, as before.

Removed:
- lowering: lower/mesh/work.rs (the work buffer layout), lower::mesh::emulates, the emulated
  compute entries and their wrappers, the record stores, Layout/layout/records/emulated_payload,
  the RECORDS/WORK/OBJECT_* slots; MeshPlan's emulated and payload_words. Also dispatch.rs's
  WrapperGroups and the wrapper_groups field, emit's GLCompute arm for meshes,
  stage_io::flat_primitive_inputs, and the requirement trace's record writes. The payload is
  always TaskPayloadWorkgroupEXT (memory::arena::declare_payload). lower::mesh::mesh_stages states
  the native test that folds_object_grids reads. The mesh builtins are a const.
- pipeline: MeshRecords, RecordField, RecordValue; GraphicsState::mesh_records and mesh_corners;
  StageInterface's mesh_records, mesh_corners and emulated_payload (vk_stage loses its COMPUTE
  arm); the synthesized vertex stage (link::mesh keeps the payload check) and link's record
  slots and push-range hull; SyntheticBinding::MeshRecords and MeshWork;
  RuntimeFact::MeshLastFirst; VariantKey::mesh_last_first. Varyings hold mesh outputs to
  maxMeshOutputComponents only. The link contract's compute-entry records check goes, and
  compile/api's mesh_info reads the task and mesh limits only.
- binder: bind/mesh_scan (mesh_scan_module, mesh_object_arguments_module, MeshScanModule; its
  div_ceil and for_range move to mesh_arguments, their one other reader), MeshDispatch,
  MeshGroups, MeshRecordsRegion, DrawCommands::mesh_dispatch, MeshTemplate::records and
  RecordsTemplate, GroupStage::Compute (GroupLimits.total is a plain u32), the emulated mesh
  stage flags, BindState and BindShape's mesh_last_first, WriteSource::MeshRecords and MeshWork,
  and DrawReplayRule::DispatchesFirst. Status: StatusBits::MESH_RECORDS_OVERFLOW,
  StatusReport::mesh_records_overflow, MeshRecordsFault, and the words MeshRecordsCursor and
  MeshFault{Draw,Objects,Groups}. The buffer keeps its 32 bytes, with SeqCstFences at word 7:
  words 3 to 6 are not written, and bit 5 is unreported.
- runtime: the synthesized-stage test no longer reads mesh_records; the SynthesizedStages doc
  loses "mesh records".
- tests: engine_mesh's emulated tests (the compute entries, the records pipeline and its object
  draws, the last-first variant) are replaced by two refusal tests, one per function and one per
  pipeline. The tests that also ran the emulating profiles run the profiles with the extension.
  engine_mesh_barriers loses its interpreter run of the emulated object entries; the
  round-trip, link and module-sweep fixtures and api_surface lose the rows.
- validation: build.rs's runtime inputs lose lower/mesh/work.rs; a companion test's comment.
  The 15 authored mesh and object cases stay untouched. The authored compile census is
  re-blessed on development.

Docs: API.md's mesh section states the refusal and loses the emulation's paragraphs, and two
lists lose "an emulated object or mesh function". Varyings docs lose a stale emulated
post-tessellation mention. docs/REFUSALS.md and api_signatures are regenerated. README and the
command's help name no mesh pipeline and need no change.

SEMANTICS_VERSION 2221 is in this commit (placeholder; main renumbers): what the translator emits
for a mesh or object function on a device without the extension changes (a refusal), and the
mesh draws' plans change. ARTIFACT_FORMAT_VERSION 565: the codec loses MeshRecords,
RecordField, RecordValue, StageInterface's three fields, GraphicsState's two, two
SyntheticBinding variants and RuntimeFact::MeshLastFirst. RUNTIME_VERSION stays at this series'
2543. The runtime pin is updated.

Consumer check (consumer-uses.sh, consumer development 12b87d3d6b, 70 refs):
MeshDispatch: 0 hits (code); link-order lists only.
MeshGroups, MeshRecordsRegion, mesh_scan_module, mesh_object_arguments_module, MeshScanModule,
MeshRecordsFault, mesh_dispatch, MESH_RECORDS_OVERFLOW, MeshRecordsCursor, MeshFaultDraw,
MeshFaultObjects, MeshFaultGroups, DispatchesFirst, mesh_last_first, MeshRecords, RecordValue,
mesh_records, mesh_corners, emulated_payload, MeshWork, MeshLastFirst, POOL_WORDS, DRAW_OFFSET,
DISPATCH_OFFSET: 0 hits (code).
mesh_records_overflow: 0 hits on development. It is used on consumer lane branches
(steelbrain/quiesce and others), but only as the name of a local function in
reims-vgpu-vulkan/src/gpu/command.rs, which answers the old runtime's
CommandBufferError::MeshRecordsOverflow. It does not read this field.

Verified: nothing yet (a check job is owed).
This commit is contained in:
Anees Iqbal committed 2026-11-20 15:28:31 -08:00
1 parent 905ae8b57d
commit f7279104ae
52 files changed
+357 -4929

No files matched your search

+9 -20
View File
@@ -594,8 +594,8 @@ through buffer arguments it reads at any index.
threadgroup memory on a profile without it is `Unsupported` with
`Feature::ZeroedThreadgroupMemory`. The translator's own `Workgroup` words have none: an
emulated SIMD group's exchange scratch and vote word, an object function's mesh grid, a mesh
function's primitive count and staged indices, an emulated object or mesh function's payload,
and those of the binder's own scan, shadow-merge and index-rewrite kernels. Each is written
function's primitive count and staged indices, and those of the binder's own shadow-merge and
index-rewrite kernels. Each is written
before any read of it, and an object function's payload "is assumed uninitialized at the entry
of the object function" (the Metal Shading Language Specification, the `payload` attribute). Metal's documents give
threadgroup memory no first contents: `MTLComputeCommandEncoder.h`'s
@@ -874,7 +874,7 @@ Where Metal's rules differ from Vulkan's, the pipeline gives Metal's answer:
function that selects its slice is refused needing either feature (its pass of one layer still
runs), and so is one that selects its viewport on a device with `multiViewport`; one whose index
differs among a primitive's vertices is refused needing `geometryShader`. The stages cannot serve
a post-tessellation vertex function or an emulated mesh function, nor sit beside a vertex function
a post-tessellation vertex function, nor sit beside a vertex function
that writes the builtins itself (a device with the outputs but without
`fragmentShaderBarycentric`): those are refused as not implemented. A fragment function that reads
an index no stage writes, on a device that can declare neither builtin, reads 0, Metal's value
@@ -972,16 +972,16 @@ the feature), and a fragment `[[primitive_id]]` behind it is `NotImplemented(Tes
`Device::compile_mesh_pipeline` compiles a `MeshPipelineDescriptor` (an optional object function,
a mesh function and a fragment function), and `compile_mesh_variant` its variants. Its plan draws
mesh draws only (`DrawCall::MeshThreadgroups`, `MeshThreads` and their indirect forms). With
`VK_EXT_mesh_shader` the stages are task and mesh shaders. Without it (MoltenVK, older ANV) the
pipeline is an exact emulation: the object and mesh functions run as compute stages that write the
mesh's vertices and primitives as records into buffers, and a synthesized vertex stage draws those
records; the plan says which dispatches and draw to record.
mesh draws only (`DrawCall::MeshThreadgroups`, `MeshThreads` and their indirect forms). The
stages are task and mesh shaders, which need `VK_EXT_mesh_shader` with `meshShader` (and
`taskShader` for an object function). A device without them (MoltenVK, older ANV) refuses the
pipeline and each of its object and mesh functions (`Unsupported{MeshShading}`, naming what it
lacks).
A grid Metal draws nothing for (an axis past `bind::METAL_MESH_GRID_AXIS`, or more than
`bind::METAL_MESH_GRID_TOTAL` threadgroups, measured on the M3 Max) draws nothing in every form:
a direct draw's command is zeroed, an object function's wrapper launches nothing for such a grid,
and an indirect draw reads its counts on the GPU. With the extension, an indirect draw's
and an indirect draw reads its counts on the GPU. An indirect draw's
`DrawCommands::mesh_arguments` is a pass to record before the render pass
(`bind::mesh_arguments_module`, one invocation): it writes the draw's counts into the consumer's
scratch (`MeshArguments::scratch_bytes`), which the draw reads in place of Metal's arguments.
@@ -1011,17 +1011,6 @@ through `StatusBits::MESH_GRID_PAST_LIMITS`, or a fold of more pieces than
A direct object grid past the task limits of a device that does not fold is refused naming the
limit.
Without the extension, an indirect draw with an object function first dispatches an object
arguments pass (`MeshDispatch::object_arguments`, `bind::mesh_object_arguments_module`, one
invocation over the scan's bindings): it reads Metal's arguments, reserves the object threadgroups'
slots in the command buffer's records pool, and writes the object function's
`VkDispatchIndirectCommand` into the work buffer. A grid
Metal's GPU discards sets `StatusBits::MESH_GRID_DISCARDED`; one past the device's compute limits
sets `MESH_GRID_PAST_LIMITS`; slots the rest of the pool cannot hold set `MESH_RECORDS_OVERFLOW`.
Each draws nothing. A grid whose threads per grid wrap along an axis runs every threadgroup, and
the object function reports the wrapped grid as Metal's: an unfolded object function's
`threadgroups_per_grid` is the threadgroups its wrapped threads fill.
### Tile pipelines
`Device::compile_tile_pipeline` compiles a `TileRenderPipelineDescriptor` (the tile function and the