Late textures / flicker outdoors on RX 7900 XTX (main @ 85d5641) — measurements and A/B switches #122

Open
opened 2026-11-26 05:24:53 +00:00 by github-bot · 13 comments
Owner

@⁠remembering7896 on GitHub · 2026-11-26 05:05 UTC · original

Everything below is from main @ 85d564167324056381327ff50f52da85048c84e3, cargo build --locked --profile diag -p victory --features diagnostics, scripts/play.ps1 with its default switches unless stated otherwise.

Environment

OS Windows 11 26200 (10.0.26300), x64
CPU Ryzen 7 9800X3D (8C/16T, AVX2)
GPU Radeon RX 7900 XTX, driver 32.0.32029.2010
RAM 32 GB (README recommends 64 GB)
Pagefile fixed 250 GB on a second NVMe (peak use 98 GB)
Title own dump, v1.0.2.1

Symptom

Exactly the item in README "What is known to be wrong": trees, plants and far buildings flicker outdoors, and textures of what just came into view appear late while the title streams. Not fixed by 0a43566 -> b0cfe2b -> 85d5641; all three builds behave the same to the eye.

Measurements (single-scene samples, world scene up)

run switches t fps ms/frame draws/f uploaded MB waiting passed over unmapped kept what they showed
default play.ps1 defaults ~180 s 15.7 63.6 5042 121138 8902 10091 7417 65375
A VICTORY_TEXTURE_SWEEP=0, VICTORY_TEXTURE_NO_WAIT=0 160 s 17.8 56.2 6357 88599 5666 6522 5165 32054
B VICTORY_TEXTURE_STAGE_MB=768, VICTORY_TEXTURE_STAGE_MS=700 172 s 15.6 63.9 8036 108658 7609 10757 5092 44805
C VICTORY_TEXTURE_SWEEP=0 only 123 s 3.1 317.9 11522 45563 3031 28339 2385 13793

Caveat that matters more than the numbers: the title keeps its saves in data_dir, so each run resumed further into the story than the one before. Draws/frame differ (5042 / 6357 / 8036 / 11522) and the runs are NOT a controlled A/B - they are four single-scene samples. C entered the heaviest scene of the four and stalled at world entry (3.1 fps, 32.6 GB private, machine down to 7 GB free).

Only one switch effect is unambiguous: VICTORY_TEXTURE_NO_WAIT=0 costs 380-780 ms per frame in waits for title memory:

texture refreshes per frame, all threads: 827.7 ms, of them 781.1 ms waiting for title memory
to hold still (the runtime remapping it)
... 639 / 567 / 512 / 416 ms in later frames

C's copystat, for what it is worth:

2932 title textures have no host copy yet (6229 MB of title memory); host copies the title
fills: 39030 alive 4590 MB (38963 of them placed), 0 let go 0 MB and 0 made again 0 MB since
the start; 45372 host copies made in all; passes that made none for lack of room: 0;
the card: 12744 MB in use of a budget of 23749 MB

The card had room and the "no room" gate never fired, so the queue is the staging budget against a scene the title is still mapping.

Counts over one run each (default / A / B):

WARN victory_gpu::draw: a texture picked by index changed after its upload with nothing to
tell of it: uploaded again first_level=0 blocks_shown_elsewhere=1 slot=125483
address=0xc39c92400 bytes=256 frames_after_upload=4 looks=0 changed=91
    -> 122 / 28 / 30 occurrences

WARN victory_gpu::descriptor::host: placed unordered texture view not mirrored (null: writes
through it are lost): resource [3, 13, 0, 0, 512, 0, 512, 524289, 98, 1, 0, 261, 3145728,
32762], view [98, 4, 5768, 0, 0, 15, 0, 0, 0, 0] address=0x0 times=2048
    -> 13 / 12 / 12 occurrences per run

Frame-line counters at one sample: "texture slots written so far: 3419747 placed", of which 693176 were "written with another of another dimension" and only 44805 "kept what they showed meanwhile (VICTORY_KEEP_SHOWN)" - i.e. the overwhelming majority of slot rewrites do not hold the previous picture.

A cross-fork datapoint

On the same machine, one session of myokex/victory-amd (2026-11-25 09:10) logged "textures picked by index: 201259 uploaded (12661 MB), 327 waiting, 17019 passed over unmapped" at 3.1 fps. A near-zero queue is reachable on this hardware; the 7900XTX fork sits at a five-digit queue.

Questions

  1. Is a waiting count of ~10000 normal for this title on the 7900XTX fork, or is something in the queue order (e.g. the re-look interval, or the 64 KiB pool change in cf9ba0840f) keeping textures in waiting longer than they should be?
  2. Is VICTORY_TEXTURE_SWEEP=0 safe by default on a 24 GB card, or does it just postpone the churn into VRAM pressure? In our C run it did not help the queue.
  3. Do the "changed after its upload with nothing to tell of it" warnings point at the same mechanism that makes a newly streamed texture appear a few frames late? I can take VICTORY_POP_WATCH runs for a specific window if that helps.
  4. For a 32 GB machine: any switch that trades speed for robustness while the private footprint is 40-46 GB, or is "64 GB RAM" the only answer?

How these runs were made

cd <repo>
.\scripts\play.ps1 -Exe <path>/game_scarlett_master.exe
.\scripts\play.ps1 -Exe <path>/game_scarlett_master.exe -More @{VICTORY_TEXTURE_SWEEP='0'; VICTORY_TEXTURE_NO_WAIT='0'}
.\scripts\play.ps1 -Exe <path>/game_scarlett_master.exe -More @{VICTORY_TEXTURE_STAGE_MB='768'; VICTORY_TEXTURE_STAGE_MS='700'}

Logs available on request (run-book-stdout.log, run-A-resident.log, run-B-stage.log, run-C-sweep.log).

**@⁠remembering7896** on GitHub · 2026-11-26 05:05 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/122) Everything below is from `main @ 85d564167324056381327ff50f52da85048c84e3`, `cargo build --locked --profile diag -p victory --features diagnostics`, `scripts/play.ps1` with its default switches unless stated otherwise. ## Environment | | | |---|---| | OS | Windows 11 26200 (10.0.26300), x64 | | CPU | Ryzen 7 9800X3D (8C/16T, AVX2) | | GPU | Radeon RX 7900 XTX, driver 32.0.32029.2010 | | RAM | 32 GB (README recommends 64 GB) | | Pagefile | fixed 250 GB on a second NVMe (peak use 98 GB) | | Title | own dump, v1.0.2.1 | ## Symptom Exactly the item in README "What is known to be wrong": trees, plants and far buildings flicker outdoors, and textures of what just came into view appear late while the title streams. Not fixed by 0a43566 -> b0cfe2b -> 85d5641; all three builds behave the same to the eye. ## Measurements (single-scene samples, world scene up) | run | switches | t | fps | ms/frame | draws/f | uploaded | MB | waiting | passed over unmapped | kept what they showed | |---|---|---|---|---|---|---|---|---|---|---| | default | play.ps1 defaults | ~180 s | 15.7 | 63.6 | 5042 | 121138 | 8902 | 10091 | 7417 | 65375 | | A | VICTORY_TEXTURE_SWEEP=0, VICTORY_TEXTURE_NO_WAIT=0 | 160 s | 17.8 | 56.2 | 6357 | 88599 | 5666 | 6522 | 5165 | 32054 | | B | VICTORY_TEXTURE_STAGE_MB=768, VICTORY_TEXTURE_STAGE_MS=700 | 172 s | 15.6 | 63.9 | 8036 | 108658 | 7609 | 10757 | 5092 | 44805 | | C | VICTORY_TEXTURE_SWEEP=0 only | 123 s | 3.1 | 317.9 | 11522 | 45563 | 3031 | 28339 | 2385 | 13793 | Caveat that matters more than the numbers: the title keeps its saves in data_dir, so each run resumed further into the story than the one before. Draws/frame differ (5042 / 6357 / 8036 / 11522) and the runs are NOT a controlled A/B - they are four single-scene samples. C entered the heaviest scene of the four and stalled at world entry (3.1 fps, 32.6 GB private, machine down to 7 GB free). Only one switch effect is unambiguous: VICTORY_TEXTURE_NO_WAIT=0 costs 380-780 ms per frame in waits for title memory: texture refreshes per frame, all threads: 827.7 ms, of them 781.1 ms waiting for title memory to hold still (the runtime remapping it) ... 639 / 567 / 512 / 416 ms in later frames C's copystat, for what it is worth: 2932 title textures have no host copy yet (6229 MB of title memory); host copies the title fills: 39030 alive 4590 MB (38963 of them placed), 0 let go 0 MB and 0 made again 0 MB since the start; 45372 host copies made in all; passes that made none for lack of room: 0; the card: 12744 MB in use of a budget of 23749 MB The card had room and the "no room" gate never fired, so the queue is the staging budget against a scene the title is still mapping. ## Evidence in the log that looks related to the pop Counts over one run each (default / A / B): WARN victory_gpu::draw: a texture picked by index changed after its upload with nothing to tell of it: uploaded again first_level=0 blocks_shown_elsewhere=1 slot=125483 address=0xc39c92400 bytes=256 frames_after_upload=4 looks=0 changed=91 -> 122 / 28 / 30 occurrences WARN victory_gpu::descriptor::host: placed unordered texture view not mirrored (null: writes through it are lost): resource [3, 13, 0, 0, 512, 0, 512, 524289, 98, 1, 0, 261, 3145728, 32762], view [98, 4, 5768, 0, 0, 15, 0, 0, 0, 0] address=0x0 times=2048 -> 13 / 12 / 12 occurrences per run Frame-line counters at one sample: "texture slots written so far: 3419747 placed", of which 693176 were "written with another of another dimension" and only 44805 "kept what they showed meanwhile (VICTORY_KEEP_SHOWN)" - i.e. the overwhelming majority of slot rewrites do not hold the previous picture. ## A cross-fork datapoint On the same machine, one session of myokex/victory-amd (2026-11-25 09:10) logged "textures picked by index: 201259 uploaded (12661 MB), 327 waiting, 17019 passed over unmapped" at 3.1 fps. A near-zero queue is reachable on this hardware; the 7900XTX fork sits at a five-digit queue. ## Questions 1. Is a waiting count of ~10000 normal for this title on the 7900XTX fork, or is something in the queue order (e.g. the re-look interval, or the 64 KiB pool change in cf9ba0840f) keeping textures in waiting longer than they should be? 2. Is VICTORY_TEXTURE_SWEEP=0 safe by default on a 24 GB card, or does it just postpone the churn into VRAM pressure? In our C run it did not help the queue. 3. Do the "changed after its upload with nothing to tell of it" warnings point at the same mechanism that makes a newly streamed texture appear a few frames late? I can take VICTORY_POP_WATCH runs for a specific window if that helps. 4. For a 32 GB machine: any switch that trades speed for robustness while the private footprint is 40-46 GB, or is "64 GB RAM" the only answer? ## How these runs were made cd <repo> .\scripts\play.ps1 -Exe <path>/game_scarlett_master.exe .\scripts\play.ps1 -Exe <path>/game_scarlett_master.exe -More @{VICTORY_TEXTURE_SWEEP='0'; VICTORY_TEXTURE_NO_WAIT='0'} .\scripts\play.ps1 -Exe <path>/game_scarlett_master.exe -More @{VICTORY_TEXTURE_STAGE_MB='768'; VICTORY_TEXTURE_STAGE_MS='700'} Logs available on request (run-book-stdout.log, run-A-resident.log, run-B-stage.log, run-C-sweep.log).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:24:53 +00:00
Author
Owner

@⁠remembering7896 on GitHub · 2026-11-26 05:30 UTC · original

Follow-up: the STAGE_MB / STAGE_MS overrides can make every texture flicker

Trying to drain the queue faster, I ran -More @{VICTORY_TEXTURE_STAGE_MB='768'; VICTORY_TEXTURE_STAGE_MS='700'}. Result was not a shorter backlog but the whole scene's textures replacing in place every frame, and at world entry the image is effectively frozen (0.3-1.4 fps, 32.6 GB private on a 32 GB machine).

Three code paths explain it, and each looks worth guarding:

  1. staging_budget_per_frame returns 384 MiB at a 24 GiB budget (draw.rs:4400-4430, unit test Some(24 * GIB) => 384 * MIB), so STAGE_MB=768 is already 2x the default. With catchup (on_time >= 1024) multiplying by 3, one frame asks for 2304 MB - 6x the base - and the pass uploads a large batch in one frame.
  2. That batch includes textures whose memory is only partly mapped: "One of which some is mapped (a texture streaming in: its smaller mips lie at the start of its memory and arrive first) is uploaded with what is there, and again when more is" (draw.rs:2244-2254). At 384 MB a frame this trickles; at 2.3 GB a frame hundreds of half-mapped textures are uploaded and shown, then re-uploaded as their pages arrive - which is exactly "all textures flicker".
  3. STAGE_MS is not a background budget: the pass "runs on a thread that records the frame, and making and staging 192 MB of textures took 1.6-2.2 s of each of the world's first twenty frames" (draw.rs:2213-2216). With 700 ms, every frame that has a backlog spends >= 700 ms recording, so sub-2 fps follows by construction.

Suggested guards, whichever you prefer:

  • clamp the overrides: min(user_mb, staging_budget_per_frame(budget)) and cap the span at the 250 ms default;
  • or skip the catchup * 3 when the bytes were set by hand;
  • or document both as debug-only and refuse them outside --profile diag.

Sample from that run: textures picked by index: 108658 uploaded (7609 MB), 10757 waiting, 5092 passed over unmapped, 8036 draws/frame, 15.6 fps / 63.9 ms once the world was up. Log kept (run-B-stage.log), excerpts available on request.

Everything else in the report above stands; with defaults these switches are unset and nothing here changes the late-texture behaviour.

**@⁠remembering7896** on GitHub · 2026-11-26 05:30 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/122#issuecomment-7183545860) ## Follow-up: the STAGE_MB / STAGE_MS overrides can make every texture flicker Trying to drain the queue faster, I ran `-More @{VICTORY_TEXTURE_STAGE_MB='768'; VICTORY_TEXTURE_STAGE_MS='700'}`. Result was not a shorter backlog but **the whole scene's textures replacing in place every frame**, and at world entry the image is effectively frozen (0.3-1.4 fps, 32.6 GB private on a 32 GB machine). Three code paths explain it, and each looks worth guarding: 1. `staging_budget_per_frame` returns **384 MiB at a 24 GiB budget** (`draw.rs:4400-4430`, unit test `Some(24 * GIB) => 384 * MIB`), so `STAGE_MB=768` is already 2x the default. With `catchup` (`on_time >= 1024`) multiplying by 3, one frame asks for **2304 MB - 6x the base** - and the pass uploads a large batch in one frame. 2. That batch includes textures whose memory is only partly mapped: "One of which some is mapped (a texture streaming in: its smaller mips lie at the start of its memory and arrive first) is uploaded with what is there, and again when more is" (`draw.rs:2244-2254`). At 384 MB a frame this trickles; at 2.3 GB a frame hundreds of half-mapped textures are uploaded and shown, then re-uploaded as their pages arrive - which is exactly "all textures flicker". 3. `STAGE_MS` is not a background budget: the pass "runs on a thread that records the frame, and making and staging 192 MB of textures took 1.6-2.2 s of each of the world's first twenty frames" (`draw.rs:2213-2216`). With 700 ms, every frame that has a backlog spends >= 700 ms recording, so sub-2 fps follows by construction. Suggested guards, whichever you prefer: - clamp the overrides: `min(user_mb, staging_budget_per_frame(budget))` and cap the span at the 250 ms default; - or skip the `catchup * 3` when the bytes were set by hand; - or document both as debug-only and refuse them outside `--profile diag`. Sample from that run: `textures picked by index: 108658 uploaded (7609 MB), 10757 waiting, 5092 passed over unmapped`, 8036 draws/frame, 15.6 fps / 63.9 ms once the world was up. Log kept (run-B-stage.log), excerpts available on request. Everything else in the report above stands; with defaults these switches are unset and nothing here changes the late-texture behaviour.
Author
Owner

@⁠remembering7896 on GitHub · 2026-11-26 07:14 UTC · original

VICTORY_POP_WATCH on f249fe0: ~2.3 blips a frame, and the dominant state is "made null for another texture"

Same machine and build as above (main @ f249fe0, diag profile). All 25,790 shaders pre-translated (victory.exe shaders: 143 s; the 195 left are the geometry shaders, as you said), pipelines rebuilt for this run.

Window VICTORY_POP_WATCH=70-240, 170 s in the world, walking around trees and far buildings - what the eye calls the flicker:

  • 565 frames read, 1308 blips -> 2.32 per frame, 0 steps.
  • Each frame's state line reads like [made null for another texture, kept, neutral, stale] [585, 74, 75, 53]: several hundred slot rewrites per frame are of the "made null for another texture" kind, only tens are "kept".

Then I tried to turn those nulls into held pictures:

  • VICTORY_KEEP_SHOWN=1 (in a diagnostics build that maps to level 2, Kin::Other => keep >= 2, so a slot written with a different texture keeps what it showed): 603 frames, 1948 blips -> 3.23 per frame. Worse, not better - the stale picture is a blip too - and fps in that window was 6.6.

Question: VICTORY_SHOW_NEW_LATER covers textures that are new, but a slot rewritten with another texture (kin = Other/None, kept only at keep >= 2) still goes null for a frame. Is there a path where such a slot keeps its old view until the new texture's upload has run (the analogue of show_new_later for rewrites), and is that where the remaining blips come from by design?

Two negative results that may save you time:

  1. VICTORY_TEXTURE_STAGE_MB=768 with STAGE_MS=700: the whole scene flickers and world entry freezes (reported earlier).
  2. A time-boxed catch-up in the style of victory-amd's VICTORY_TEXTURE_GATE_S (60 s allowance, 3x bytes and span while the queue is long), patched into this tree: the queue only came down to ~6.5k (nowhere near that fork's 327) and fps was 7.4-8.2 while catching up, so I reverted it. The backlog is not what our staging budget limits.

Logs (run-G-popwatch.log, run-H-keep.log) on request.

**@⁠remembering7896** on GitHub · 2026-11-26 07:14 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/122#issuecomment-7185238728) ## `VICTORY_POP_WATCH` on f249fe0: ~2.3 blips a frame, and the dominant state is "made null for another texture" Same machine and build as above (`main @ f249fe0`, diag profile). All 25,790 shaders pre-translated (`victory.exe shaders`: 143 s; the 195 left are the geometry shaders, as you said), pipelines rebuilt for this run. Window `VICTORY_POP_WATCH=70-240`, 170 s in the world, walking around trees and far buildings - what the eye calls the flicker: - **565 frames read, 1308 blips -> 2.32 per frame, 0 steps.** - Each frame's state line reads like `[made null for another texture, kept, neutral, stale] [585, 74, 75, 53]`: several hundred slot rewrites per frame are of the "made null for another texture" kind, only tens are "kept". Then I tried to turn those nulls into held pictures: - `VICTORY_KEEP_SHOWN=1` (in a diagnostics build that maps to level 2, `Kin::Other => keep >= 2`, so a slot written with a *different* texture keeps what it showed): **603 frames, 1948 blips -> 3.23 per frame**. Worse, not better - the stale picture is a blip too - and fps in that window was 6.6. Question: `VICTORY_SHOW_NEW_LATER` covers textures that are *new*, but a slot rewritten with *another* texture (`kin = Other/None`, `kept` only at `keep >= 2`) still goes null for a frame. Is there a path where such a slot keeps its old view until the new texture's upload has run (the analogue of `show_new_later` for rewrites), and is that where the remaining blips come from by design? Two negative results that may save you time: 1. `VICTORY_TEXTURE_STAGE_MB=768` with `STAGE_MS=700`: the whole scene flickers and world entry freezes (reported earlier). 2. A time-boxed catch-up in the style of `victory-amd`'s `VICTORY_TEXTURE_GATE_S` (60 s allowance, 3x bytes and span while the queue is long), patched into this tree: the queue only came down to ~6.5k (nowhere near that fork's 327) and fps was 7.4-8.2 while catching up, so I reverted it. The backlog is not what our staging budget limits. Logs (run-G-popwatch.log, run-H-keep.log) on request.
Author
Owner

@⁠jtrudeau1530 on GitHub · 2026-11-26 07:39 UTC · original

A data point on where the late textures come from, from a Linux run (Wine 11.18 stock wineserver, RADV, RX 7900 XT, 0a43566 plus local patches; same streaming code). TL;DR: the reads themselves are fast. Texture-pack requests wait for the title's own Submit, and that wait grows with frame time.

Per-request DirectStorage log (VICTORY_DSTORAGE_LOG, one 120 s run into the opening cutscene, 138,636 requests). One note for Linux users: under bwrap/Proton sandboxes the path must be writable from the process's cwd. An absolute Z:/... path silently wrote nothing for me; a relative dstorage.tsv worked.

file kind requests enqueue → title Submit (median) Submit → start start → done
.rpf (levels, packs, anim, bvh…), queues 0-16, options 0x1 ~100k 0 ms 1-9 ms 0 ms
.ttpf texture packs, queue 2, options 0x200001 5,307 262 ms 15 ms 0 ms
.ttpf texture packs, queue 15, options 0x200001 4,788 983 ms 39 ms 0 ms

By file: octa_imposters.ttpf p50 290 / p90 682 / max 1,767 ms enqueue→done; ttdb_props_* p50 ~170 ms; peds_loose 319 ms; levels.rpf p50 7 ms over 49,893 requests / 3.5 GB.

So the runtime's queue isn't what holds these back. The title enqueues texture-pack reads and submits them later, apparently on its own cadence. At 1-4 fps in the first world frames, that's hundreds of ms per batch. Draining our upload queue faster (STAGE_MB/STAGE_MS: here too the backlog stayed 15-20k, as in the follow-up above) can't make data arrive that the title hasn't submitted yet. Frame rate in the first seconds is the lever.

A visible symptom of it in the opening yard wide shot: rooftop AC units, vents, a dish and light rigs float in the sky, with the distant buildings under them and some terrain pieces missing. What I checked:

  • They are absent from the depth buffer too (VICTORY_DUMP_TARGETS at world+2…6). Reversed-Z, and the 1024x512 R32F HiZ (built from the main depth by 42683eebec081520/2dc602192abf6288) reads "far" there, so the GPU occlusion culling (fc5e66f8…/0452fc2d… → mesh args) isn't hiding them.
  • 0 world draws dropped (only the BVH builder stages, BVH off).
  • The streaming trace (VICTORY_DSTORAGE_TRACE=1) shows 0 page-list or overlap faults.
  • The 0x1c8/0x218 E_NOTIMPL device slots are the boot-time pre-creation (#417 upstream), so not related.

The remaining explanation consistent with all of that: distant buildings are drawn as octahedral imposters whose index-picked textures are still null (5-digit "waiting" at world entry), so alpha-tested cards discard. Close shots of the same buildings, drawn from real meshes, are fine. I haven't proven the imposter link at the draw level yet; if someone knows the imposter pixel-shader hash, a VICTORY_CAPTURE_FRAMES trace of its slots in that shot would settle it.

(AI-assisted analysis with Claude Code on my machine; logs and the per-request TSV available.)

**@⁠jtrudeau1530** on GitHub · 2026-11-26 07:39 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/122#issuecomment-7185698318) A data point on where the late textures come from, from a Linux run (Wine 11.18 stock wineserver, RADV, RX 7900 XT, `0a43566` plus local patches; same streaming code). TL;DR: the reads themselves are fast. Texture-pack requests wait for the title's own `Submit`, and that wait grows with frame time. **Per-request DirectStorage log** (`VICTORY_DSTORAGE_LOG`, one 120 s run into the opening cutscene, 138,636 requests). One note for Linux users: under bwrap/Proton sandboxes the path must be writable from the process's cwd. An absolute `Z:/...` path silently wrote nothing for me; a relative `dstorage.tsv` worked. | file kind | requests | enqueue → title Submit (median) | Submit → start | start → done | |---|---:|---:|---:|---:| | `.rpf` (levels, packs, anim, bvh…), queues 0-16, options `0x1` | ~100k | **0 ms** | 1-9 ms | 0 ms | | `.ttpf` texture packs, queue 2, options `0x200001` | 5,307 | **262 ms** | 15 ms | 0 ms | | `.ttpf` texture packs, queue 15, options `0x200001` | 4,788 | **983 ms** | 39 ms | 0 ms | By file: `octa_imposters.ttpf` p50 290 / p90 682 / max 1,767 ms enqueue→done; `ttdb_props_*` p50 ~170 ms; `peds_loose` 319 ms; `levels.rpf` p50 7 ms over 49,893 requests / 3.5 GB. So the runtime's queue isn't what holds these back. The title enqueues texture-pack reads and submits them later, apparently on its own cadence. At 1-4 fps in the first world frames, that's hundreds of ms per batch. Draining our upload queue faster (STAGE_MB/STAGE_MS: here too the backlog stayed 15-20k, as in the follow-up above) can't make data arrive that the title hasn't submitted yet. Frame rate in the first seconds is the lever. **A visible symptom of it in the opening yard wide shot:** rooftop AC units, vents, a dish and light rigs float in the sky, with the distant buildings under them and some terrain pieces missing. What I checked: - They are absent from the depth buffer too (`VICTORY_DUMP_TARGETS` at world+2…6). Reversed-Z, and the 1024x512 R32F HiZ (built from the main depth by `42683eebec081520`/`2dc602192abf6288`) reads "far" there, so the GPU occlusion culling (`fc5e66f8…`/`0452fc2d…` → mesh args) isn't hiding them. - 0 world draws dropped (only the BVH builder stages, BVH off). - The streaming trace (`VICTORY_DSTORAGE_TRACE=1`) shows 0 page-list or overlap faults. - The 0x1c8/0x218 E_NOTIMPL device slots are the boot-time pre-creation (#417 upstream), so not related. The remaining explanation consistent with all of that: distant buildings are drawn as octahedral imposters whose index-picked textures are still null (5-digit "waiting" at world entry), so alpha-tested cards discard. Close shots of the same buildings, drawn from real meshes, are fine. I haven't proven the imposter link at the draw level yet; if someone knows the imposter pixel-shader hash, a `VICTORY_CAPTURE_FRAMES` trace of its slots in that shot would settle it. (AI-assisted analysis with Claude Code on my machine; logs and the per-request TSV available.)
Author
Owner

@⁠towade on GitHub · 2026-11-26 12:11 UTC · original

VICTORY_POP_WATCH on an RX 9070 XT (RDNA 4), 64 GB: three runs, one switch set changed each; the upload queue and the blips do not move together

Hardware: Radeon RX 9070 XT 16 GB, driver 32.0.32029.2010 · Core i7-14700K · 64 GB · Windows 11 26300. Build: 9576c45 + #55 (the RDNA 4 compiler fix; without it this card does not get into the world), diag, all 25,790 shaders translated ahead.

Each run: scripts\play.ps1, VICTORY_POP_WATCH=180-300 (120 s), and VICTORY_AB=10,VICTORY_UPLOAD_AHEAD, so UPLOAD_AHEAD flips every 10 s within the same scene. About the same place each time, in a boat on open water, turning the boat and the camera slowly by hand (neither the place nor the turns were exactly the same). Water moves, so the lone-block counts are high in every run; the blips (one frame differing from two neighbours that agree) are the number to compare.

run UPLOAD_AHEAD frames frames with blips blip blocks / frame lone blocks / frame world fps (median) textures waiting (median)
defaults off 725 6.9 % 0.10 1.82 22.9 7,466
defaults on 642 9.7 % 0.14 2.26
defaults + VICTORY_THIN=0 off 896 4.6 % 0.07 2.36 20.0 1,867
defaults + VICTORY_THIN=0 on 771 5.1 % 0.06 1.74
-Safe off 854 8.1 % 0.16 1.89 19.1 2,231
-Safe on 825 8.0 % 0.21 1.47

What it does and does not show:

  • The queue is not the blips. With VICTORY_THIN=1 the queue of textures waiting stays four times longer here (7,466 against 1,867 and 2,231), but -Safe, with the short queue, has the most blips of the three.
  • UPLOAD_AHEAD: within each run, on and off are within the noise of each other (more blips with it on in the first run, the same in the other two). Frame times per phase are the same within 1–2 ms.
  • Fewer blips than above: 0.06–0.21 blip blocks a frame, against 2.32 a frame in the trees-and-buildings window on the 7900 XTX. On open water there is less to stream than on land, so this is not a like-for-like comparison of cards.
  • 0 first-chance exceptions in all three runs.
  • The window missed the worst of it: to the eye, most of the background flicker comes right after the cutscene that leads into the world, i.e. before second 180. Some models in that cutscene also stay untextured. A window starting right at world entry would likely count much more.

This is one run per row and the title's save moves on between runs, so the differences between runs are a hint, not a measurement. If a land scene helps, with the same window and switches, I can run it.

AI-assisted (Claude Code).

**@⁠towade** on GitHub · 2026-11-26 12:11 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/122#issuecomment-7191683952) **`VICTORY_POP_WATCH` on an RX 9070 XT (RDNA 4), 64 GB: three runs, one switch set changed each; the upload queue and the blips do not move together** Hardware: Radeon RX 9070 XT 16 GB, driver 32.0.32029.2010 · Core i7-14700K · 64 GB · Windows 11 26300. Build: `9576c45` + #55 (the RDNA 4 compiler fix; without it this card does not get into the world), `diag`, all 25,790 shaders translated ahead. Each run: `scripts\play.ps1`, `VICTORY_POP_WATCH=180-300` (120 s), and `VICTORY_AB=10,VICTORY_UPLOAD_AHEAD`, so `UPLOAD_AHEAD` flips every 10 s within the same scene. About the same place each time, in a boat on open water, turning the boat and the camera slowly by hand (neither the place nor the turns were exactly the same). Water moves, so the lone-block counts are high in every run; the blips (one frame differing from two neighbours that agree) are the number to compare. | run | `UPLOAD_AHEAD` | frames | frames with blips | blip blocks / frame | lone blocks / frame | world fps (median) | textures waiting (median) | |---|---|---:|---:|---:|---:|---:|---:| | defaults | off | 725 | 6.9 % | 0.10 | 1.82 | 22.9 | 7,466 | | defaults | on | 642 | 9.7 % | 0.14 | 2.26 | | | | defaults + `VICTORY_THIN=0` | off | 896 | 4.6 % | 0.07 | 2.36 | 20.0 | 1,867 | | defaults + `VICTORY_THIN=0` | on | 771 | 5.1 % | 0.06 | 1.74 | | | | `-Safe` | off | 854 | 8.1 % | 0.16 | 1.89 | 19.1 | 2,231 | | `-Safe` | on | 825 | 8.0 % | 0.21 | 1.47 | | | What it does and does not show: - **The queue is not the blips.** With `VICTORY_THIN=1` the queue of textures waiting stays four times longer here (7,466 against 1,867 and 2,231), but `-Safe`, with the short queue, has the most blips of the three. - **`UPLOAD_AHEAD`**: within each run, on and off are within the noise of each other (more blips with it on in the first run, the same in the other two). Frame times per phase are the same within 1–2 ms. - **Fewer blips than above**: 0.06–0.21 blip blocks a frame, against 2.32 a frame in the trees-and-buildings window on the 7900 XTX. On open water there is less to stream than on land, so this is not a like-for-like comparison of cards. - 0 first-chance exceptions in all three runs. - **The window missed the worst of it**: to the eye, most of the background flicker comes right after the cutscene that leads into the world, i.e. before second 180. Some models in that cutscene also stay untextured. A window starting right at world entry would likely count much more. This is one run per row and the title's save moves on between runs, so the differences between runs are a hint, not a measurement. If a land scene helps, with the same window and switches, I can run it. AI-assisted (Claude Code).
Author
Owner

@⁠Arvi23 on GitHub · 2026-11-26 13:41 UTC · original

The outdoor tree flicker comes from renderer port 2 (VICTORY_PORT_DESCRIPTORS=1) here: off, the trees hold; on, they flicker. It misses view records the title writes with a store form descriptor_sites does not patch.

Machine: RX 9070 XT 16 GB (RDNA 4), driver 32.0.32029.2010, Windows 10 LTSC 21H2 (Agility SDK 620 loaded), 32 GB. Build: main at 0dec5dc/c9c932c + local Windows 10 and RDNA 4 patches (Agility exports, compiler-crash guard); diag, scripts\play.ps1 settings, Series X, all 25,790 shaders translated ahead. Same place each run: on the boat, trees against the sky.

What the flicker is. With VICTORY_POP_WATCH + VICTORY_POP_ALL=1, the toggling pixels are whole distant trees (palms and big trees against the sky, trunk included), not edges or textures: one tall tree is drawn in 1 of 5 consecutive frames and absent from the other 4. A per-frame census of draws by title pipeline (counted where draws are issued) shows the title asks for the same draws in frames with and without the trees, so they vanish on the card.

What it is not (each tested on its own run, flicker unchanged): VICTORY_RELAY=0; VICTORY_INDIRECT_BATCH=0 + VICTORY_INDIRECT_WINDOW=0; VICTORY_SKIP_PIPELINES of the two meshlet culls (fc5e66f8f873d3bb, 0452fc2d2e2fc4c3); VICTORY_OUTPUT=2560x1440 + VICTORY_RENDER_SCALE=1.0 (no upscaling); occlusion queries (resolve_queries answers "visible").

Bisect.

switches trees
neither port steady (only the farthest ones flicker a little)
VICTORY_PORT_CONSTANTS=1 steady, as without
VICTORY_PORT_CONSTANTS=1 VICTORY_PORT_DESCRIPTORS=1 flicker

Why. Port 2's own line in that run: about 136 view records a frame that no mark told of, found by the fallback on its 16 pages (so the real number is higher), 113,631 since the start. Of the writers it attributes them to (the last fault on each 64 KiB block, so only a hint), most are the frame allocator's bookkeeping in the same blocks (+0x18849c, +0x2474afc, +0x4e9b4e2: 8-byte list stores). One is not: around +0x4d9f25f, in the table filler near +0x4d9efd0, the title copies four records at a time from [r12+…] with stores that have a displacement:

c5 fc 11 5b 60    vmovups [rbx+0x60], ymm3
c5 fc 11 53 40    vmovups [rbx+0x40], ymm2
c5 fc 11 4b 20    vmovups [rbx+0x20], ymm1
...

descriptor_sites::lea_of takes only vmovups [base+index] (no displacement), so these four are never patched and their slots keep the view of before until the fallback reaches their page.

Smaller thing we also saw: the memcpy/memmove wrap marks a slot only if the record's first word lies in the copy ((lo - start).div_ceil(32)), so a copy into the middle of a record is not marked. Marking every slot the copy touches did not change the flicker here, so the displaced stores look like the main gap.

Until port 2 covers those stores (a stub for [base+disp8], or the fallback taking every page the watch says was written while the port is on), VICTORY_PORT_DESCRIPTORS=1 makes distant trees flicker on this machine; port 1 alone does not.

**@⁠Arvi23** on GitHub · 2026-11-26 13:41 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/122#issuecomment-7193701203) **The outdoor tree flicker comes from renderer port 2 (`VICTORY_PORT_DESCRIPTORS=1`) here: off, the trees hold; on, they flicker. It misses view records the title writes with a store form `descriptor_sites` does not patch.** Machine: RX 9070 XT 16 GB (RDNA 4), driver 32.0.32029.2010, Windows 10 LTSC 21H2 (Agility SDK 620 loaded), 32 GB. Build: `main` at `0dec5dc`/`c9c932c` + local Windows 10 and RDNA 4 patches (Agility exports, compiler-crash guard); `diag`, `scripts\play.ps1` settings, Series X, all 25,790 shaders translated ahead. Same place each run: on the boat, trees against the sky. **What the flicker is.** With `VICTORY_POP_WATCH` + `VICTORY_POP_ALL=1`, the toggling pixels are whole distant trees (palms and big trees against the sky, trunk included), not edges or textures: one tall tree is drawn in 1 of 5 consecutive frames and absent from the other 4. A per-frame census of draws by title pipeline (counted where draws are issued) shows the title asks for the same draws in frames with and without the trees, so they vanish on the card. **What it is not** (each tested on its own run, flicker unchanged): `VICTORY_RELAY=0`; `VICTORY_INDIRECT_BATCH=0` + `VICTORY_INDIRECT_WINDOW=0`; `VICTORY_SKIP_PIPELINES` of the two meshlet culls (`fc5e66f8f873d3bb`, `0452fc2d2e2fc4c3`); `VICTORY_OUTPUT=2560x1440` + `VICTORY_RENDER_SCALE=1.0` (no upscaling); occlusion queries (`resolve_queries` answers "visible"). **Bisect.** | switches | trees | |---|---| | neither port | steady (only the farthest ones flicker a little) | | `VICTORY_PORT_CONSTANTS=1` | steady, as without | | `VICTORY_PORT_CONSTANTS=1 VICTORY_PORT_DESCRIPTORS=1` | flicker | **Why.** Port 2's own line in that run: about 136 view records a frame that no mark told of, found by the fallback on its 16 pages (so the real number is higher), 113,631 since the start. Of the writers it attributes them to (the last fault on each 64 KiB block, so only a hint), most are the frame allocator's bookkeeping in the same blocks (`+0x18849c`, `+0x2474afc`, `+0x4e9b4e2`: 8-byte list stores). One is not: around **`+0x4d9f25f`**, in the table filler near `+0x4d9efd0`, the title copies four records at a time from `[r12+…]` with stores that have a displacement: ``` c5 fc 11 5b 60 vmovups [rbx+0x60], ymm3 c5 fc 11 53 40 vmovups [rbx+0x40], ymm2 c5 fc 11 4b 20 vmovups [rbx+0x20], ymm1 ... ``` `descriptor_sites::lea_of` takes only `vmovups [base+index]` (no displacement), so these four are never patched and their slots keep the view of before until the fallback reaches their page. Smaller thing we also saw: the `memcpy`/`memmove` wrap marks a slot only if the record's first word lies in the copy (`(lo - start).div_ceil(32)`), so a copy into the middle of a record is not marked. Marking every slot the copy touches did not change the flicker here, so the displaced stores look like the main gap. Until port 2 covers those stores (a stub for `[base+disp8]`, or the fallback taking every page the watch says was written while the port is on), `VICTORY_PORT_DESCRIPTORS=1` makes distant trees flicker on this machine; port 1 alone does not.
Author
Owner

@⁠z395977743-svg on GitHub · 2026-11-26 14:06 UTC · original

I reproduced the unmarked descriptor records on an RX 7900 XTX (RDNA 3) in the prison room at the window after skipping the intro. This is an indoor comparison for the outdoor report above. I haven't tied an individual record to a disappearing object.

Windows 10 build 19045, driver 32.0.32029.2010, Ryzen 5 5600X, 32 GB RAM. Series X, 1920×1080 output, frame generation off. Diagnostic build from c9c932c with the mouse changes from #153 and local Agility SDK 1.620.2 support. Normal scripts/play.ps1 settings with PORT_CONSTANTS, PORT_DESCRIPTORS, PORT_GUARD, PORT_JOURNAL, RESIDENCY and PIPELINE_BOOK enabled. No texture staging overrides. Copied save, warmed pipelines. The log confirmed 6/6 descriptor store sites patched.

Two host samples from the same stationary room, about 10 seconds apart:

Draws/frame Frame / CPU prep Unmarked view records/frame found by fallback Pages scanned/frame Textures waiting Local video memory used / budget
4,902 63.9 / 56.8 ms 239.88 16.0 4,357 10,960 / 23,748 MB
4,841 65.8 / 58.8 ms 191.94 16.0 4,629 10,970 / 23,748 MB

Individual warnings frequently list title+0x18849c as the last writer to the page. Both samples reported 342 draws without a host pipeline and zero pipelines being made at sample time. A background Rust build overlapped this run, so the frame times are context only. The observation is that even with 6/6 sites patched and local VRAM headroom, the fallback still found hundreds of unmarked records per frame on this card.

**@⁠z395977743-svg** on GitHub · 2026-11-26 14:06 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/122#issuecomment-7194281817) I reproduced the unmarked descriptor records on an RX 7900 XTX (RDNA 3) in the prison room at the window after skipping the intro. This is an indoor comparison for the outdoor report above. I haven't tied an individual record to a disappearing object. Windows 10 build 19045, driver 32.0.32029.2010, Ryzen 5 5600X, 32 GB RAM. Series X, 1920×1080 output, frame generation off. Diagnostic build from `c9c932c` with the mouse changes from #153 and local Agility SDK 1.620.2 support. Normal `scripts/play.ps1` settings with `PORT_CONSTANTS`, `PORT_DESCRIPTORS`, `PORT_GUARD`, `PORT_JOURNAL`, `RESIDENCY` and `PIPELINE_BOOK` enabled. No texture staging overrides. Copied save, warmed pipelines. The log confirmed 6/6 descriptor store sites patched. Two host samples from the same stationary room, about 10 seconds apart: | Draws/frame | Frame / CPU prep | Unmarked view records/frame found by fallback | Pages scanned/frame | Textures waiting | Local video memory used / budget | |---:|---:|---:|---:|---:|---:| | 4,902 | 63.9 / 56.8 ms | 239.88 | 16.0 | 4,357 | 10,960 / 23,748 MB | | 4,841 | 65.8 / 58.8 ms | 191.94 | 16.0 | 4,629 | 10,970 / 23,748 MB | Individual warnings frequently list `title+0x18849c` as the last writer to the page. Both samples reported 342 draws without a host pipeline and zero pipelines being made at sample time. A background Rust build overlapped this run, so the frame times are context only. The observation is that even with 6/6 sites patched and local VRAM headroom, the fallback still found hundreds of unmarked records per frame on this card.
Author
Owner

@⁠Arvi23 on GitHub · 2026-11-26 16:31 UTC · original

Follow-up: the store form descriptor_sites missed is the copy of a whole table of four records. Patched as a seventh site, the records port 2 misses drop from ~136 to ~6 a frame here.

Same machine as my comment above (RX 9070 XT, Windows 10 LTSC, c9c932c + local patches), same place on the water, renderer ports 1, 2, 6 and 7.

Where. The writer I named, +0x4d9f25f, is in a function at +0x4d9f200. It takes a table of r14 bytes from the frame allocator (call +0x4d9f3e0). For a 128-byte table (cmp r14, 80h) it copies four records with four loads from [r12] and four stores that have a displacement:

+0x4d9f25f  c5 fc 11 5b 60   vmovups [rbx+60h], ymm3
+0x4d9f264  c5 fc 11 53 40   vmovups [rbx+40h], ymm2
+0x4d9f269  c5 fc 11 4b 20   vmovups [rbx+20h], ymm1
+0x4d9f26e  c5 fc 11 03      vmovups [rbx], ymm0
+0x4d9f272  4c 89 f9         mov rcx, r15          ; also the target of the other path's jmp
...         45 31 c9         xor r9d, r9d          ; sets the flags before any use

Any other size goes to call +0x5f40560, which is jmp [IAT memcpy] and is already wrapped by port_descriptors::import. So only the 128-byte path was uncovered.

Patch. The 19 bytes of the four stores become one jump to a stub. The stub does the four stores unchanged, then lea rax, [rbx+60h] and the usual bounds check against the heap, and marks the four slots (mov dword [slots+last-3], 01010101h) plus the chunks of the first and last slot. A table that lies below the heap or across its start is not marked (cmp rax, 60h ; jb). The flags are dead there (the xor sets them), and the window is byte-checked like the other six. The jump back lands on +0x4d9f272, which is unchanged. There's a test that runs the hooked window: records stored, four slots and both chunks marked across a chunk boundary, nothing marked outside the heap.

Port 2's own counters, per frame, before → after:

6 sites 7 sites
view records no store told of (fallback) ~136 6.3
changed heap pages the sync looked at 180.8 16.0
slots looked at 370,304 104,579
submit lane's wait for the heaps' records (port 7 line) 15–23 ms 12.7 ms
submit lane's work (VICTORY_ASYNC_SUBMIT line) 62 ms 57.5 ms

The rest of the misses are attributed mostly to +0x18849c and +0x4e9b4e2, the allocator's own bookkeeping in the same 64 KiB blocks, plus a few non-title writers, so they're probably not view records written behind port 2's back. The opening cutscene now reaches ~21 fps here at times. This should also cover z395977743's indoor numbers above (hundreds of unmarked records with 6/6 sites).

Diff (on c9c932c)
diff --git a/crates/victory-gpu/src/port_descriptors.rs b/crates/victory-gpu/src/port_descriptors.rs
index c3349de..8f12f50 100644
--- a/crates/victory-gpu/src/port_descriptors.rs
+++ b/crates/victory-gpu/src/port_descriptors.rs
@@ -15,7 +15,7 @@
 //! with the one last seen (~290 pages, ~600,000 slots, 15-16 ms a frame of
 //! the heap-sync thread, 5-7 of it asking the watch, run port1-3).
 //!
-//! What is done here: the six stores are patched (`descriptor_sites`) to set
+//! What is done here: the seven stores are patched (`descriptor_sites`) to set
 //! a byte per slot and per 128 slots in maps of ours ([`MARKS`]), and our own
 //! mirroring marks too; `descriptor::sync_heaps` takes the marked slots
 //! ([`take`]) in place of the changed pages, and compares and makes only
diff --git a/crates/victory-loader/src/descriptor_sites.rs b/crates/victory-loader/src/descriptor_sites.rs
index 918fcaa..ac06897 100644
--- a/crates/victory-loader/src/descriptor_sites.rs
+++ b/crates/victory-loader/src/descriptor_sites.rs
@@ -11,7 +11,9 @@
 //! [record]`, `vmovups [table + r], ymm0`. Found with `dumpbin /disasm` from
 //! the write faults of run faults-6 (book records "the instruction at a made
 //! the fault"); a search of all of `.text` for the same instruction shape
-//! finds these six stores and no other.
+//! finds these six stores and no other. A seventh site, the copy of a whole
+//! table of four records (+0x4d9f200), stores with a displacement: hooked as
+//! one ([`FOUR`]).
 //!
 //! Each store becomes a jump to code of ours that does the store, then, if
 //! the address lies in the heap `victory-gpu` names in [`Marks`], sets the
@@ -38,9 +40,10 @@ pub struct Site {
     pub bytes: &'static [u8],
 }
 
-/// The six record stores of the table fillers (game_scarlett_master.exe
+/// The six record stores of the table fillers and the copy of a table of
+/// four records (game_scarlett_master.exe
 /// 1.0.2.1, image offsets).
-pub const SITES: [Site; 6] = [
+pub const SITES: [Site; 7] = [
     // +0x4d9efd0, loop 1: [rcx+rsi]
     Site { window: 0x4d9f04f, store: 10, len: 5, bytes: &[0x81, 0xe1, 0xe0, 0x7f, 0x00, 0x00, 0xc5, 0xfc, 0x10, 0x00, 0xc5, 0xfc, 0x11, 0x04, 0x31, 0x0f, 0xb6, 0x47, 0x0b, 0x39, 0xc5] },
     // loop 2: [rcx+rsi]
@@ -53,8 +56,18 @@ pub const SITES: [Site; 6] = [
     Site { window: 0x4eeca08, store: 10, len: 6, bytes: &[0x81, 0xe7, 0xe0, 0x7f, 0x00, 0x00, 0xc5, 0xfc, 0x10, 0x06, 0xc4, 0xa1, 0x7c, 0x11, 0x04, 0x07, 0x0f, 0xb6, 0x72, 0x0d, 0x39, 0xf0] },
     // loop 3: [r10+r8]
     Site { window: 0x4eeca82, store: 11, len: 6, bytes: &[0x41, 0x81, 0xe2, 0xe0, 0x7f, 0x00, 0x00, 0xc5, 0xfc, 0x10, 0x00, 0xc4, 0x81, 0x7c, 0x11, 0x04, 0x02, 0x0f, 0xb6, 0x42, 0x0f, 0x41, 0x39, 0xc6] },
+    // +0x4d9f200, a table of 128 bytes copied whole into one of the
+    // allocator's (other sizes call `memcpy`, wrapped in `victory-gpu`): the
+    // four loads from [r12], then the four stores [`FOUR`], then three `mov`s
+    // and the `xor` that sets the flags. Missed before: ~136 view records a
+    // frame left to the fallback, distant trees shown in 1 frame of 5.
+    Site { window: 0x4d9f244, store: 27, len: 19, bytes: &[0xc4, 0xc1, 0x7c, 0x10, 0x04, 0x24, 0xc4, 0xc1, 0x7c, 0x10, 0x4c, 0x24, 0x20, 0xc4, 0xc1, 0x7c, 0x10, 0x54, 0x24, 0x40, 0xc4, 0xc1, 0x7c, 0x10, 0x5c, 0x24, 0x60, 0xc5, 0xfc, 0x11, 0x5b, 0x60, 0xc5, 0xfc, 0x11, 0x53, 0x40, 0xc5, 0xfc, 0x11, 0x4b, 0x20, 0xc5, 0xfc, 0x11, 0x03, 0x4c, 0x89, 0xf9, 0x48, 0x89, 0xf2, 0x49, 0x89, 0xd8, 0x45, 0x31, 0xc9] },
 ];
 
+/// `vmovups [rbx+60h], ymm3` .. `vmovups [rbx], ymm0`: four records stored
+/// at once, hooked as one.
+const FOUR: [u8; 19] = [0xc5, 0xfc, 0x11, 0x5b, 0x60, 0xc5, 0xfc, 0x11, 0x53, 0x40, 0xc5, 0xfc, 0x11, 0x4b, 0x20, 0xc5, 0xfc, 0x11, 0x03];
+
 /// `lea rax, [base+index]` for a `vmovups [base+index], ymm0` (VEX, ModRM
 /// 04h with a SIB byte, no displacement, the stack pointer not its base):
 /// `None` for another form.
@@ -84,7 +97,12 @@ fn lea_of(store: &[u8]) -> Option<[u8; 4]> {
 /// The code at `to` for the store `store` at `at`: the store, the marks, back
 /// to `at + store.len()`.
 fn stub(store: &[u8], at: usize, to: usize, marks: usize) -> Option<Vec<u8>> {
-    let lea = lea_of(store)?;
+    // The (last) record's address, and whether four end there.
+    let (lea, four) = match lea_of(store) {
+        Some(lea) => (lea, false),
+        None if store == FOUR => ([0x48, 0x8d, 0x43, 0x60], true), // lea rax, [rbx+60h]
+        None => return None,
+    };
     let mut out = store.to_vec();
     out.push(0x50); // push rax
     out.extend(lea); // lea rax, [base+index]
@@ -93,13 +111,34 @@ fn stub(store: &[u8], at: usize, to: usize, marks: usize) -> Option<Vec<u8>> {
     out.extend((marks as u64).to_le_bytes());
     out.extend([0x48, 0x2b, 0x02]); // sub rax, [rdx]
     out.extend([0x48, 0x3b, 0x42, 0x08]); // cmp rax, [rdx+8]
-    out.extend([0x73, 0x18]); // jae past the marks
-    out.extend([0x48, 0xc1, 0xe8, 0x05]); // shr rax, 5: the slot
-    out.extend([0x48, 0x8b, 0x4a, 0x10]); // mov rcx, [rdx+16]
-    out.extend([0xc6, 0x04, 0x01, 0x01]); // mov byte [rcx+rax], 1
-    out.extend([0x48, 0xc1, 0xe8, 0x07]); // shr rax, 7: the chunk
-    out.extend([0x48, 0x8b, 0x4a, 0x18]); // mov rcx, [rdx+24]
-    out.extend([0xc6, 0x04, 0x01, 0x01]); // mov byte [rcx+rax], 1
+    let body: &[u8] = if four {
+        // A table is on 32 bytes, so its four records are four slots.
+        &[
+            0x48, 0xc1, 0xe8, 0x05, // shr rax, 5: the last slot
+            0x48, 0x8b, 0x4a, 0x10, // mov rcx, [rdx+16]
+            0xc7, 0x44, 0x01, 0xfd, 0x01, 0x01, 0x01, 0x01, // mov dword [rcx+rax-3], 01010101h
+            0x48, 0x8b, 0x4a, 0x18, // mov rcx, [rdx+24]
+            0x48, 0x8d, 0x50, 0xfd, // lea rdx, [rax-3]: the first slot
+            0x48, 0xc1, 0xea, 0x07, // shr rdx, 7: its chunk
+            0xc6, 0x04, 0x11, 0x01, // mov byte [rcx+rdx], 1
+            0x48, 0xc1, 0xe8, 0x07, // shr rax, 7: the last's chunk
+            0xc6, 0x04, 0x01, 0x01, // mov byte [rcx+rax], 1
+        ]
+    } else {
+        &[
+            0x48, 0xc1, 0xe8, 0x05, // shr rax, 5: the slot
+            0x48, 0x8b, 0x4a, 0x10, // mov rcx, [rdx+16]
+            0xc6, 0x04, 0x01, 0x01, // mov byte [rcx+rax], 1
+            0x48, 0xc1, 0xe8, 0x07, // shr rax, 7: the chunk
+            0x48, 0x8b, 0x4a, 0x18, // mov rcx, [rdx+24]
+            0xc6, 0x04, 0x01, 0x01, // mov byte [rcx+rax], 1
+        ]
+    };
+    // Four: the first record in the heap too (cmp rax, 60h ; jb past).
+    let first: &[u8] = if four { &[0x48, 0x83, 0xf8, 0x60, 0x72, body.len() as u8] } else { &[] };
+    out.extend([0x73, (first.len() + body.len()) as u8]); // jae past the marks
+    out.extend(first);
+    out.extend(body);
     out.extend([0x59, 0x5a, 0x58]); // pop rcx ; pop rdx ; pop rax
     let back = crate::console_insn::jump(to + out.len(), at + store.len())?;
     out.extend(back);
@@ -189,7 +228,7 @@ mod tests {
 
     #[test]
     fn the_sites_lea_their_stores_address() {
-        let leas: Vec<[u8; 4]> = SITES.iter().map(|s| lea_of(&s.bytes[s.store..s.store + s.len]).unwrap()).collect();
+        let leas: Vec<[u8; 4]> = SITES[..6].iter().map(|s| lea_of(&s.bytes[s.store..s.store + s.len]).unwrap()).collect();
         assert_eq!(leas[0], [0x48, 0x8d, 0x04, 0x31]); // lea rax, [rcx+rsi]
         assert_eq!(leas[1], [0x48, 0x8d, 0x04, 0x31]);
         assert_eq!(leas[2], [0x49, 0x8d, 0x04, 0x31]); // [r9+rsi]
@@ -198,7 +237,7 @@ mod tests {
         assert_eq!(leas[5], [0x4b, 0x8d, 0x04, 0x02]); // [r10+r8]
         // Each window: the store follows the record's load and is followed
         // by a movzx and the cmp that sets the flags.
-        for s in &SITES {
+        for s in &SITES[..6] {
             let after = &s.bytes[s.store + s.len..];
             let movzx = if after[0] == 0x0f { 0 } else { 1 };
             assert_eq!(&after[movzx..movzx + 2], &[0x0f, 0xb6]);
@@ -228,7 +267,7 @@ mod tests {
         use windows_sys::Win32::System::Memory::{MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE_READWRITE, VirtualAlloc};
         // mov to, from (64 bits)
         let mov = |to: u8, from: u8| [0x48 | (from >> 3) << 2 | (to >> 3), 0x89, 0xc0 | (from & 7) << 3 | (to & 7)];
-        for site in &SITES {
+        for site in &SITES[..6] {
             let store = &site.bytes[site.store..site.store + site.len];
             let lea = lea_of(store).unwrap();
             let base = lea[3] & 7 | (lea[0] & 1) << 3;
@@ -299,6 +338,51 @@ mod tests {
         }
     }
 
+    /// The copy of a table of four records, hooked, run: the four are stored
+    /// as before, their four slots and both chunks marked when the table is in
+    /// the heap; not marked below it or across its start.
+    #[test]
+    fn a_hooked_four_record_copy_marks_four_slots() {
+        use windows_sys::Win32::System::Memory::{MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE_READWRITE, VirtualAlloc};
+        let site = &SITES[6];
+        // fn(table: rcx, records: rdx): the window with rbx = table, r12 = records.
+        let mut code: Vec<u8> = vec![0x53, 0x41, 0x54]; // push rbx ; push r12
+        code.extend([0x48, 0x89, 0xcb, 0x49, 0x89, 0xd4]); // mov rbx, rcx ; mov r12, rdx
+        let at = code.len();
+        code.extend(site.bytes);
+        code.extend([0x41, 0x5c, 0x5b, 0xc5, 0xf8, 0x77, 0xc3]); // pop r12 ; pop rbx ; vzeroupper ; ret
+        type F = unsafe extern "system" fn(*mut u8, *const u8);
+        // SAFETY: fresh memory for code and data, changed before it runs.
+        unsafe {
+            let place = VirtualAlloc(std::ptr::null(), 0x10000, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE) as usize;
+            assert_ne!(place, 0);
+            std::ptr::copy_nonoverlapping(code.as_ptr(), (place + 0x1100 - at) as *mut u8, code.len());
+            let heap = VirtualAlloc(std::ptr::null(), 0x10000, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE) as *mut u8;
+            let (mut slots, mut chunks) = (vec![0u8; 0x8000 / 32], vec![0u8; 0x8000 / 32 / 128]);
+            let marks = Box::new(Marks { start: heap as u64 + 0x2000, len: 0x8000, slots: slots.as_mut_ptr(), chunks: chunks.as_mut_ptr() });
+            let mine = [Site { window: 0x1100, ..*site }];
+            assert_eq!(apply(place, 0x10000, &raw const *marks as usize, &mine), [Hooked::Done]);
+            let copy: F = std::mem::transmute(place + 0x1100 - at);
+            let records: [u8; 128] = std::array::from_fn(|k| k as u8 ^ 0xa5);
+            // Slots 126-129 of the heap: across chunks 0 and 1.
+            let table = heap.add(0x2000 + 126 * 32);
+            copy(table, records.as_ptr());
+            assert_eq!(std::slice::from_raw_parts(table, 128), &records);
+            assert_eq!(&slots[126..130], &[1, 1, 1, 1]);
+            assert_eq!(slots.iter().filter(|&&b| b != 0).count(), 4);
+            assert_eq!(chunks[..2], [1, 1]);
+            // Below the heap, and across its start: stored, not marked.
+            for below in [0x1000, 0x2000 - 0x40] {
+                slots.fill(0);
+                chunks.fill(0);
+                copy(heap.add(below), records.as_ptr());
+                assert_eq!(std::slice::from_raw_parts(heap.add(below), 128), &records);
+                assert!(slots.iter().chain(&chunks).all(|&b| b == 0));
+            }
+            drop(marks);
+        }
+    }
+
     #[test]
     fn other_bytes_are_left_alone() {
         use windows_sys::Win32::System::Memory::{MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE_READWRITE, VirtualAlloc};
**@⁠Arvi23** on GitHub · 2026-11-26 16:31 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/122#issuecomment-7197754223) **Follow-up: the store form `descriptor_sites` missed is the copy of a whole table of four records. Patched as a seventh site, the records port 2 misses drop from ~136 to ~6 a frame here.** Same machine as my comment above (RX 9070 XT, Windows 10 LTSC, `c9c932c` + local patches), same place on the water, renderer ports 1, 2, 6 and 7. **Where.** The writer I named, `+0x4d9f25f`, is in a function at `+0x4d9f200`. It takes a table of `r14` bytes from the frame allocator (`call +0x4d9f3e0`). For a 128-byte table (`cmp r14, 80h`) it copies four records with four loads from `[r12]` and four stores that have a displacement: ``` +0x4d9f25f c5 fc 11 5b 60 vmovups [rbx+60h], ymm3 +0x4d9f264 c5 fc 11 53 40 vmovups [rbx+40h], ymm2 +0x4d9f269 c5 fc 11 4b 20 vmovups [rbx+20h], ymm1 +0x4d9f26e c5 fc 11 03 vmovups [rbx], ymm0 +0x4d9f272 4c 89 f9 mov rcx, r15 ; also the target of the other path's jmp ... 45 31 c9 xor r9d, r9d ; sets the flags before any use ``` Any other size goes to `call +0x5f40560`, which is `jmp [IAT memcpy]` and is already wrapped by `port_descriptors::import`. So only the 128-byte path was uncovered. **Patch.** The 19 bytes of the four stores become one jump to a stub. The stub does the four stores unchanged, then `lea rax, [rbx+60h]` and the usual bounds check against the heap, and marks the four slots (`mov dword [slots+last-3], 01010101h`) plus the chunks of the first and last slot. A table that lies below the heap or across its start is not marked (`cmp rax, 60h ; jb`). The flags are dead there (the `xor` sets them), and the window is byte-checked like the other six. The jump back lands on `+0x4d9f272`, which is unchanged. There's a test that runs the hooked window: records stored, four slots and both chunks marked across a chunk boundary, nothing marked outside the heap. **Port 2's own counters, per frame, before → after:** | | 6 sites | 7 sites | |---|---|---| | view records no store told of (fallback) | ~136 | 6.3 | | changed heap pages the sync looked at | 180.8 | 16.0 | | slots looked at | 370,304 | 104,579 | | submit lane's wait for the heaps' records (port 7 line) | 15–23 ms | 12.7 ms | | submit lane's work (`VICTORY_ASYNC_SUBMIT` line) | 62 ms | 57.5 ms | The rest of the misses are attributed mostly to `+0x18849c` and `+0x4e9b4e2`, the allocator's own bookkeeping in the same 64 KiB blocks, plus a few non-title writers, so they're probably not view records written behind port 2's back. The opening cutscene now reaches ~21 fps here at times. This should also cover z395977743's indoor numbers above (hundreds of unmarked records with 6/6 sites). <details><summary>Diff (on c9c932c)</summary> ```diff diff --git a/crates/victory-gpu/src/port_descriptors.rs b/crates/victory-gpu/src/port_descriptors.rs index c3349de..8f12f50 100644 --- a/crates/victory-gpu/src/port_descriptors.rs +++ b/crates/victory-gpu/src/port_descriptors.rs @@ -15,7 +15,7 @@ //! with the one last seen (~290 pages, ~600,000 slots, 15-16 ms a frame of //! the heap-sync thread, 5-7 of it asking the watch, run port1-3). //! -//! What is done here: the six stores are patched (`descriptor_sites`) to set +//! What is done here: the seven stores are patched (`descriptor_sites`) to set //! a byte per slot and per 128 slots in maps of ours ([`MARKS`]), and our own //! mirroring marks too; `descriptor::sync_heaps` takes the marked slots //! ([`take`]) in place of the changed pages, and compares and makes only diff --git a/crates/victory-loader/src/descriptor_sites.rs b/crates/victory-loader/src/descriptor_sites.rs index 918fcaa..ac06897 100644 --- a/crates/victory-loader/src/descriptor_sites.rs +++ b/crates/victory-loader/src/descriptor_sites.rs @@ -11,7 +11,9 @@ //! [record]`, `vmovups [table + r], ymm0`. Found with `dumpbin /disasm` from //! the write faults of run faults-6 (book records "the instruction at a made //! the fault"); a search of all of `.text` for the same instruction shape -//! finds these six stores and no other. +//! finds these six stores and no other. A seventh site, the copy of a whole +//! table of four records (+0x4d9f200), stores with a displacement: hooked as +//! one ([`FOUR`]). //! //! Each store becomes a jump to code of ours that does the store, then, if //! the address lies in the heap `victory-gpu` names in [`Marks`], sets the @@ -38,9 +40,10 @@ pub struct Site { pub bytes: &'static [u8], } -/// The six record stores of the table fillers (game_scarlett_master.exe +/// The six record stores of the table fillers and the copy of a table of +/// four records (game_scarlett_master.exe /// 1.0.2.1, image offsets). -pub const SITES: [Site; 6] = [ +pub const SITES: [Site; 7] = [ // +0x4d9efd0, loop 1: [rcx+rsi] Site { window: 0x4d9f04f, store: 10, len: 5, bytes: &[0x81, 0xe1, 0xe0, 0x7f, 0x00, 0x00, 0xc5, 0xfc, 0x10, 0x00, 0xc5, 0xfc, 0x11, 0x04, 0x31, 0x0f, 0xb6, 0x47, 0x0b, 0x39, 0xc5] }, // loop 2: [rcx+rsi] @@ -53,8 +56,18 @@ pub const SITES: [Site; 6] = [ Site { window: 0x4eeca08, store: 10, len: 6, bytes: &[0x81, 0xe7, 0xe0, 0x7f, 0x00, 0x00, 0xc5, 0xfc, 0x10, 0x06, 0xc4, 0xa1, 0x7c, 0x11, 0x04, 0x07, 0x0f, 0xb6, 0x72, 0x0d, 0x39, 0xf0] }, // loop 3: [r10+r8] Site { window: 0x4eeca82, store: 11, len: 6, bytes: &[0x41, 0x81, 0xe2, 0xe0, 0x7f, 0x00, 0x00, 0xc5, 0xfc, 0x10, 0x00, 0xc4, 0x81, 0x7c, 0x11, 0x04, 0x02, 0x0f, 0xb6, 0x42, 0x0f, 0x41, 0x39, 0xc6] }, + // +0x4d9f200, a table of 128 bytes copied whole into one of the + // allocator's (other sizes call `memcpy`, wrapped in `victory-gpu`): the + // four loads from [r12], then the four stores [`FOUR`], then three `mov`s + // and the `xor` that sets the flags. Missed before: ~136 view records a + // frame left to the fallback, distant trees shown in 1 frame of 5. + Site { window: 0x4d9f244, store: 27, len: 19, bytes: &[0xc4, 0xc1, 0x7c, 0x10, 0x04, 0x24, 0xc4, 0xc1, 0x7c, 0x10, 0x4c, 0x24, 0x20, 0xc4, 0xc1, 0x7c, 0x10, 0x54, 0x24, 0x40, 0xc4, 0xc1, 0x7c, 0x10, 0x5c, 0x24, 0x60, 0xc5, 0xfc, 0x11, 0x5b, 0x60, 0xc5, 0xfc, 0x11, 0x53, 0x40, 0xc5, 0xfc, 0x11, 0x4b, 0x20, 0xc5, 0xfc, 0x11, 0x03, 0x4c, 0x89, 0xf9, 0x48, 0x89, 0xf2, 0x49, 0x89, 0xd8, 0x45, 0x31, 0xc9] }, ]; +/// `vmovups [rbx+60h], ymm3` .. `vmovups [rbx], ymm0`: four records stored +/// at once, hooked as one. +const FOUR: [u8; 19] = [0xc5, 0xfc, 0x11, 0x5b, 0x60, 0xc5, 0xfc, 0x11, 0x53, 0x40, 0xc5, 0xfc, 0x11, 0x4b, 0x20, 0xc5, 0xfc, 0x11, 0x03]; + /// `lea rax, [base+index]` for a `vmovups [base+index], ymm0` (VEX, ModRM /// 04h with a SIB byte, no displacement, the stack pointer not its base): /// `None` for another form. @@ -84,7 +97,12 @@ fn lea_of(store: &[u8]) -> Option<[u8; 4]> { /// The code at `to` for the store `store` at `at`: the store, the marks, back /// to `at + store.len()`. fn stub(store: &[u8], at: usize, to: usize, marks: usize) -> Option<Vec<u8>> { - let lea = lea_of(store)?; + // The (last) record's address, and whether four end there. + let (lea, four) = match lea_of(store) { + Some(lea) => (lea, false), + None if store == FOUR => ([0x48, 0x8d, 0x43, 0x60], true), // lea rax, [rbx+60h] + None => return None, + }; let mut out = store.to_vec(); out.push(0x50); // push rax out.extend(lea); // lea rax, [base+index] @@ -93,13 +111,34 @@ fn stub(store: &[u8], at: usize, to: usize, marks: usize) -> Option<Vec<u8>> { out.extend((marks as u64).to_le_bytes()); out.extend([0x48, 0x2b, 0x02]); // sub rax, [rdx] out.extend([0x48, 0x3b, 0x42, 0x08]); // cmp rax, [rdx+8] - out.extend([0x73, 0x18]); // jae past the marks - out.extend([0x48, 0xc1, 0xe8, 0x05]); // shr rax, 5: the slot - out.extend([0x48, 0x8b, 0x4a, 0x10]); // mov rcx, [rdx+16] - out.extend([0xc6, 0x04, 0x01, 0x01]); // mov byte [rcx+rax], 1 - out.extend([0x48, 0xc1, 0xe8, 0x07]); // shr rax, 7: the chunk - out.extend([0x48, 0x8b, 0x4a, 0x18]); // mov rcx, [rdx+24] - out.extend([0xc6, 0x04, 0x01, 0x01]); // mov byte [rcx+rax], 1 + let body: &[u8] = if four { + // A table is on 32 bytes, so its four records are four slots. + &[ + 0x48, 0xc1, 0xe8, 0x05, // shr rax, 5: the last slot + 0x48, 0x8b, 0x4a, 0x10, // mov rcx, [rdx+16] + 0xc7, 0x44, 0x01, 0xfd, 0x01, 0x01, 0x01, 0x01, // mov dword [rcx+rax-3], 01010101h + 0x48, 0x8b, 0x4a, 0x18, // mov rcx, [rdx+24] + 0x48, 0x8d, 0x50, 0xfd, // lea rdx, [rax-3]: the first slot + 0x48, 0xc1, 0xea, 0x07, // shr rdx, 7: its chunk + 0xc6, 0x04, 0x11, 0x01, // mov byte [rcx+rdx], 1 + 0x48, 0xc1, 0xe8, 0x07, // shr rax, 7: the last's chunk + 0xc6, 0x04, 0x01, 0x01, // mov byte [rcx+rax], 1 + ] + } else { + &[ + 0x48, 0xc1, 0xe8, 0x05, // shr rax, 5: the slot + 0x48, 0x8b, 0x4a, 0x10, // mov rcx, [rdx+16] + 0xc6, 0x04, 0x01, 0x01, // mov byte [rcx+rax], 1 + 0x48, 0xc1, 0xe8, 0x07, // shr rax, 7: the chunk + 0x48, 0x8b, 0x4a, 0x18, // mov rcx, [rdx+24] + 0xc6, 0x04, 0x01, 0x01, // mov byte [rcx+rax], 1 + ] + }; + // Four: the first record in the heap too (cmp rax, 60h ; jb past). + let first: &[u8] = if four { &[0x48, 0x83, 0xf8, 0x60, 0x72, body.len() as u8] } else { &[] }; + out.extend([0x73, (first.len() + body.len()) as u8]); // jae past the marks + out.extend(first); + out.extend(body); out.extend([0x59, 0x5a, 0x58]); // pop rcx ; pop rdx ; pop rax let back = crate::console_insn::jump(to + out.len(), at + store.len())?; out.extend(back); @@ -189,7 +228,7 @@ mod tests { #[test] fn the_sites_lea_their_stores_address() { - let leas: Vec<[u8; 4]> = SITES.iter().map(|s| lea_of(&s.bytes[s.store..s.store + s.len]).unwrap()).collect(); + let leas: Vec<[u8; 4]> = SITES[..6].iter().map(|s| lea_of(&s.bytes[s.store..s.store + s.len]).unwrap()).collect(); assert_eq!(leas[0], [0x48, 0x8d, 0x04, 0x31]); // lea rax, [rcx+rsi] assert_eq!(leas[1], [0x48, 0x8d, 0x04, 0x31]); assert_eq!(leas[2], [0x49, 0x8d, 0x04, 0x31]); // [r9+rsi] @@ -198,7 +237,7 @@ mod tests { assert_eq!(leas[5], [0x4b, 0x8d, 0x04, 0x02]); // [r10+r8] // Each window: the store follows the record's load and is followed // by a movzx and the cmp that sets the flags. - for s in &SITES { + for s in &SITES[..6] { let after = &s.bytes[s.store + s.len..]; let movzx = if after[0] == 0x0f { 0 } else { 1 }; assert_eq!(&after[movzx..movzx + 2], &[0x0f, 0xb6]); @@ -228,7 +267,7 @@ mod tests { use windows_sys::Win32::System::Memory::{MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE_READWRITE, VirtualAlloc}; // mov to, from (64 bits) let mov = |to: u8, from: u8| [0x48 | (from >> 3) << 2 | (to >> 3), 0x89, 0xc0 | (from & 7) << 3 | (to & 7)]; - for site in &SITES { + for site in &SITES[..6] { let store = &site.bytes[site.store..site.store + site.len]; let lea = lea_of(store).unwrap(); let base = lea[3] & 7 | (lea[0] & 1) << 3; @@ -299,6 +338,51 @@ mod tests { } } + /// The copy of a table of four records, hooked, run: the four are stored + /// as before, their four slots and both chunks marked when the table is in + /// the heap; not marked below it or across its start. + #[test] + fn a_hooked_four_record_copy_marks_four_slots() { + use windows_sys::Win32::System::Memory::{MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE_READWRITE, VirtualAlloc}; + let site = &SITES[6]; + // fn(table: rcx, records: rdx): the window with rbx = table, r12 = records. + let mut code: Vec<u8> = vec![0x53, 0x41, 0x54]; // push rbx ; push r12 + code.extend([0x48, 0x89, 0xcb, 0x49, 0x89, 0xd4]); // mov rbx, rcx ; mov r12, rdx + let at = code.len(); + code.extend(site.bytes); + code.extend([0x41, 0x5c, 0x5b, 0xc5, 0xf8, 0x77, 0xc3]); // pop r12 ; pop rbx ; vzeroupper ; ret + type F = unsafe extern "system" fn(*mut u8, *const u8); + // SAFETY: fresh memory for code and data, changed before it runs. + unsafe { + let place = VirtualAlloc(std::ptr::null(), 0x10000, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE) as usize; + assert_ne!(place, 0); + std::ptr::copy_nonoverlapping(code.as_ptr(), (place + 0x1100 - at) as *mut u8, code.len()); + let heap = VirtualAlloc(std::ptr::null(), 0x10000, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE) as *mut u8; + let (mut slots, mut chunks) = (vec![0u8; 0x8000 / 32], vec![0u8; 0x8000 / 32 / 128]); + let marks = Box::new(Marks { start: heap as u64 + 0x2000, len: 0x8000, slots: slots.as_mut_ptr(), chunks: chunks.as_mut_ptr() }); + let mine = [Site { window: 0x1100, ..*site }]; + assert_eq!(apply(place, 0x10000, &raw const *marks as usize, &mine), [Hooked::Done]); + let copy: F = std::mem::transmute(place + 0x1100 - at); + let records: [u8; 128] = std::array::from_fn(|k| k as u8 ^ 0xa5); + // Slots 126-129 of the heap: across chunks 0 and 1. + let table = heap.add(0x2000 + 126 * 32); + copy(table, records.as_ptr()); + assert_eq!(std::slice::from_raw_parts(table, 128), &records); + assert_eq!(&slots[126..130], &[1, 1, 1, 1]); + assert_eq!(slots.iter().filter(|&&b| b != 0).count(), 4); + assert_eq!(chunks[..2], [1, 1]); + // Below the heap, and across its start: stored, not marked. + for below in [0x1000, 0x2000 - 0x40] { + slots.fill(0); + chunks.fill(0); + copy(heap.add(below), records.as_ptr()); + assert_eq!(std::slice::from_raw_parts(heap.add(below), 128), &records); + assert!(slots.iter().chain(&chunks).all(|&b| b == 0)); + } + drop(marks); + } + } + #[test] fn other_bytes_are_left_alone() { use windows_sys::Win32::System::Memory::{MEM_COMMIT, MEM_RESERVE, PAGE_EXECUTE_READWRITE, VirtualAlloc}; ``` </details>
Author
Owner

@⁠Jrjy3 on GitHub · 2026-11-26 19:43 UTC · original · edited 2026-11-26 19:47 UTC

Edited (correction): with -RayTracing the near trees are steady, but distant trees still pop in and out of existence (whole trees, not their lighting). So ray tracing does not fix the flicker. It changes which trees flicker, and that points at distance (level of detail or culling) rather than light. The original text below said "steady" and was wrong about the distant ones.

Renderer port 2 is not the cause of the tree flicker here, and ray tracing only moves it further away.

Radeon AI PRO R9700 (RDNA 4), driver 32.0.32015.2008, Windows 11 26300. Release build of main c9c932c + #55 (with its faces fix) + Belobug 5d6bd84. play.ps1 settings with renderer ports 1, 5, 6 and 7, VICTORY_OUTPUT=2560x1440, VICTORY_CARD_STEPS=1. The same spot on the water, trees against the sky, judged by eye, one session each:

Run Trees
ports 1, 2, 5, 6, 7 flicker (whole trees in and out)
port 2 off (VICTORY_PORT_DESCRIPTORS=0) still flicker
Belobug 5d6bd84 (textures uploaded in the submission prelude) still flicker (less flicker in the indoor cutscene)
the same + -RayTracing near trees steady, distant trees still flicker

So on this machine the missed store sites from the comments above are not what makes the trees flicker. Arvi23's fix may well be right for the RX 9070 XT, and the two may be separate faults with the same look.

What -RayTracing changes is that the structure builder runs (pipeline::builder_runs). The pop watch above found whole trees present in 1 frame of 5, and with the builder on only the far ones still do. So my guess is that the title's level-of-detail or culling of vegetation is what goes wrong at a distance, and that the builder's passes happen to feed the near range. That is a guess, not traced. A VICTORY_POP_WATCH run at the same spot, with and without VICTORY_BVH_BUILDER=1, would show whether the draws that come and go are the far LODs.

By the way, port 2 off was also faster here (43.5 against 47.0 ms at the same spot and draw count) and hitched less.

AI-assisted (Claude Code).

**@⁠Jrjy3** on GitHub · 2026-11-26 19:43 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/122#issuecomment-7201901670) · edited 2026-11-26 19:47 UTC **Edited (correction):** with `-RayTracing` the **near** trees are steady, but distant trees still pop in and out of existence (whole trees, not their lighting). So ray tracing does not fix the flicker. It changes which trees flicker, and that points at distance (level of detail or culling) rather than light. The original text below said "steady" and was wrong about the distant ones. **Renderer port 2 is not the cause of the tree flicker here, and ray tracing only moves it further away.** Radeon AI PRO R9700 (RDNA 4), driver 32.0.32015.2008, Windows 11 26300. Release build of main `c9c932c` + #55 (with its faces fix) + Belobug `5d6bd84`. `play.ps1` settings with renderer ports 1, 5, 6 and 7, `VICTORY_OUTPUT=2560x1440`, `VICTORY_CARD_STEPS=1`. The same spot on the water, trees against the sky, judged by eye, one session each: | Run | Trees | |---|---| | ports 1, 2, 5, 6, 7 | flicker (whole trees in and out) | | port 2 off (`VICTORY_PORT_DESCRIPTORS=0`) | **still flicker** | | Belobug `5d6bd84` (textures uploaded in the submission prelude) | still flicker (less flicker in the indoor cutscene) | | the same + `-RayTracing` | near trees steady, **distant trees still flicker** | So on this machine the missed store sites from the comments above are not what makes the trees flicker. Arvi23's fix may well be right for the RX 9070 XT, and the two may be separate faults with the same look. What `-RayTracing` changes is that the structure builder runs (`pipeline::builder_runs`). The pop watch above found whole trees present in 1 frame of 5, and with the builder on only the far ones still do. So my guess is that the title's level-of-detail or culling of vegetation is what goes wrong at a distance, and that the builder's passes happen to feed the near range. That is a guess, not traced. A `VICTORY_POP_WATCH` run at the same spot, with and without `VICTORY_BVH_BUILDER=1`, would show whether the draws that come and go are the far LODs. By the way, port 2 off was also faster here (43.5 against 47.0 ms at the same spot and draw count) and hitched less. AI-assisted (Claude Code).
Author
Owner

@⁠Arvi23 on GitHub · 2026-11-26 19:55 UTC · original

Thanks, that's a better lead than mine. Agreed, the missed store sites and the flicker look like separate faults. The seventh site took the missed records from ~136 to ~6 a frame here, but the trees still flicker with it.

What this RX 9070 XT showed, all at the same spot on the water, ports 1 and 2 only (no 5, 6 or 7): with port 1 alone, only the farthest trees flickered, and adding port 2 (six or seven sites) brought the flicker back. So here port 2 does make it worse, unlike on your card, which fits a timing fault more than a single missed write. Ports 6 and 7, flipped live on top, made it worse at times (6 more than 7).

Our log also shows the builder's passes dropped every frame without -RayTracing ("a stage of the ray-tracing structure builder, which is off"), which fits your guess that the near range depends on them. I'll try the run you describe: VICTORY_POP_WATCH at the same spot with and without VICTORY_BVH_BUILDER=1, to see whether the draws that come and go are the far LODs.

**@⁠Arvi23** on GitHub · 2026-11-26 19:55 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/122#issuecomment-7202101008) Thanks, that's a better lead than mine. Agreed, the missed store sites and the flicker look like separate faults. The seventh site took the missed records from ~136 to ~6 a frame here, but the trees still flicker with it. What this RX 9070 XT showed, all at the same spot on the water, ports 1 and 2 only (no 5, 6 or 7): with port 1 alone, only the farthest trees flickered, and adding port 2 (six or seven sites) brought the flicker back. So here port 2 does make it worse, unlike on your card, which fits a timing fault more than a single missed write. Ports 6 and 7, flipped live on top, made it worse at times (6 more than 7). Our log also shows the builder's passes dropped every frame without `-RayTracing` ("a stage of the ray-tracing structure builder, which is off"), which fits your guess that the near range depends on them. I'll try the run you describe: `VICTORY_POP_WATCH` at the same spot with and without `VICTORY_BVH_BUILDER=1`, to see whether the draws that come and go are the far LODs.
Author
Owner

@⁠Arvi23 on GitHub · 2026-11-26 21:30 UTC · original

Follow-up on the -RayTracing lead: on this card it doesn't steady the trees.

RX 9070 XT, Windows 10 LTSC, c9c932c plus local patches (port 2 with the seventh site, Belobug 5d6bd84, card buffers from 64 KiB), diag build, Series X, 4K output (no FSR), ports 1 and 2. Same spot on the water.

With -RayTracing the structure builder runs (the ray-tracing structure builder runs: all of its programs have host pipelines pipelines=53, and no more "which is off" drops). Lighting, eyes and glasses look right. But the trees still flicker, near ones included. So here the near range doesn't depend on the builder's passes, unlike on your R9700. Cost: busy frames went from 49 to 78 ms (median). That was the first run with cold ray-tracing pipelines, so it reads a bit high.

The run with the builder has VICTORY_POP_WATCH logged. I still owe the same spot without it for the comparison.

**@⁠Arvi23** on GitHub · 2026-11-26 21:30 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/122#issuecomment-7203793797) Follow-up on the `-RayTracing` lead: on this card it doesn't steady the trees. RX 9070 XT, Windows 10 LTSC, `c9c932c` plus local patches (port 2 with the seventh site, Belobug `5d6bd84`, card buffers from 64 KiB), diag build, Series X, 4K output (no FSR), ports 1 and 2. Same spot on the water. With `-RayTracing` the structure builder runs (`the ray-tracing structure builder runs: all of its programs have host pipelines pipelines=53`, and no more "which is off" drops). Lighting, eyes and glasses look right. But the trees still flicker, near ones included. So here the near range doesn't depend on the builder's passes, unlike on your R9700. Cost: busy frames went from 49 to 78 ms (median). That was the first run with cold ray-tracing pipelines, so it reads a bit high. The run with the builder has `VICTORY_POP_WATCH` logged. I still owe the same spot without it for the comparison.
Author
Owner

@⁠Arvi23 on GitHub · 2026-11-26 21:37 UTC · original

The pop-watch comparison I owed. Same build and settings as above (RX 9070 XT, 4K output, no FSR, ports 1 and 2), VICTORY_POP_WATCH=150-400, on the water from 2:30 on, the builder on and off:

builder on (-RayTracing) builder off
frames watched 1,751 1,146
frames with blips 282 (16 %) 149 (13 %)
blip blocks (16×16) per frame 0.74 0.35
lone blocks per frame 2.46 2.19

So with the builder running the picture blinks no less here, if anything more. It's not a clean A/B: the stretches of play differ (2:30–5:28 against 2:30–4:28, at different frame rates), and ray-traced lighting changes more from frame to frame anyway. These counts also cover every blinking block, not only trees. Together with the eye test, though, the near trees on this card don't seem to depend on the builder's passes. To pin the blips on trees I'd need VICTORY_POP_ALL with saved frames at the same spot.

**@⁠Arvi23** on GitHub · 2026-11-26 21:37 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/122#issuecomment-7203899377) The pop-watch comparison I owed. Same build and settings as above (RX 9070 XT, 4K output, no FSR, ports 1 and 2), `VICTORY_POP_WATCH=150-400`, on the water from 2:30 on, the builder on and off: | | builder on (`-RayTracing`) | builder off | |---|---|---| | frames watched | 1,751 | 1,146 | | frames with blips | 282 (16 %) | 149 (13 %) | | blip blocks (16×16) per frame | 0.74 | 0.35 | | lone blocks per frame | 2.46 | 2.19 | So with the builder running the picture blinks no less here, if anything more. It's not a clean A/B: the stretches of play differ (2:30–5:28 against 2:30–4:28, at different frame rates), and ray-traced lighting changes more from frame to frame anyway. These counts also cover every blinking block, not only trees. Together with the eye test, though, the near trees on this card don't seem to depend on the builder's passes. To pin the blips on trees I'd need `VICTORY_POP_ALL` with saved frames at the same spot.
Author
Owner

@⁠remembering7896 on GitHub · 2026-11-27 01:45 UTC · original

Follow-up from me (@⁠remembering7896), on the same RX 7900 XTX / 9800X3D / 32 GB / Windows 11 26300 box.
Build: main @ 014d52d, diag + diagnostics. All runs = scripts\play.ps1 default switches + the named extras, Series S profile. Single runs of a few minutes; the title resumes its save, so scenes differ between runs — treat the differences as a hint, not a controlled A/B.

1) Pop-watch on a trees/land spot (this reproduces the flicker)

-More @{VICTORY_POP_WATCH='5-600'; VICTORY_POP_FOLDER='...\popland'} (no POP_ALL; blip frames saved)
Final: 4102 frames — blips in 357 (1150 blip blocks of 16×16), 1978 frames with 234 blocks stepped, lone blocks in 1204 frames (3770 blocks), ~15 fps, 335 blip pictures saved.

Looking at a consecutive world run (frames 2403–2408): a distant house with a lit window pops into existence at frame 2406 where the previous frame had only dark foliage; distant trees and power poles appear/vanish abruptly rather than streaming in. So at this spot the flicker is whole distant objects coming and going (LOD / culling class) — not untextured grey cards, and no floating geometry here. That reads like a distance/LOD issue rather than the missed descriptor-store sites in #353-style fixes (Jrjy3 / Arvi23 comments); on my machine they look separate.

2) BVH-builder A/B (per @⁠Jrjy3), window 180-480

run switches frames blips stepped blocks lone fps
A default (builder off) 650 0 4 5 ~17
B VICTORY_BVH_BUILDER=1 985 5 8 3 ~12

Turning the structure builder on did not steady the picture here (if anything marginally more blips) and cost ~5 fps — consistent with the near range not depending on the builder's passes on this card. Caveat: this window caught few blips (flicker is intermittent/place-dependent); the 5-600 land run above caught many.

3) Capture + render-target dump at world entry (per @⁠jtrudeau1530)

-More @{VICTORY_CAPTURE='...\capture'; VICTORY_CAPTURE_WORLD='1'; VICTORY_DUMP_TARGETS='1'}
World entry = first frame of ≥500 draws = frame 1056 at t=47.4 s; saved 109 window frames + 1077 per-resource PNG dumps (dumps concentrated on frames 1058/1062/1086/1136; 2560×1440, 1280×720, 256×256 …).
The octahedral-imposter pack is loaded around entry: data/ttdb/props/octa_imposters.ttpf (iid 43704f9f-27c6-4a9f-8815-d16527894df4) via DirectStorage. World-entry pixel-shader hashes include a1f08b8b7d514a39 and 6992feba843e3b84. Happy to attach the frame-1058/1136 dumps — which imposter PS hash should I be matching the floating rooftop props against?

Questions

  1. Is a "waiting" texture count of ~10k normal for this title on this fork? Under myokex/victory-amd on the same machine I saw a near-zero queue (327 waiting) — is queue order / the re-look interval / the cf9ba08 64 KiB pool change holding textures in waiting too long?
  2. Is VICTORY_TEXTURE_SWEEP=0 safe on a 24 GB card, or does it just defer the churn into VRAM pressure? (It didn't help the queue in my heavy run.)
  3. Do the texture picked by index changed after its upload with nothing to tell of it warnings (122 / 28 / 30 per run) share the mechanism that makes a newly streamed texture appear a few frames late?
  4. For a 32 GB machine, any switch that trades speed for robustness while private footprint is 40-46 GB, or is "64 GB RAM" the only answer?
  5. Given (1) that the flicker here is whole distant objects popping (LOD/culling class, not grey cards): is vegetation / distant-building LOD or culling a known gap, separate from the descriptor-store issue Arvi23 patched?

Logs (popwatch-off, popwatch-rt, popall-land, capture-intro), the 335 blip PNGs and the 1077 dumps are on request.

victory-7900xtx-issue122-pack.zip

**@⁠remembering7896** on GitHub · 2026-11-27 01:45 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/122#issuecomment-7207548948) Follow-up from me (@⁠remembering7896), on the same RX 7900 XTX / 9800X3D / 32 GB / Windows 11 26300 box. Build: `main @ 014d52d`, diag + diagnostics. All runs = `scripts\play.ps1` **default** switches + the named extras, Series S profile. Single runs of a few minutes; the title resumes its save, so scenes differ between runs — treat the differences as a hint, not a controlled A/B. ### 1) Pop-watch on a trees/land spot (this reproduces the flicker) `-More @{VICTORY_POP_WATCH='5-600'; VICTORY_POP_FOLDER='...\popland'}` (no POP_ALL; blip frames saved) Final: **4102 frames — blips in 357 (1150 blip blocks of 16×16), 1978 frames with 234 blocks stepped, lone blocks in 1204 frames (3770 blocks)**, ~15 fps, 335 blip pictures saved. Looking at a consecutive world run (frames 2403–2408): a distant house with a lit window **pops into existence at frame 2406** where the previous frame had only dark foliage; distant trees and power poles **appear/vanish abruptly rather than streaming in**. So at this spot the flicker is **whole distant objects coming and going (LOD / culling class)** — **not** untextured grey cards, and no floating geometry here. That reads like a distance/LOD issue rather than the missed descriptor-store sites in #353-style fixes (Jrjy3 / Arvi23 comments); on my machine they look separate. ### 2) BVH-builder A/B (per @⁠Jrjy3), window `180-480` | run | switches | frames | blips | stepped blocks | lone | fps | |---|---|---|---|---|---|---| | A | default (builder off) | 650 | **0** | 4 | 5 | ~17 | | B | `VICTORY_BVH_BUILDER=1` | 985 | **5** | 8 | 3 | ~12 | Turning the structure builder on **did not steady the picture** here (if anything marginally more blips) and cost ~5 fps — consistent with the near range not depending on the builder's passes on this card. Caveat: this window caught few blips (flicker is intermittent/place-dependent); the `5-600` land run above caught many. ### 3) Capture + render-target dump at world entry (per @⁠jtrudeau1530) `-More @{VICTORY_CAPTURE='...\capture'; VICTORY_CAPTURE_WORLD='1'; VICTORY_DUMP_TARGETS='1'}` World entry = first frame of ≥500 draws = **frame 1056 at t=47.4 s**; saved **109 window frames + 1077 per-resource PNG dumps** (dumps concentrated on frames 1058/1062/1086/1136; 2560×1440, 1280×720, 256×256 …). The octahedral-imposter pack is loaded around entry: **`data/ttdb/props/octa_imposters.ttpf`** (iid `43704f9f-27c6-4a9f-8815-d16527894df4`) via DirectStorage. World-entry pixel-shader hashes include **`a1f08b8b7d514a39`** and **`6992feba843e3b84`**. Happy to attach the frame-1058/1136 dumps — which imposter PS hash should I be matching the floating rooftop props against? ### Questions 1. Is a "waiting" texture count of ~10k normal for this title on this fork? Under `myokex/victory-amd` on the same machine I saw a near-zero queue (327 waiting) — is queue order / the re-look interval / the `cf9ba08` 64 KiB pool change holding textures in waiting too long? 2. Is `VICTORY_TEXTURE_SWEEP=0` safe on a 24 GB card, or does it just defer the churn into VRAM pressure? (It didn't help the queue in my heavy run.) 3. Do the `texture picked by index changed after its upload with nothing to tell of it` warnings (122 / 28 / 30 per run) share the mechanism that makes a newly streamed texture appear a few frames late? 4. For a 32 GB machine, any switch that trades speed for robustness while private footprint is 40-46 GB, or is "64 GB RAM" the only answer? 5. Given (1) that the flicker here is whole distant objects popping (LOD/culling class, not grey cards): is vegetation / distant-building LOD or culling a known gap, separate from the descriptor-store issue Arvi23 patched? Logs (popwatch-off, popwatch-rt, popall-land, capture-intro), the 335 blip PNGs and the 1077 dumps are on request. [victory-7900xtx-issue122-pack.zip](https://github.com/user-attachments/files/35490287/victory-7900xtx-issue122-pack.zip)
Author
Owner

@⁠LloydNicholson on GitHub · 2026-11-27 05:34 UTC · original

A repeatable spot for the tree flicker, and what a 3-frame capture says about it (RX 9060 XT, Linux/Proton; same symptom as the Windows reports above)

Machine: RX 9060 XT 16 GB (RDNA 4), Ryzen 7 5700X, 32 GB, Linux with Proton (patched RADV). Build: this fork's main up to a9400a6 plus Linux patches, diag. Series X, 4K output. The flicker is the one described above: whole distant trees and palms present in some frames and gone in others, while the title asks for the same draws.

Repeatable spot. The "Just Like Paradise" title shot over the boat, right after the second skipped cutscene of the boat mission (about 2.5 min into a new game if you hold A through the cutscenes). The mangroves and palms behind the boat switch between a full set and a sparse set (a bare dead tree with sky through it) from one frame to the next, for the whole 3 s of the shot, every run. It reproduces in scripted runs with no input during the shot, so it is a good A/B spot.

Ruled out on that shot (each by eye on live runs and/or on 30 fps recordings, frame by frame):

  • VICTORY_RELAY=0 (+ RELAY_COPY=0)
  • all speed switches off at once: TOLD_HOLES=0 CARD_STEPS=0 CARD_REHASH_RUNS=0 JOIN_COPIES=0 JOIN_PARTS=1 WIDE_BACK=0 RELAY=0 RELAY_COPY=0 TEXTURE_NO_WAIT=0 KEEP_SHOWN=1 INDIRECT_WINDOW=0 PORT_CBV=0 PORT_GUARD=0
  • VICTORY_INDIRECT_BATCH=1 with VICTORY_INDIRECT_WINDOW=0 (renderer port 1 is off here, so the PORT_CONSTANTS_ORDER fix does not apply)
  • the CPU occlusion depth pyramid (depth_pyramid_cpu_occlusion 42683eebec081520, 1024x512 R32F, 10 mips): added to VICTORY_TEXTURE_BACK so it lands in title memory, and also forced to a constant 0.0 and 1.0 there: same flicker. Skipping the pyramid passes in a replay does not change the picture either, so the GPU culling does not read it.
  • the GPU timestamps the title reads (a claimed 60 ms load), lodScale 3.0
  • a fixed 1/30 s simulation step (the cap in +0x2226040 patched): still flickers, though the title shot kept its length, so the cutscene may run on another clock

What the frame recorder shows.

  • One captured sparse frame replayed 24 times comes out sparse 24 times (70+ dB to the recorded picture). Within a frame, the card's work is deterministic.
  • A 3-frame capture (VICTORY_RECORD_FRAMES=3) of the shot: frames 0 and 1 full, frame 2 sparse; the replay reproduces all three. The title issues the same draws, the same number per pipeline, in frames 1 and 2. The indirect records the culling writes are what differ. Work per pipeline (sum of the records' group counts) in frame 2 against frame 1: the trunk pipeline 903776ba469c8bac (MS_VS_TransformD) -44%, adc5c689b0552cc2 -38%, 89a622617919c92a -51%, 9d81dbdaa685de5f -36%, two smaller ones to 0; everything else within about 2%.
  • If frame 2's CPU-side copies (all of them) are left out of the replay, frame 2 comes out full. So whatever decides it reaches the culling through the data the title writes for the frame (camera and per-batch data). Leaving out only some buffers breaks the frame, so I have not isolated the field yet.
  • The tree culling (InstanceCulling:CS_Tree_BatchCull 55679a0547649d0b) gets the same 196 batches each frame, split between two dispatches differently each frame (98/98, 88/108, 105/91); root constant word 4 alternates between two blocks frame by frame, but pointing frame 2 at frame 1's block changes nothing.

So on this card it is not the relay, the indirect batching, the occlusion pyramid or any of the host shortcuts above. The culling is fed something different in the sparse frames. If someone has already decoded what CS_Tree_BatchCull reads per batch (LOD/fade fields in the batch records), that is where I'm looking next.

AI-assisted (Claude Code).

**@⁠LloydNicholson** on GitHub · 2026-11-27 05:34 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/122#issuecomment-7210746746) **A repeatable spot for the tree flicker, and what a 3-frame capture says about it (RX 9060 XT, Linux/Proton; same symptom as the Windows reports above)** Machine: RX 9060 XT 16 GB (RDNA 4), Ryzen 7 5700X, 32 GB, Linux with Proton (patched RADV). Build: this fork's main up to a9400a6 plus Linux patches, diag. Series X, 4K output. The flicker is the one described above: whole distant trees and palms present in some frames and gone in others, while the title asks for the same draws. **Repeatable spot.** The "Just Like Paradise" title shot over the boat, right after the second skipped cutscene of the boat mission (about 2.5 min into a new game if you hold A through the cutscenes). The mangroves and palms behind the boat switch between a full set and a sparse set (a bare dead tree with sky through it) from one frame to the next, for the whole 3 s of the shot, every run. It reproduces in scripted runs with no input during the shot, so it is a good A/B spot. **Ruled out on that shot** (each by eye on live runs and/or on 30 fps recordings, frame by frame): - `VICTORY_RELAY=0` (+ `RELAY_COPY=0`) - all speed switches off at once: `TOLD_HOLES=0 CARD_STEPS=0 CARD_REHASH_RUNS=0 JOIN_COPIES=0 JOIN_PARTS=1 WIDE_BACK=0 RELAY=0 RELAY_COPY=0 TEXTURE_NO_WAIT=0 KEEP_SHOWN=1 INDIRECT_WINDOW=0 PORT_CBV=0 PORT_GUARD=0` - `VICTORY_INDIRECT_BATCH=1` with `VICTORY_INDIRECT_WINDOW=0` (renderer port 1 is off here, so the `PORT_CONSTANTS_ORDER` fix does not apply) - the CPU occlusion depth pyramid (`depth_pyramid_cpu_occlusion` 42683eebec081520, 1024x512 R32F, 10 mips): added to `VICTORY_TEXTURE_BACK` so it lands in title memory, and also forced to a constant 0.0 and 1.0 there: same flicker. Skipping the pyramid passes in a replay does not change the picture either, so the GPU culling does not read it. - the GPU timestamps the title reads (a claimed 60 ms load), `lodScale` 3.0 - a fixed 1/30 s simulation step (the cap in +0x2226040 patched): still flickers, though the title shot kept its length, so the cutscene may run on another clock **What the frame recorder shows.** - One captured sparse frame replayed 24 times comes out sparse 24 times (70+ dB to the recorded picture). Within a frame, the card's work is deterministic. - A 3-frame capture (`VICTORY_RECORD_FRAMES=3`) of the shot: frames 0 and 1 full, frame 2 sparse; the replay reproduces all three. The title issues **the same draws, the same number per pipeline**, in frames 1 and 2. The indirect records the culling writes are what differ. Work per pipeline (sum of the records' group counts) in frame 2 against frame 1: the trunk pipeline 903776ba469c8bac (MS_VS_TransformD) -44%, adc5c689b0552cc2 -38%, 89a622617919c92a -51%, 9d81dbdaa685de5f -36%, two smaller ones to 0; everything else within about 2%. - If frame 2's CPU-side copies (all of them) are left out of the replay, frame 2 comes out full. So whatever decides it reaches the culling through the data the title writes for the frame (camera and per-batch data). Leaving out only some buffers breaks the frame, so I have not isolated the field yet. - The tree culling (`InstanceCulling:CS_Tree_BatchCull` 55679a0547649d0b) gets the same 196 batches each frame, split between two dispatches differently each frame (98/98, 88/108, 105/91); root constant word 4 alternates between two blocks frame by frame, but pointing frame 2 at frame 1's block changes nothing. So on this card it is not the relay, the indirect batching, the occlusion pyramid or any of the host shortcuts above. The culling is fed something different in the sparse frames. If someone has already decoded what `CS_Tree_BatchCull` reads per batch (LOD/fade fields in the batch records), that is where I'm looking next. AI-assisted (Claude Code).
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/avatarmanz--VIctory-7900XTX#122
No description provided.