A vertex function that writes [[render_target_array_index]] had two forms:
- in a pass of at most one layer (BindShape::render_target_array_length 0, Metal's default, or 1),
the plan asked for VariantKey::dropped_vertex_layer, a variant compiled without the Layer
output;
- in a longer pass it ran the pipeline that stores Layer as `index < length ? index : 0`, the
length each draw pushes (PushField::RenderTargetArrayLength).
The second form already answers the short pass exactly. At a length of 0 or 1 it stores 0 for
every index, the slice Metal renders, so a one-layer framebuffer is never written an out-of-range
Layer. The dropped variant's one gain was a pipeline that needs no shaderOutputLayer. The floor
requires that feature, and every committed profile has it. The runtime never asked for the
variant: it compiles every render pipeline under VariantKey::new() and pushes the pass's layers,
at least 1.
After this change the one form draws every pass, and its plan states no variant at any length.
The binder pushes the pass's length as at least 1, as the runtime does; at 0 and 1 alike the
function stores 0 for every index.
Drawn one amplification at a time in a pass of one layer, a vertex function still writes no
Layer (LoweringInputs::amplification_draws, not layered). RuntimeFact::RenderTargetArrayLength's
layer_dropped now states that case alone.
Size: 24 files, +360/-381.
Removed:
- VariantKey::dropped_vertex_layer, with its is_empty term and its per-stage lowering bit;
- LoweringInputs::dropped_vertex_layer and the function key's "dropped-vertex-layer" bytes. A
function compiled without the input keeps its key;
- the binder's choice of the variant, and its term in the check that answers
BindError::NeedsVariant;
- the cache's round trip of the variant, and the variant's cases in the function key test.
Rule 1: no precision note changes.
The evidence gate (validation's candidate/platform/device.rs, fails_row) fails a row on every
ERROR the validation layer reports and on every WARNING of the validation type. Without the
variant the layer warns on each such draw into the render executor's one-layer framebuffer:
WARNING (validation) Undefined-Value-Layer-Written (0x1fc55805): "vkCmdDraw(): Shader stage
VK_SHADER_STAGE_VERTEX_BIT writes to Layer (gl_Layer) but the framebuffer was created with
VkFramebufferCreateInfo::layer of 1, this write will have an undefined value set to it."
It warns of the write whatever its value: VK_LAYER_KHRONOS_validation 1.4.363 reports it for a
minimal draw that writes Layer = 0 (job m3-max-61934). The spec leaves the framebuffer undefined
only where "the Layer value is less than 0 or greater than or equal to the number of layers in
the framebuffer" (Layered Rendering, vkspec 1.4.366). This pipeline pushes the length 1 there and
stores 0. As the planner ruled, the gate now withholds that message, under five conditions:
- Exact: a WARNING of the validation type with that id name, number and whole text
(CLAMPED_LAYER), for a row whose pipeline states RenderTargetArrayLength without layer_dropped,
drawn in a pass of at most one layer. The render executor sets this per row on the sink
(MessageSink::clamped_layer), so it is keyed on structure, never on a case.
- Counted: the row's environment records withheld_validation_messages
{"Undefined-Value-Layer-Written": n}, and corpus-vulkan prints it.
- Proved by our own tests: candidate::tests::engine_render's
an_index_past_a_one_layer_pass_renders_the_pass_s_slice draws rt6_layered_vertex writing index
3 in a pass of length 0 and reads Metal's answer: the slice holds the fragment's word
1 << 8 | 3 (the conformance case layered-render-target-array-length, recorded on an Apple M3
Max). rt's tests::layered::on_device::every_device_renders_metal_s_layers checks the same for
the runtime at lengths 0 and 1.
- One definition: rt's own device tests run under the layer and fail on any message, but they do
not get this one, because rt renders through dynamic rendering:
every_device_renders_metal_s_layers, index 3 in passes of length 0 and 1, passes under the layer
on RADV's RX 550 (m3-max-61553).
CLAMPED_LAYER is the only list.
- It cannot outlive its cause: the same device test asserts that the row withheld exactly one
such message. When the layer stops reporting it, the test fails, and the exception goes with
it. The sink's unit test the_clamped_layer_warning_fails_no_row_of_a_clamped_store_alone checks
the match: the message for another row, another number, an error, or another draw's text still
fails the row.
The executor version stays: a row the gate passed before draws and records as it did. The layer
bug's minimal repro and the issue text are staged for the owner to file.
Validation: two authored cases write [[render_target_array_index]] from a vertex function. Both
are vertex-stage cases into one 1x1 target, so both ran the dropped variant:
- 013406ac01b7 (public, vertex_amplification_id_layer) now runs the form that stores Layer;
- 434e73e03189's index is not shown the same across a primitive, so the commit below already
refuses it on every leg.
Qualified on lavapipe at this tree's content (m3-max-61968, at dvl-5 1fa4aed963, which differs only
by a test's needless borrow): 013406ac01b7 matches Metal with robustness on and off (candidate
output e9eec98c138165bb), and each record states the gate's exception ran:
withheld_validation_messages {"Undefined-Value-Layer-Written": 1}.
The candidate engine's graphics tests now expect an empty variant for every case. The case that
chooses its slice in a one-layer pass declares Layer, with layer_dropped false.
Tests:
- engine_render_target_slice: every_pass_runs_the_vertex_function_that_writes_its_layer replaces
the variant tests. On the 780M and lavapipe, each of three pipelines, at the lengths 0, 1 and 4:
- states no variant;
- declares Layer and reads the length, which the draw pushes as 1, 1 and 4;
- draws.
An amplified draw in a one-layer pass still draws one amplification at a time.
the_dropped_variant_needs_no_output_layer goes.
- engine_target_indices loses its compile of the variant on the device without
shaderOutputLayer.
- validation: an_index_past_a_one_layer_pass_renders_the_pass_s_slice (lavapipe, under the
layer) and the_clamped_layer_warning_fails_no_row_of_a_clamped_store_alone, above.
Bless due: nothing new. Every golden compiles without a variant.
SEMANTICS_VERSION 2248 -> 2249 and ARTIFACT_FORMAT_VERSION 584 -> 585 are placeholders that main
renumbers.
SEMANTICS: a slice-choosing vertex function in a pass of at most one layer now compiles to the
module that stores Layer. ARTIFACT: VariantKey and LoweringInputs each lose a field.
RUNTIME_VERSION stays, and runtime-sources.sha256 keeps development's (land-pkt re-pins it). api_signatures drops the two
fields. API.md's layered-rendering bullet states the stored 0 in place of the variant.
Consumer check (consumer_check.sh, consumer development b76d6ac4a9): dropped_vertex_layer,
layer_dropped and NeedsVariant have 0 hits.
Verified (jobs read):
- m3-max-61968: the lavapipe device suite at dvl-5 (dvl-6 without the clippy fix), 1483 of 1483,
qualify 013406ac01b7 Match, the withheld count {Undefined-Value-Layer-Written: 1} under both
robustness settings.
- At the stack's tip over this change (dvl-5 1fa4aed963 and dvl-6 92fe40c38f): 61978 and 61987,
fmt, clippy in every configuration, Rustdoc, each feature alone, the API docs and the Windows
clippy, green; 61891, the suites at dvl-4: 13 failures, each a bless-due golden above or
development's own (the raster state test, the inventory's sample_fill rows); 61968, the lavapipe
device suite of metal2vulkan-validation, 1483 of 1483, and public case qualification Match;
62042, the metal2vulkan-validation suite at dvl-5, 1378 of 1378 passed.
- States-only play of this change's player (p-dv.zst) over 35 distinct streams on ms01 (61971),
gem10 (61980), um790 (61991) and um870 (62110): 456,384 render and 91,972 compute states made,
0 refused, every stream exit 0; 62073 (um790) and 62105 (ms01) repeat those nodes' streams with
the same counts. The msi stream (windrag-780m-b2) is not played: msi had no memory free.
Rebased onto the rebased geomdel over development 4cf936ed4d. The conflicts: the version lines;
runtime-sources.sha256, where development's is kept; and the validation context's device.rs, where
development's robustness record lost its leg and this change adds expect_clamped_layer and
take_withheld beside it. api_signatures.tsv checks against the sources (signatures.py --check) and
docs/REFUSALS.md regenerates unchanged. The jobs above ran at the old base; the rebased tip's are
in the report to main.