Runtime: work recorded again keeps its tiled takes; a batch that fails at its submission gives them back

A tiled texture's copy taken at use is taken by the first use encoded after
its mark; a recording that never runs must hand its take on or give it back.
Three paths lost it:

- A rebind that encodes an encoder again re-recorded the encoder's segments
  (a render pass recorded on the GPU alone, its shadowed textures' copies
  in the segment) into cores that asked the mark, which the first
  recording had cleared: the pass read a copy nothing made. The same held
  for work on the GPU alone a rebind records again without encoding its
  encoder again.
- A host step whose recording failed, and a vkQueueSubmit that failed,
  failed the command buffer outside fail_part: the takes of the batch and
  the later ones were never given back, so the next use read stale levels.

How:
- shadow.rs: one way to decide. ShadowSync::again (take nothing unmet,
  note nothing) is gone; every recording in place of others is
  ShadowSync::over a shared Replaced pool: a use that meets a decision of
  the replaced recordings keeps its take, any other asks the mark. The
  cores recorded during one turn share the pool, so each decision is met
  once, in order.
- State::replaced_takes (was step_takes and replaying_takes) holds the
  pool while a host step, a rebind's encoding again (the first encoding's
  takes and its segments' recordings' takes, State::takes_of) or a
  rebind's recording again on the GPU alone records. segment_raw hands it
  to every core. A spliced encoding again or segment gives back the takes
  of the first recordings it did not meet (Takes::give_back_unheld); a
  refused one gives back its own takes the first did not hold. The
  encoder's record keeps the encoding again's takes.
- State::place joins a placed segment's takes into its encoder's record,
  and CommandBufferShared::never_runs_from (State::give_back_from) gives
  back the takes of every part from the failed batch on, called beside
  each of the scheduler's three failed() calls.
- docs/FAST-PATHS.md, known gaps: a predicated loop's run again records
  its work apart as a new recording that asks the mark, so a
  did_modify_data during the loop is taken mid-loop and the next use
  after it takes nothing. Keeping the first run's takes (over) would copy
  in again at every run, so it stays a recorded gap.
- docs/API.md and the shadow.rs and reencode.rs module docs say the
  above.

Verified: see the next report (lavapipe before/after, the 780M, lint).
This commit is contained in:
Anees Iqbal committed 2026-11-11 11:10:10 -08:00
1 parent ce043e791d
commit 4289823b20
9 files changed
+278 -158

No files matched your search

+7 -6
View File
@@ -467,12 +467,13 @@ the device's blit chain or the compute filter (`device-filtered-mipmaps`), or an
texel picks. The copy is taken as that command is encoded and runs in its command buffer's order on
the GPU, so it reads the bytes as they are when the command buffer runs. A rebind that encodes the
encoder again before its command buffer's first submission (`Buffer::rebind_bytes_no_copy`) takes
the copy in the encoding again where the first encoding took it, and a `did_modify_data` made since
is left to the next use encoded. A take whose encoder runs nothing, its command buffer having failed
before it ran (committed as failed, or a submission that fails) or dropped without a commit, is
given back: the next use takes the copy. Work a host step records again after the commit (an
execution of indirect commands the CPU wrote since) takes the copy where the commit's recording
took it. Between takes no write of
the copy in the encoding again where the first encoding took it, its work recorded on the GPU alone
(a render pass that executes indirect commands the GPU writes) among it, and a `did_modify_data`
made since is left to the next use encoded. A take whose encoder runs nothing, its command buffer
having failed before it ran (committed as failed, a submission that fails, a host step that fails
or a `vkQueueSubmit` the driver refuses) or dropped without a commit, is given back: the next use
takes the copy. Work a host step records again after the commit (an execution of indirect commands
the CPU wrote since) takes the copy where the commit's recording took it. Between takes no write of
the bytes reaches a level, and nothing the GPU writes into a level reaches the bytes or the other
levels. `get_bytes` and `replace_region` of the first level read and write the buffer's bytes, as
the Macs' do, and of a later level the image (an accepted difference, section 10). While the