Push placement: a post-tessellation vertex function's window starts past the control stage's range

A tessellation render pipeline whose vertex and fragment functions' push fields filled the
floor's 256 bytes was refused at link ("unsupported: Tessellation; needs AnyOf: Limit
MaxPushConstantsSize, required 260, available 256"): link places the synthesized control stage's
push range (8 to 24 bytes) at the first free offset beside the two functions' ranges, and since
the tail placement (0cd2ad765d: each stage's push ends with its tail, 24 bytes above its other
fields) the pair's ranges can end within 8 bytes of 256. Metal makes the pipeline, and the device
lacks nothing.

The form, one on every device: a post-tessellation vertex function's window is [24, 248) instead
of [0, 248), so the control stage's range, at most control::PUSH_BYTES (24) in either form, is
placed at 0, and the fields the pair cannot push spill into their parameter blocks, the form a
function's fields past its window already take. The tail and its 24-byte hole are unchanged. A
fragment function behind such a vertex function that pushes nothing starts at 24 too.

- lower/push.rs: window(Vertex, base) starts at base; TESSELLATION_BASE (= control::PUSH_BYTES);
  base(cx), the start of a function's fields (24 for a post-tessellation vertex function, else
  LoweringInputs::push_base); fragment_base(), the vertex function's push end or its window's
  start, used by CompiledFunction::fragment_push_base, compile::vertex_push_end and link's
  check_push_base.
- select and access place and census the fields from push::base.
- SEMANTICS_VERSION 2204 (a post-tessellation vertex function's and its fragment function's
  placements move).
- Tests: push.rs pins the vertex window from either start, and that the control stage's range in
  every form (bound and address, each factor step, scale on and off) fits below 24 and a
  fragment base behind an empty post-tessellation placement is 24. rt's
  every_device_draws_patches_whose_fragment_fills_the_push_range: a patch state behind fragment
  functions of 4, 8, 12 and 16 buffers is made, pushes the factors' address at 0, and draws its
  patches with every buffer's bits; the widest pair's fields end past 248.
- Docs: API.md section 5, the rt README's push range, PushPlacement::push_range,
  LoweringInputs::push_base, CompiledFunction::fragment_push_base, the tessellation link docs.

The line band's evaluation stage (16 bytes, WideLines) and the fan-out probe's geometry stage (4
bytes, RasterizationRateMap) are still placed by tessellation::push_offset beside the pair's
ranges and refused where those fill the floor: the same shape, not changed here.
This commit is contained in:
Anees Iqbal committed 2026-11-20 09:30:12 -08:00
1 parent 82e7c39216
commit 23d6572c18
13 files changed
+302 -31

No files matched your search

+4 -1
View File
@@ -132,7 +132,10 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`:
the command reads it. A kernel's window is 256 bytes, as the runtime's floor requires that much
`maxPushConstantsSize`: a dispatch region and 24 buffer addresses below its tail. A render
pipeline's two functions share one 256-byte range: the vertex function's window is `[0, 248)`,
and the fragment function's runs from the vertex function's end to 256. A
and the fragment function's runs from the vertex function's end to 256. A post-tessellation
vertex function's window is `[24, 248)`, and its fragment function's starts at 24 or past: the
pipeline's control stage pushes its fields (8 to 24 bytes) at 0, so the pair's fields, which
spill where they pass their windows, never take its bytes. A
vertex function is lowered without knowing its fragment function, so it leaves the last 8
bytes, where a fragment function whose fields spill always pushes its block's address; that
costs only a vertex function whose own fields pass 248 bytes, which spills where it would have