Descriptors: a slot flipped ahead waits for the submissions begun when it was queued (#545) #636

Open
github-bot wants to merge 4 commits from github-bot/gh-636 into a-publier AGit
Owner

@⁠MamaLeVrai on GitHub · 2026-11-27 15:37 UTC · original
MamaLeVrai:desc-fix → a-publier · +326 −19 · 3 files · 4 commits · open

Update (1fb4f9f): @⁠ANDREANIADS showed the first version (74b6c8e, which captured a submission number) was only partial: a submission begun after the number was captured can still read the neutral descriptor when the flip is applied. A captured number can't fix that, so the rule is now checked at apply time. Host::when_at_rest takes the submission lock (try_lock) and applies a flip only if every submission begun has finished (STARTED moves only inside submit, under that lock, so nothing can begin while the slot is written). Flip.after is gone. A guaranteed rest point: Host::submit applies held flips before it begins a submission (in the default non-late mode each submission settles the previous one, so it is at rest); on the late/relay path only the 1.5 s sweep rests, so a flip waiting more than 250 ms (FLIP_SETTLE_MS) makes the sweep settle sooner. show_new_later flips use the same rule.

Tests (RX 6950 XT): the original test and ANDREANIADS's a_slot_flip_waits_for_a_reader_submitted_after_it_was_queued share one body. With the rest check removed (Some(f())) both fail with left: [4, 4], right: [1, 1]; with it both pass (0 failures in 30 parallel runs). Full suite: 398 passed, 0 failed, 34 ignored in one run; the failures I saw in other runs were all the known watch::tests::* flake (#450). The ignored descriptors_written_under_readers, new_blocks_under_readers and textures_read_in_another_dimension pass.

Only an in-game run can show: whether the 250 ms forced settle (a GPU drain, about 4 a second at most and only while a slot waits) is acceptable with the relay and present-ahead; that flip_held fires at each submission (it needs a registered title heap, which a test heap is not); and lock contention (the texture pass uses try_lock, so it skips the flip while a submission is preparing, and the next submission's rest point applies it). Not fixed: texture_views_remade (RESHOWN_AFTER) rewrites slots in place with the same "begun when queued" number and has the same hole; it should be treated the same way separately.


Part of #545 (the other part is not fixed here, see below).

What

With flights in the air (VICTORY_RELAY=2, the default), texture_slot_show_ahead queued its flip with after: 0. When the upload-ahead job ran, the slot was rewritten from the neutral texture to the real one at once, while lists already sent still read that slot by index, recorded against the neutral texture. D3D12 lets a table's descriptors change only until the list executes, not while it is in the air, even for DESCRIPTORS_VOLATILE tables.

Now queue_flip_ahead (descriptor/host.rs) takes after as the newest submission begun at the moment the job completes (crate::host::submissions().0). texture_slots_flip already flips only when after <= finished, and that runs on every draw pass and when an upload finishes. With nothing in the air the slot flips at once, as before. With flights in the air it flips once they have landed, a few frames later. The non-ahead flip and show_new_later already used the submission count, so only this path was missing the wait. test_begin_submission / test_finish_submission (host.rs) and a helper in resource.rs are #[cfg(test)] only.

Test

descriptor::host::tests::a_slot_flipped_ahead_changes_under_a_list_in_the_air (from #545, no longer ignored): a compute list reads the slot through a volatile table and is held on the card behind a fence; the flip is queued as texture_slot_show_ahead queues it. It asserts the list reads [1, 1], the slot is not flipped while that submission is unfinished, and it flips after it finished. On an RX 6950 XT (RDNA 2):

  • with after = 0 (the old code): FAILED, left: [4, 4], right: [1, 1] (slot flipped while it was in the air: true);
  • with this change: ok.

cargo test --release -p victory-gpu --lib: 397 passed, 0 failed, 34 ignored (one earlier run had a watch::tests flake, which #450 fixes). The ignored GPU tests descriptors_written_under_readers (VICTORY_BENCH_S=5), new_blocks_under_readers and textures_read_in_another_dimension pass.

Not done

  • show_later's write of the neutral texture is left immediate. Most of the time it replaces a null slot with the neutral one (placeholder to placeholder), and delaying it would leave newer lists reading a black null slot, which is the black-line symptom. When it replaces a different real texture, keeping the old one is the VICTORY_KEEP_SHOWN=2 behaviour that is deliberately off by default, and an incompatible old view would give the shader a mismatched view dimension.
  • The title's own mirrored descriptor writes under lists in the air are untouched: that is the console's "the card reads at run time" assumption, and the runtime cannot redo it without a descriptor ring.
  • Only checkable in game: whether the black lines and the missing near-LOD skin of #545 are gone with VICTORY_RELAY=2; how late textures appear (crate::texlate and the "slots shown after their upload" line report it); and whether a slot can stay grey when no draw pass runs after the flights land. I judged that harmless, since only drawn slots matter.

AI-assisted (Claude Code); no game data.

🤖 Generated with Claude Code

**@⁠MamaLeVrai** on GitHub · 2026-11-27 15:37 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/636) `MamaLeVrai:desc-fix` → `a-publier` · +326 −19 · 3 files · 4 commits · open **Update (`1fb4f9f`):** @⁠ANDREANIADS showed the first version (`74b6c8e`, which captured a submission number) was only partial: a submission begun after the number was captured can still read the neutral descriptor when the flip is applied. A captured number can't fix that, so the rule is now checked **at apply time**. `Host::when_at_rest` takes the submission lock (`try_lock`) and applies a flip only if every submission begun has finished (`STARTED` moves only inside `submit`, under that lock, so nothing can begin while the slot is written). `Flip.after` is gone. A guaranteed rest point: `Host::submit` applies held flips before it begins a submission (in the default non-late mode each submission settles the previous one, so it is at rest); on the late/relay path only the 1.5 s sweep rests, so a flip waiting more than 250 ms (`FLIP_SETTLE_MS`) makes the sweep settle sooner. `show_new_later` flips use the same rule. Tests (RX 6950 XT): the original test and ANDREANIADS's `a_slot_flip_waits_for_a_reader_submitted_after_it_was_queued` share one body. With the rest check removed (`Some(f())`) **both fail** with `left: [4, 4], right: [1, 1]`; with it both pass (0 failures in 30 parallel runs). Full suite: 398 passed, 0 failed, 34 ignored in one run; the failures I saw in other runs were all the known `watch::tests::*` flake (#450). The ignored `descriptors_written_under_readers`, `new_blocks_under_readers` and `textures_read_in_another_dimension` pass. **Only an in-game run can show:** whether the 250 ms forced settle (a GPU drain, about 4 a second at most and only while a slot waits) is acceptable with the relay and present-ahead; that `flip_held` fires at each submission (it needs a registered title heap, which a test heap is not); and lock contention (the texture pass uses `try_lock`, so it skips the flip while a submission is preparing, and the next submission's rest point applies it). **Not fixed:** `texture_views_remade` (`RESHOWN_AFTER`) rewrites slots in place with the same "begun when queued" number and has the same hole; it should be treated the same way separately. --- Part of #545 (the other part is not fixed here, see below). ## What With flights in the air (`VICTORY_RELAY=2`, the default), `texture_slot_show_ahead` queued its flip with `after: 0`. When the upload-ahead job ran, the slot was rewritten from the neutral texture to the real one at once, while lists already sent still read that slot by index, recorded against the neutral texture. D3D12 lets a table's descriptors change only until the list executes, not while it is in the air, even for `DESCRIPTORS_VOLATILE` tables. Now `queue_flip_ahead` (`descriptor/host.rs`) takes `after` as the newest submission begun at the moment the job completes (`crate::host::submissions().0`). `texture_slots_flip` already flips only when `after <= finished`, and that runs on every draw pass and when an upload finishes. With nothing in the air the slot flips at once, as before. With flights in the air it flips once they have landed, a few frames later. The non-ahead `flip` and `show_new_later` already used the submission count, so only this path was missing the wait. `test_begin_submission` / `test_finish_submission` (`host.rs`) and a helper in `resource.rs` are `#[cfg(test)]` only. ## Test `descriptor::host::tests::a_slot_flipped_ahead_changes_under_a_list_in_the_air` (from #545, no longer ignored): a compute list reads the slot through a volatile table and is held on the card behind a fence; the flip is queued as `texture_slot_show_ahead` queues it. It asserts the list reads `[1, 1]`, the slot is not flipped while that submission is unfinished, and it flips after it finished. On an RX 6950 XT (RDNA 2): - with `after = 0` (the old code): FAILED, `left: [4, 4], right: [1, 1] (slot flipped while it was in the air: true)`; - with this change: ok. `cargo test --release -p victory-gpu --lib`: 397 passed, 0 failed, 34 ignored (one earlier run had a `watch::tests` flake, which #450 fixes). The ignored GPU tests `descriptors_written_under_readers` (`VICTORY_BENCH_S=5`), `new_blocks_under_readers` and `textures_read_in_another_dimension` pass. ## Not done - `show_later`'s write of the neutral texture is left immediate. Most of the time it replaces a null slot with the neutral one (placeholder to placeholder), and delaying it would leave newer lists reading a black null slot, which is the black-line symptom. When it replaces a different real texture, keeping the old one is the `VICTORY_KEEP_SHOWN=2` behaviour that is deliberately off by default, and an incompatible old view would give the shader a mismatched view dimension. - The title's own mirrored descriptor writes under lists in the air are untouched: that is the console's "the card reads at run time" assumption, and the runtime cannot redo it without a descriptor ring. - **Only checkable in game:** whether the black lines and the missing near-LOD skin of #545 are gone with `VICTORY_RELAY=2`; how late textures appear (`crate::texlate` and the "slots shown after their upload" line report it); and whether a slot can stay grey when no draw pass runs after the flights land. I judged that harmless, since only drawn slots matter. AI-assisted (Claude Code); no game data. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
descriptor::host::tests::a_slot_flipped_ahead_changes_under_a_list_in_the_air
(ignored: fails until flips wait for lists in the air). A slot shows the
neutral texture (1x1) while its own upload runs ahead; a list reading it is
submitted and held on the card behind a fence; the flip that
texture_slot_show_ahead queues (Flip { after: 0 }) is made by
texture_slots_flip; the list then runs and reads 4x4: the new texture, the
slot rewritten while the list was submitted and not finished. The table is
DESCRIPTORS_VOLATILE, which allows changes only until the list executes.

resource::title_texture_for_test makes a title texture for such tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
texture_slot_show_ahead queued Flip { after: 0 }: the slot was made from its
new texture the moment the upload ahead of the lists had run, while
submissions sent before (up to 256 lists with the relay) were still in the
air and read the slot by index, recorded against the neutral texture. D3D12
allows a table's descriptors to change only until the list executes, not
while it does.

The flip now carries after = the newest submission begun when it is queued
(queue_flip_ahead) and texture_slots_flip makes it only once that has
finished (every pass of the texture queue and the end of an upload look). No
list sent before the flip finds the slot changed; a texture is shown a few
frames later while flights are in the air, at once when none is.

The test a_slot_flipped_ahead_changes_under_a_list_in_the_air is no longer
ignored: it stands a begun submission for its list in the air, queues the
flip as the code does, and checks that the list reads the neutral 1x1 and
that the slot is shown once the submission has finished (it reads 4x4 with
after = 0).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 15:50:49 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-27 15:37 UTC · original · reviewed

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-27 15:37 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/636#pullrequestreview-6090453642) · **reviewed** Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Author
Owner

@⁠ANDREANIADS on GitHub · 2026-11-27 16:20 UTC · original

I reproduced the original test on an RTX 3070 (driver 621.40, Windows, Rust 1.98.1): it passes at 74b6c8e. Extending your fixture with a second submitted reader exposes a remaining in-flight rewrite:

  1. Submission A reads the neutral descriptor and is held behind a fence.
  2. queue_flip_ahead snapshots A's submission number.
  3. Submission B is then submitted with the same descriptor, behind a separate fence.
  4. A completes; B is still pending. texture_slots_flip now accepts A's after value and rewrites the descriptor.
  5. Releasing B produces [4, 4] rather than the neutral [1, 1]; flipped_under_later is true. Device removal was not reported.

The extended test failed identically in three consecutive runs. It uses a separate command list/allocator for B and releases its fence before the final assertion.

Reproduction commit, directly on top of this PR: github.com/ANDREANIADS/VIctory-Belobug-AMD@d3fadcc31d

cargo test --locked -p victory-gpu --lib a_slot_flip_waits_for_a_reader_submitted_after_it_was_queued -- --nocapture --test-threads=1

This is an intentionally failing regression fixture, not a proposed fix. The original fixture and implementation are MamaLeVrai's; my contribution is the later-reader extension and NVIDIA validation. A captured submission number protects earlier readers, but does not itself exclude newer readers of the same slot. I have not tested gameplay or established a complete descriptor-generation solution.

AI-assisted with Codex.

**@⁠ANDREANIADS** on GitHub · 2026-11-27 16:20 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/636#issuecomment-7223144321) I reproduced the original test on an RTX 3070 (driver 621.40, Windows, Rust 1.98.1): it passes at `74b6c8e`. Extending your fixture with a second submitted reader exposes a remaining in-flight rewrite: 1. Submission A reads the neutral descriptor and is held behind a fence. 2. `queue_flip_ahead` snapshots A's submission number. 3. Submission B is then submitted with the same descriptor, behind a separate fence. 4. A completes; B is still pending. `texture_slots_flip` now accepts A's `after` value and rewrites the descriptor. 5. Releasing B produces `[4, 4]` rather than the neutral `[1, 1]`; `flipped_under_later` is true. Device removal was not reported. The extended test failed identically in three consecutive runs. It uses a separate command list/allocator for B and releases its fence before the final assertion. Reproduction commit, directly on top of this PR: https://github.com/ANDREANIADS/VIctory-Belobug-AMD/commit/d3fadcc31da838b14bdcd9f389316d0111571371 ```powershell cargo test --locked -p victory-gpu --lib a_slot_flip_waits_for_a_reader_submitted_after_it_was_queued -- --nocapture --test-threads=1 ``` This is an intentionally failing regression fixture, not a proposed fix. The original fixture and implementation are MamaLeVrai's; my contribution is the later-reader extension and NVIDIA validation. A captured submission number protects earlier readers, but does not itself exclude newer readers of the same slot. I have not tested gameplay or established a complete descriptor-generation solution. AI-assisted with Codex.
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-27 16:29 UTC · original

Thanks @⁠ANDREANIADS, you are right, and I reproduced your test on an RX 6950 XT (RDNA 2): a_slot_flip_waits_for_a_reader_submitted_after_it_was_queued fails at 74b6c8e with left: [4, 4], right: [1, 1] (flipped under it: true). A captured after protects the lists already sent when the flip is queued; a list sent after that, recorded against the neutral descriptor, can still be in the air when the flip is applied. So this PR is a partial fix: the original case is covered, yours is not, and I won't call it done.

I have started on a version that also covers later readers and will run both tests against it (and check that slots can't starve under continuous submissions). I'll push it here only if both pass and I can explain why it is correct. If you already have a direction in mind, I'd be glad to hear it.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-27 16:29 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/636#issuecomment-7223314352) Thanks @⁠ANDREANIADS, you are right, and I reproduced your test on an RX 6950 XT (RDNA 2): `a_slot_flip_waits_for_a_reader_submitted_after_it_was_queued` fails at `74b6c8e` with `left: [4, 4], right: [1, 1]` (`flipped under it: true`). A captured `after` protects the lists already sent when the flip is queued; a list sent after that, recorded against the neutral descriptor, can still be in the air when the flip is applied. So this PR is a partial fix: the original case is covered, yours is not, and I won't call it done. I have started on a version that also covers later readers and will run both tests against it (and check that slots can't starve under continuous submissions). I'll push it here only if both pass and I can explain why it is correct. If you already have a direction in mind, I'd be glad to hear it. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠adrianmjim on GitHub · 2026-11-27 16:29 UTC · original

Since you are reworking it, here are the test results from RDNA 3 and three points from reading 74b6c8e. Points 1 and 2 are cases the next version should also cover; point 3 is about the test.

Tested on an RX 7900 XT (RDNA 3), Windows 11 26300, test profile, at 74b6c8e and at c8e93aa (the test alone, on a-publier 4eb6cfd).

The flip test, run on its own with --exact --test-threads=1

build runs result
c8e93aa, test only, run with --ignored 5 5 failed, each reading [4, 4] instead of [1, 1]
74b6c8e, with the fix 5 5 passed

Other tests at 74b6c8e

  • descriptor:: run serially: 47 passed, 0 failed.
  • The whole victory-gpu lib run in parallel (plain cargo test -p victory-gpu --lib), 3 times:
    • Two runs: 397 passed.
    • One run: 396 passed. The new test failed at descriptor/host.rs:6222, shown once nothing reads the slot, with left Some(0) and right Some(4294967300). That is the counter race in point 3 below.

Not run here: a game pass with the default relay. That is running on this card now. I will add it, though it is for 74b6c8e.

Reading the code (74b6c8e against 4eb6cfd; this part was read, not run)

The fix does what its test checks. A slot flipped through queue_flip_ahead now waits until FINISHED >= after. With after: 0 the test reads [4, 4] and the assert_ne fails too.

Besides @⁠ANDREANIADS's later-reader case, three things for the next version. Both VICTORY_SHOW_AFTER and VICTORY_UPLOAD_AHEAD are off by default, but scripts/play.ps1 turns them on outside -Safe, so this path runs in normal play.

  1. The list that shows the neutral is not always covered. after is read when the ahead copy finishes: Job::then on the upload worker, ahead.rs:319-321 → descriptor/host.rs:530. It is not read when the list that wrote the neutral (show_later, from the texture pass at draw.rs:2648) is begun. STARTED only goes up at host.rs:5808. So if the copy finishes while that list (L0) is still being recorded, or is waiting in the submit line, after = N and L0 later becomes N+1. If an earlier submission is still in flight then, the next texture_slots_flip or flip_now after FINISHED >= N rewrites the slot while L0 runs. That is the #545 case again.

    • flip() doesn't have this: it reads after in list.defer_host, which runs after STARTED.fetch_add (host.rs:5890).
    • Adding queue::queued(), as retire() does (host.rs:590-592), would not cover a list still being recorded.
    • Reading after at the asking list's submission would. For example, pass the list to texture_slot_show_ahead and take the max of that and the job's value.
    • The test numbers its list before it reads after (~6190-6197), so it can't catch this order.
    • @⁠ANDREANIADS's fixture above covers the related case of a list begun after after was read. This one is narrower: it is the list that wrote the neutral and asked for the flip.
  2. Paths that mirror the slot during the wait skip it. While the flip waits, the slot has made = 0 and ahead::there() is already true. Anything that mirrors it then writes the real texture at once:

    • a table read through mirror (draw.rs:3391) or mirror_after (draw.rs:3611, 3662 → descriptor/host.rs:2411-2424);
    • the texture pass's same branch → at_once() (draw.rs:2612-2625);
    • a title rewrite of that descriptor that lands on the same key.

    show_new_later only defers to STARTED when the host texture was made, which is no later than the flip's after. So lists recorded against the neutral can still be in flight. This existed before, but the window was one frame; now it lasts until after lands. One option: while a Flip waits for (heap, index, key), have at_once, mirror_after and mirror defer to it.

  3. The test can fail when tests run in parallel. STARTED and FINISHED are process-wide. test_begin_submission bumps STARTED outside the submitted lock, and every real submission ends with a plain FINISHED.store(this_submission) (host.rs:6108, also 5200, 5663). In a plain cargo test, which CI's test-default job runs without --test-threads=1, another test's host.execute that starts and finishes during this test's GPU wait lets the flip through early, so the assert_ne at 6219 fails. Less likely: it reads [4, 4], or an older store lowers FINISHED before the final assert_eq. A shared lock for tests that submit, or fetch_max on the sync path, would close it. Small: Finish(sent) could be made right after test_begin_submission, before the unwrap()s.

Nit: in resource.rs:2924 the new title_texture_for_test went in between /// Device method 0x3f8, inferred from the title's calls and the rest of create_committed3's doc, so that first line now documents the helper.

**@⁠adrianmjim** on GitHub · 2026-11-27 16:29 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/636#issuecomment-7223323716) Since you are reworking it, here are the test results from RDNA 3 and three points from reading 74b6c8e. Points 1 and 2 are cases the next version should also cover; point 3 is about the test. Tested on an RX 7900 XT (RDNA 3), Windows 11 26300, test profile, at 74b6c8e and at c8e93aa (the test alone, on `a-publier` `4eb6cfd`). **The flip test, run on its own with `--exact --test-threads=1`** | build | runs | result | |---|---|---| | c8e93aa, test only, run with `--ignored` | 5 | 5 failed, each reading `[4, 4]` instead of `[1, 1]` | | 74b6c8e, with the fix | 5 | 5 passed | **Other tests at 74b6c8e** - `descriptor::` run serially: 47 passed, 0 failed. - The whole `victory-gpu` lib run in parallel (plain `cargo test -p victory-gpu --lib`), 3 times: - Two runs: 397 passed. - One run: 396 passed. The new test failed at `descriptor/host.rs:6222`, `shown once nothing reads the slot`, with left `Some(0)` and right `Some(4294967300)`. That is the counter race in point 3 below. **Not run here:** a game pass with the default relay. That is running on this card now. I will add it, though it is for 74b6c8e. **Reading the code** (74b6c8e against `4eb6cfd`; this part was read, not run) The fix does what its test checks. A slot flipped through `queue_flip_ahead` now waits until `FINISHED >= after`. With `after: 0` the test reads `[4, 4]` and the `assert_ne` fails too. Besides @⁠ANDREANIADS's later-reader case, three things for the next version. Both `VICTORY_SHOW_AFTER` and `VICTORY_UPLOAD_AHEAD` are off by default, but `scripts/play.ps1` turns them on outside `-Safe`, so this path runs in normal play. 1. **The list that shows the neutral is not always covered.** `after` is read when the ahead copy finishes: `Job::then` on the upload worker, `ahead.rs:319-321` → `descriptor/host.rs:530`. It is not read when the list that wrote the neutral (`show_later`, from the texture pass at `draw.rs:2648`) is begun. `STARTED` only goes up at `host.rs:5808`. So if the copy finishes while that list (L0) is still being recorded, or is waiting in the submit line, `after = N` and L0 later becomes N+1. If an earlier submission is still in flight then, the next `texture_slots_flip` or `flip_now` after `FINISHED >= N` rewrites the slot while L0 runs. That is the #545 case again. - `flip()` doesn't have this: it reads `after` in `list.defer_host`, which runs after `STARTED.fetch_add` (`host.rs:5890`). - Adding `queue::queued()`, as `retire()` does (`host.rs:590-592`), would not cover a list still being recorded. - Reading `after` at the asking list's submission would. For example, pass the list to `texture_slot_show_ahead` and take the max of that and the job's value. - The test numbers its list before it reads `after` (`~6190-6197`), so it can't catch this order. - @⁠ANDREANIADS's fixture above covers the related case of a list *begun* after `after` was read. This one is narrower: it is the list that wrote the neutral and asked for the flip. 2. **Paths that mirror the slot during the wait skip it.** While the flip waits, the slot has `made = 0` and `ahead::there()` is already true. Anything that mirrors it then writes the real texture at once: - a table read through `mirror` (`draw.rs:3391`) or `mirror_after` (`draw.rs:3611`, `3662` → `descriptor/host.rs:2411-2424`); - the texture pass's `same` branch → `at_once()` (`draw.rs:2612-2625`); - a title rewrite of that descriptor that lands on the same key. `show_new_later` only defers to `STARTED` when the host texture was made, which is no later than the flip's `after`. So lists recorded against the neutral can still be in flight. This existed before, but the window was one frame; now it lasts until `after` lands. One option: while a `Flip` waits for (heap, index, key), have `at_once`, `mirror_after` and `mirror` defer to it. 3. **The test can fail when tests run in parallel.** `STARTED` and `FINISHED` are process-wide. `test_begin_submission` bumps `STARTED` outside the `submitted` lock, and every real submission ends with a plain `FINISHED.store(this_submission)` (`host.rs:6108`, also `5200`, `5663`). In a plain `cargo test`, which CI's test-default job runs without `--test-threads=1`, another test's `host.execute` that starts and finishes during this test's GPU wait lets the flip through early, so the `assert_ne` at `6219` fails. Less likely: it reads `[4, 4]`, or an older store lowers `FINISHED` before the final `assert_eq`. A shared lock for tests that submit, or `fetch_max` on the sync path, would close it. Small: `Finish(sent)` could be made right after `test_begin_submission`, before the `unwrap()`s. Nit: in `resource.rs:2924` the new `title_texture_for_test` went in between `/// Device method 0x3f8, inferred from the title's calls` and the rest of `create_committed3`'s doc, so that first line now documents the helper.
Extend MamaLeVrai's PR #636 regression with a second fenced submission.
This intentionally failing fixture isolates the remaining snapshot gap.
queue_flip_ahead took the newest submission begun when it was queued and
waited for that one. A submission begun after that and before the flip is
made reads the slot by index too, recorded against the neutral texture, and
was still found changed under it (the test of ANDREANIADS: it reads 4x4
instead of 1x1 when the first reader has finished and the second has not).

The flip is now made at a moment with no submission in the air and none
able to begin: crate::host::when_at_rest takes the submission lock without
waiting and checks that every submission begun has finished. The texture
pass and the end of an upload look use it. Each submission also makes the
flips at its own rest point, after the sweep and before it counts as begun
(it settles the ones before it, or finds none in the air), so the slots are
not left grey under continuous submissions. With the present sent ahead,
where only the sweep every 1.5 s makes such a moment, a slot that has
waited 250 ms makes one sooner.

The original test is back under its name next to the second one; both run
one body, the second with the later reader, and check that the slot is
shown once nothing is in the air.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-27 17:00 UTC · original

Pushed 1fb4f9f, which covers @⁠ANDREANIADS's later reader. The first version captured a submission number; any number leaves a later reader exposed, so the rule is now checked when the flip is applied: only with every submission begun already finished, under the submission lock, so nothing can begin during the write. The details and the open points are at the top of the description.

On an RX 6950 XT, both the original test and the later-reader test fail with [4, 4] when the rest check is removed and pass with it (0 failures in 30 parallel runs). The part I cannot show without a game run is the cost of the 250 ms forced settle on the relay path. @⁠rpmaster2, @⁠adrianmjim, @⁠ANDREANIADS: an in-game run of this head against your base is what would settle it.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-27 17:00 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/636#issuecomment-7223915916) Pushed `1fb4f9f`, which covers @⁠ANDREANIADS's later reader. The first version captured a submission number; any number leaves a later reader exposed, so the rule is now checked when the flip is applied: only with every submission begun already finished, under the submission lock, so nothing can begin during the write. The details and the open points are at the top of the description. On an RX 6950 XT, both the original test and the later-reader test fail with `[4, 4]` when the rest check is removed and pass with it (0 failures in 30 parallel runs). The part I cannot show without a game run is the cost of the 250 ms forced settle on the relay path. @⁠rpmaster2, @⁠adrianmjim, @⁠ANDREANIADS: an in-game run of this head against your base is what would settle it. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠ANDREANIADS on GitHub · 2026-11-27 17:08 UTC · original

Retested 1fb4f9f on Windows with an NVIDIA GeForce RTX 3070 (driver 621.40, Rust 1.98.1). Both fence-based regressions passed on the unchanged checkout. I then added a local test-only assertion that requires a D3D12 device and heap and checks the actual adapter via its DXGI LUID, so a skipped test or fallback adapter cannot look like a pass. With that guard, both tests passed in 11 serial runs (22/22). The complete victory-gpu lib suite also passed three times with default parallelism: 398 passed, 0 failed, 34 ignored each time. I did not reproduce the earlier parallel failure on this head.

This independently verifies the original and later-reader cases on NVIDIA. I did not run the title; the relay/present-ahead frame-time cost of the 250 ms forced settle is still unmeasured here. This result does not cover texture_views_remade/RESHOWN_AFTER.

AI-assisted with Codex.

**@⁠ANDREANIADS** on GitHub · 2026-11-27 17:08 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/636#issuecomment-7224072196) Retested `1fb4f9f` on Windows with an NVIDIA GeForce RTX 3070 (driver 621.40, Rust 1.98.1). Both fence-based regressions passed on the unchanged checkout. I then added a local test-only assertion that requires a D3D12 device and heap and checks the actual adapter via its DXGI LUID, so a skipped test or fallback adapter cannot look like a pass. With that guard, both tests passed in 11 serial runs (22/22). The complete `victory-gpu` lib suite also passed three times with default parallelism: 398 passed, 0 failed, 34 ignored each time. I did not reproduce the earlier parallel failure on this head. This independently verifies the original and later-reader cases on NVIDIA. I did not run the title; the relay/present-ahead frame-time cost of the 250 ms forced settle is still unmeasured here. This result does not cover `texture_views_remade`/`RESHOWN_AFTER`. AI-assisted with Codex.
Author
Owner

@⁠ANDREANIADS on GitHub · 2026-11-27 17:18 UTC · original

I followed up on the deferred texture_views_remade path called out in the updated description. Candidate on top of 1fb4f9f: github.com/ANDREANIADS/VIctory-Belobug-AMD@2614eb7c99

The post-upload remake stays queued until the GPU is idle under the existing submission lock; lock contention leaves it pending. On the relay/present-ahead path it shares the existing overdue-flip settle, rather than introducing a second wait mechanism. The direct levels_changed path is unchanged.

Windows / RTX 3070 (621.40), Rust 1.98.1: 40 descriptor-host tests passed serially; full victory-gpu library suite: 399 passed, 0 failed, 34 ignored; Clippy passed with warnings denied. The new test covers pending-queue retention and drain at rest. I have no gameplay or frame-time measurement for this candidate, so I left it on a separate branch instead of opening a stacked upstream PR.

AI-assisted with Codex.

**@⁠ANDREANIADS** on GitHub · 2026-11-27 17:18 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/636#issuecomment-7224267793) I followed up on the deferred `texture_views_remade` path called out in the updated description. Candidate on top of `1fb4f9f`: https://github.com/ANDREANIADS/VIctory-Belobug-AMD/commit/2614eb7c995d0e54648fd9a9ec953e6435e3a19e The post-upload remake stays queued until the GPU is idle under the existing submission lock; lock contention leaves it pending. On the relay/present-ahead path it shares the existing overdue-flip settle, rather than introducing a second wait mechanism. The direct `levels_changed` path is unchanged. Windows / RTX 3070 (621.40), Rust 1.98.1: 40 descriptor-host tests passed serially; full `victory-gpu` library suite: 399 passed, 0 failed, 34 ignored; Clippy passed with warnings denied. The new test covers pending-queue retention and drain at rest. I have no gameplay or frame-time measurement for this candidate, so I left it on a separate branch instead of opening a stacked upstream PR. AI-assisted with Codex.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/636/head:github-bot/gh-636'
git switch 'github-bot/gh-636'

Merge

Merge the changes and update on Forgejo.
git switch 'a-publier'
git merge --no-ff 'github-bot/gh-636'
git switch 'github-bot/gh-636'
git rebase 'a-publier'
git switch 'a-publier'
git merge --ff-only 'github-bot/gh-636'
git switch 'github-bot/gh-636'
git rebase 'a-publier'
git switch 'a-publier'
git merge --no-ff 'github-bot/gh-636'
git switch 'a-publier'
git merge --squash 'github-bot/gh-636'
git switch 'a-publier'
git merge --ff-only 'github-bot/gh-636'
git switch 'a-publier'
git merge 'github-bot/gh-636'
git push origin 'a-publier'
This discussion has been locked. Commenting is limited to contributors.
No description provided.