Colour groups go: no render variant draws a group of a pipeline's color attachments

A device draws to at most the lesser of its maxColorAttachments and maxFragmentOutputAttachments
color attachments at once. A pipeline with more (or one at an index at or past that count) was
compiled as color groups: a variant per group (VariantKey::color_group) whose fragment function
wrote the group's colors at locations 0.., with the group's attachments alone in its graphics
state, and the runtime drew each group in a pass of its own. The runtime's floor requires 8 of both
limits (floor.rs), Metal's count, so no device it runs on takes a group, and it asks for every
render variant with VariantKey::new(); nothing in it reads GraphicsState::color_group. The groups,
their inputs and their note are deleted. Such a pipeline is now refused where it was already
refused without a group: InterfaceComponents at MaxColorAttachments (link) or at
MaxFragmentOutputAttachments (the fragment's outputs).

Removed:
- pipeline/compile/color_group.rs (group, descriptor, entry, refusal) and the compile layer's use
  of it: FragmentPass::color_group, InputsFrom::color_group, grouped_entry, and the grouped
  descriptor in compile_render_pipeline_keys and render_pipeline;
- the inputs and keys: ColorGroup (with of, width_on, colors, groups, location),
  VariantKey::color_group, LoweringInputs::color_group and its key bytes, the pipeline key's
  " color_group N" field (variant_fields);
- link: RenderLinkInputs::color_group, LinkInputs::render_variant's group parameter, and link's
  group check (a fragment stage of another group, and the per-group refusals);
- the state: GraphicsState::color_group and StageIo::color_group;
- the invariance: the stage plan's invariant_fragment_outputs and its Invariant decorations of
  FragDepth, SampleMask and FragStencilRefEXT; the module builder now decorates Position and
  ClipDistance alone, the outputs nothing else made invariant;
- PrecisionNote::ColorAttachmentGroups, its conformance Degradation, its comparison allowance and
  its catalogue entry in docs/API.md;
- validation: the census's color_groups and color_limit, which translated a fragment function of
  more colors than the profile draws as one module a group, and with them PendingL3::groups,
  PendingModule and the L3 stage's later modules: an attempt is one module again.
  ENGINE_CENSUS_VERSION 8;
- the runtime's translator_fields row for color_group.

Tests:
- engine_color_groups goes, and engine_primitive_ids' color_groups_share_the_vertex_function_s_id.
- validation's a_fragment_function_of_more_colors_than_the_floor_translates_in_color_groups becomes
  a_fragment_function_of_more_colors_than_the_device_draws_is_refused: on a four-color profile
  cg_five, cg_seven, cg_sparse and cg_counts keep their limit refusal; on lavapipe each translates.
- the builder's invariance test: FragDepth is refused like PointSize.
- api_tests, api_surface and the variant key's debug text lose their rows.
The color_groups and color_groups_fetch fixtures stay (engine_dead_reads, pass_attachment_pairs
and the fixture tables read them).

docs/API.md's paragraph on groups now states the two limit refusals; docs/VALIDATION.md's census
row loses its sentence. api_signatures is blessed; docs/REFUSALS.md is regenerated.

SEMANTICS_VERSION 2228, ARTIFACT_FORMAT_VERSION 573 (placeholders; main renumbers). SEMANTICS: a
pipeline that took groups is refused, and the note goes. ARTIFACT: the codec loses ColorGroup,
StageIo's and GraphicsState's fields and a PrecisionNote variant. RUNTIME_VERSION stays: the
binder never read a group, and the runtime pin does not move.

Consumer check (consumer-uses.sh, consumer development 0140a12682, 60 refs): 0 hits (code) for
ColorGroup, color_group, width_on, render_variant and color_groups. ColorAttachmentGroups: 0 on
development; used in crates/reims-vgpu-vulkan/src/answer.rs on 37 of the consumer's steelbrain/*
branches, a crate its development no longer has.

Verified: m3-max-61080 (msi) at the tree before the import fix: nextest of metal2vulkan,
-conformance, -validation and -runtime, 5878 of 5879 passed; the one failure is
the_old_render_descriptor_key_keeps_its_value, which moves with SEMANTICS_VERSION (main pins it at
a named pin). Its clippy step found validation's InternalError import unused; m3-max-61112 (um790)
at this commit's tree: fmt, clippy and Rustdoc green. States-only plays on lavapipe of the probe
player built at the change (steelbrain/cutxlate-cgplay, m3-max-61082): m3-max-61087 to 61091, 61
runs over the 36 streams, render 502920 states made and 0 refused, compute 108189 made and 0
refused, the counts of the plays before the change.
This commit is contained in:
Anees Iqbal committed 2026-11-20 18:21:24 -08:00
1 parent 3b1f2a3744
commit dc21cd66c7
35 files changed
+99 -1441

No files matched your search

+4 -31
View File
@@ -906,27 +906,10 @@ Where Metal's rules differ from Vulkan's, the pipeline gives Metal's answer:
the list, at the list's address (`PushHole::CaptureIndexAddress`), adding them as Metal's vertex
ID wraps, so each position runs once and the positions count Metal's primitives.
- A device draws to at most the lesser of its `maxColorAttachments` and
`maxFragmentOutputAttachments` color attachments at once (four at Vulkan's floor), where Metal
takes eight. A pipeline whose attachments with a pixel format number more draws them in groups
of that many, in the order of their indices: variant `VariantKey::color_group` of the pipeline
draws one group, its fragment function writing that group's attachments alone at locations `0..`
and its `graphics` holding them alone (`graphics.color_group`, a `ColorGroup`;
`ColorGroup::of(present, width, group)` names a group, and `ColorGroup::width_on(profile)` is a
device's group width). A pipeline whose
attachments number no more but reach an index at or past the count (`color(0)` and `color(5)` on
a device of four) takes one group, renumbered. Every group's variant has the same vertex module;
where there is more than one group, their fragment stages' `FragDepth`, `SampleMask` and
`FragStencilRefEXT` are decorated `Invariant` and record
`PrecisionNote::ColorAttachmentGroups`. What each group's draw would run again or read from
another group is the pipeline's limit refusal (`InterfaceComponents` at `MaxColorAttachments`):
a vertex or fragment function that writes memory, alpha to coverage, a tessellation pipeline, a
`[[color(n)]]` input of another group that the specialized function reads (one whose read its
function constants fold away reads nothing and is not refused), imageblocks, and a raster order
group on a color output or on a parameter the specialized function uses (one on a parameter it
never uses orders nothing and is not refused). Mesh and tile pipelines take no groups. The
runtime draws such a pass group by group, each group's colors in a pass of its own over a twin
of the depth and stencil (the runtime's `render/color_groups.rs`; what it refuses there is
`RuntimeGap::ColorAttachmentGroups`).
`maxFragmentOutputAttachments` color attachments at once (eight at the runtime's floor), where
Metal takes eight. A pipeline with an attachment at an index at or past the first is refused
`InterfaceComponents` at `MaxColorAttachments`, and a fragment function with a color output at
a location at or past the second at `MaxFragmentOutputAttachments`.
- A pipeline's band variant (`VariantKey::line_band`, of a `BandPrimitive`) draws each line, or
each edge of a triangle in fill mode `Lines`, as the parallelogram Metal draws for a line under
Apple's `setLineWidth:` at a width the device's own lines do not draw (the runtime chooses
@@ -2662,16 +2645,6 @@ bound.
where a texture its handles can name is one (`SpecKey::HeapRawTextures`, which the binding plan
gives from the textures the command makes resident or binds), so a reading of the module alone
holds it, and so does a command that can name one.
- `metal2vulkan-degrade-color-attachment-groups` (precision).
`PrecisionNote::ColorAttachmentGroups`: A render pipeline whose color attachments the device
draws in more than one group (more than the lesser of its `maxColorAttachments` and
`maxFragmentOutputAttachments`, four on a device at Vulkan's floor): each draw runs once per
group, each group's variant writing its own attachments over its own copy of the depth and
stencil the pass loads. Every variant's vertex stage is the same module, `Position` invariant,
and every fragment variant's `FragDepth`, `SampleMask` and `FragStencilRefEXT` are decorated
`Invariant`; Vulkan promises no more across pipelines of other fragment modules and attachments.
Groups past the first may differ at discard or depth edges if the driver compiles the variants
differently.
- `metal2vulkan-degrade-device-fragment-runs` (precision). `PrecisionNote::DeviceFragmentRuns`: A
fragment function that writes memory (`StageInterface::writes_memory`) in a render pipeline of
more than one sample, which the pipeline's compile records on its fragment stage, decided by the