Fix tree and prop flicker on AMD: move off-16-byte raw twins on every driver and list translation order #197

Open
staticman256 wants to merge 1 commit from upstream-pr/197 into amd
staticman256 commented 2026-12-04 06:29:07 +00:00 (Migrated from github.com)

Imported from eikkapine/jaxe. Originally posted by staticman256 on 2026-12-04T06:29:07Z.


Fix most tree and prop flicker on AMD: move off-16-byte raw twins on every driver, and translate thin lists in the title's order

Two commits. The first is a port of
ReVIctory PR 36 (merged there) to
the amd branch. The second, described at the end, removes what was left after it in
ReVIctory: a row of trees blinking every few seconds with thin lists on.

On an RX 9070 XT, trees, bushes, fences and poles were seen blinking constantly in
ReVIctory: single objects missing for one frame, all the time, standing still or moving.
Most of that was removed there by the first change. The same code path is present on this
branch, and the cause is not specific to one card, so other GPUs and drivers that show
the same flicker are expected to be helped as well.

What was wrong

The game's lists of objects to draw are kept in buffers, and many of those lists do not
start on a 16-byte boundary. A raw buffer view in D3D12 has to. That is already handled
on this branch: the raw twin is made from the 16 bytes below and the descriptor is then
edited to shift it to the real start (move_raw).

Only a descriptor that is recognised is edited by move_raw: address, then byte count,
in the first 12 bytes. That is what is written by RX 7000 drivers. Something else is
written by the RX 9070 XT's driver, so every one of those moves is refused and the twin
is left null. A null twin is read as zeros, which is an empty list to the game, so
whatever that list held is not drawn that frame.

It is reported by the frame line in the log (numbers from ReVIctory on an RX 9070 XT):

raw twins of buffer views made per frame (JAXE_RAW_VIEWS=0: none): ~44,000, of them 1,000-1,400 that do not begin on 16 bytes (same number null)

(main is not affected in the same way: there a twin that cannot be moved is kept with
a bias that shaders add, JAXE_TWIN_BIAS. This branch has no such fallback, so the twin
is null.)

What is changed

One descriptor layout is no longer assumed. The layout of the running driver is found
once at start (raw_layout, called from probe_view_limit):

  • Three raw views of a small buffer are made that differ only in start and length, and
    their descriptors are compared to find the address field and the length field
    (raw_layout_of). Every other byte has to be equal, or the layout is not used.
  • If no address is held in the descriptor at all, each pointer in it is followed and
    what lies behind it is examined. This is the RX 9070 XT case: the handle points at a
    32-byte record (pointer, stamp, resource, offset), and the address and byte count are
    found behind the first pointer.
  • Before the layout is trusted, a view is moved by 8 bytes in private heaps and eight
    things are checked: the move shows, it is carried by copies (also into a
    shader-visible heap), and the neighbouring slots and the same view in another slot
    are left untouched.

The known layout is still tried first by move_raw, exactly as before, and the probed
one is only fallen back to (move_raw_probed). On a driver whose layout is the known
one, nothing is changed. On a driver where the probe fails, nothing is changed either:
the twins stay null as they do today, and that is said in the log.

One file is touched: crates/jaxe-gpu/src/descriptor/host.rs, with its tests
(+470 -5). The shader translator is not touched, so shader caches stay valid.

Switch

Switch Default Meaning
JAXE_RAW_MOVE_PROBE 1 0: only the known layout is used, as before this PR. 2: a probed layout is used even if it could not be proven by the read-back from a shader-visible heap.

(ReVIctory's diagnostic switch VICTORY_OFF16_COPIES was not ported.)

How the cause was found (in ReVIctory)

  1. A fix for instance lists disappearing on an RX 7900 XTX was published by
    Ancient Souzou: lists that
    start off 16 bytes were being read as zeros. The right place was pointed at by that.
    The same repair was already present, so the question became why it did not help on
    an RX 9070 XT.
  2. That was answered by the "(same number null)" counter above: the repair was run and
    was refused every time on that driver.
  3. The flicker was cut sharply by a test in which such views were given aligned copies
    (no move needed). Null off-16 twins were thereby confirmed as the cause before any
    descriptor was touched.
  4. The driver's descriptors were logged in hex by the first probe. A pointer and no
    address were found in them, which is why the pointer is followed in the second step
    and the move is proven with a trial.

What to look for in a log

raw buffer view descriptors of this host, for moving raw twins that do not begin on 16 bytes ...: behind a pointer, understood and tried: such twins are moved by it
the first raw twin that does not begin on 16 bytes moved by this host's layout

The first line is ended by one of four verdicts: the known layout, another layout
understood, behind a pointer, or not understood. A line is also written where the
probe could not run at all (no device, buffer or heap). The descriptors are printed in
hex, so a log from a card where it fails is enough for the probe to be extended. In the
frame line above, the "(N null)" counter is expected to read 0.

Tested

  • In ReVIctory (the original, same code apart from names): RX 9070 XT, Windows 11.
    "behind a pointer, understood and tried" was reported by the probe with all eight
    trial checks true, the first move was logged about 30 seconds in, and the constant
    flicker of single trees and props was gone.
  • This port, on stock amd first (0902398, RX 9070 XT, Windows 11, release build, the
    launcher's settings with FSR 4 performance and frame generation): 300 to 700 raw
    twins a frame that do not begin on 16 bytes were counted in the open world by the
    frame line, every one of them null, and the flicker was seen.
  • This port, with this change (same PC and settings): confirmed working.
  • Type-checked and linted for x86_64-pc-windows-msvc (clippy, --all-targets) with
    no new warnings; the layout test passes.

Not tested

  • Any card other than the RX 9070 XT. The known path is expected to be taken unchanged
    on RX 7000. NVIDIA and Intel were not run; the probe is only acted on where
    move_raw refuses.
  • JAXE_RAW_MOVE_PROBE=2 and the "another layout, understood" path (address and
    length directly in the descriptor but at other offsets): written, never met.
<!-- greyfinch-sync:eikkapine/jaxe:issue:5641570175 --> Imported from [eikkapine/jaxe](https://github.com/eikkapine/jaxe/pull/197). Originally posted by [staticman256](https://github.com/staticman256) on 2026-12-04T06:29:07Z. --- ## Fix most tree and prop flicker on AMD: move off-16-byte raw twins on every driver, and translate thin lists in the title's order Two commits. The first is a port of [ReVIctory PR 36](https://github.com/ReTerryDavis/ReVIctory/pull/36) (merged there) to the `amd` branch. The second, described at the end, removes what was left after it in ReVIctory: a row of trees blinking every few seconds with thin lists on. On an RX 9070 XT, trees, bushes, fences and poles were seen blinking constantly in ReVIctory: single objects missing for one frame, all the time, standing still or moving. Most of that was removed there by the first change. The same code path is present on this branch, and the cause is not specific to one card, so other GPUs and drivers that show the same flicker are expected to be helped as well. ### What was wrong The game's lists of objects to draw are kept in buffers, and many of those lists do not start on a 16-byte boundary. A raw buffer view in D3D12 has to. That is already handled on this branch: the raw twin is made from the 16 bytes below and the descriptor is then edited to shift it to the real start (`move_raw`). Only a descriptor that is recognised is edited by `move_raw`: address, then byte count, in the first 12 bytes. That is what is written by RX 7000 drivers. Something else is written by the RX 9070 XT's driver, so every one of those moves is refused and the twin is left null. A null twin is read as zeros, which is an empty list to the game, so whatever that list held is not drawn that frame. It is reported by the frame line in the log (numbers from ReVIctory on an RX 9070 XT): ``` raw twins of buffer views made per frame (JAXE_RAW_VIEWS=0: none): ~44,000, of them 1,000-1,400 that do not begin on 16 bytes (same number null) ``` (`main` is not affected in the same way: there a twin that cannot be moved is kept with a bias that shaders add, `JAXE_TWIN_BIAS`. This branch has no such fallback, so the twin is null.) ### What is changed One descriptor layout is no longer assumed. The layout of the running driver is found once at start (`raw_layout`, called from `probe_view_limit`): - Three raw views of a small buffer are made that differ only in start and length, and their descriptors are compared to find the address field and the length field (`raw_layout_of`). Every other byte has to be equal, or the layout is not used. - If no address is held in the descriptor at all, each pointer in it is followed and what lies behind it is examined. This is the RX 9070 XT case: the handle points at a 32-byte record (pointer, stamp, resource, offset), and the address and byte count are found behind the first pointer. - Before the layout is trusted, a view is moved by 8 bytes in private heaps and eight things are checked: the move shows, it is carried by copies (also into a shader-visible heap), and the neighbouring slots and the same view in another slot are left untouched. The known layout is still tried first by `move_raw`, exactly as before, and the probed one is only fallen back to (`move_raw_probed`). On a driver whose layout is the known one, nothing is changed. On a driver where the probe fails, nothing is changed either: the twins stay null as they do today, and that is said in the log. One file is touched: `crates/jaxe-gpu/src/descriptor/host.rs`, with its tests (+470 -5). The shader translator is not touched, so shader caches stay valid. ### Switch | Switch | Default | Meaning | |---|---|---| | `JAXE_RAW_MOVE_PROBE` | `1` | `0`: only the known layout is used, as before this PR. `2`: a probed layout is used even if it could not be proven by the read-back from a shader-visible heap. | (ReVIctory's diagnostic switch `VICTORY_OFF16_COPIES` was not ported.) ### How the cause was found (in ReVIctory) 1. A fix for instance lists disappearing on an RX 7900 XTX was published by [Ancient Souzou](https://github.com/Ancient-Souzou/Whiplash-Contribution): lists that start off 16 bytes were being read as zeros. The right place was pointed at by that. The same repair was already present, so the question became why it did not help on an RX 9070 XT. 2. That was answered by the "(same number null)" counter above: the repair was run and was refused every time on that driver. 3. The flicker was cut sharply by a test in which such views were given aligned copies (no move needed). Null off-16 twins were thereby confirmed as the cause before any descriptor was touched. 4. The driver's descriptors were logged in hex by the first probe. A pointer and no address were found in them, which is why the pointer is followed in the second step and the move is proven with a trial. ### What to look for in a log ``` raw buffer view descriptors of this host, for moving raw twins that do not begin on 16 bytes ...: behind a pointer, understood and tried: such twins are moved by it the first raw twin that does not begin on 16 bytes moved by this host's layout ``` The first line is ended by one of four verdicts: the known layout, another layout understood, behind a pointer, or not understood. A line is also written where the probe could not run at all (no device, buffer or heap). The descriptors are printed in hex, so a log from a card where it fails is enough for the probe to be extended. In the frame line above, the "(N null)" counter is expected to read 0. ### Tested - In ReVIctory (the original, same code apart from names): RX 9070 XT, Windows 11. "behind a pointer, understood and tried" was reported by the probe with all eight trial checks true, the first move was logged about 30 seconds in, and the constant flicker of single trees and props was gone. - This port, on stock `amd` first (0902398, RX 9070 XT, Windows 11, release build, the launcher's settings with FSR 4 performance and frame generation): 300 to 700 raw twins a frame that do not begin on 16 bytes were counted in the open world by the frame line, every one of them null, and the flicker was seen. - This port, with this change (same PC and settings): confirmed working. - Type-checked and linted for `x86_64-pc-windows-msvc` (clippy, `--all-targets`) with no new warnings; the layout test passes. ### Not tested - Any card other than the RX 9070 XT. The known path is expected to be taken unchanged on RX 7000. NVIDIA and Intel were not run; the probe is only acted on where `move_raw` refuses. - `JAXE_RAW_MOVE_PROBE=2` and the "another layout, understood" path (address and length directly in the descriptor but at other offsets): written, never met.
Skilletz-ttv commented 2026-12-04 08:55:57 +00:00 (Migrated from github.com)

Imported from eikkapine/jaxe. Originally posted by Skilletz-ttv on 2026-12-04T08:55:57Z.


Confirms the fix on RDNA2 (RX 6950 XT): the probe found this card's layout too

Applied to a local build of amd @ 0902398 with 89bd07d's change to
crates/jaxe-gpu/src/descriptor/host.rs. Reporting because the PR lists only an
RX 9070 XT as tested, and this is an older driver generation where the descriptor
layout is evidently not the RX 7000 one either — the probe read it correctly with
no modification.

GPU RX 6950 XT (RDNA2, gfx1030), 16 GB
Driver 32.0.21045.29003 (Adrenalin 26.11.2)
CPU / RAM Ryzen 7 5800X / 32 GB
OS Windows 11, build 26300
Settings Series S profile, 1080p output, FSR 3 Quality, locked 30

Before — standing still at a spot with dense vegetation: ~20,000 raw twins a
frame, 745 of them not beginning on 16 bytes, 745 null. Continuous flicker of
individual trees and roadside props, near and far, every frame.

After — same spot, same settings:

raw buffer view descriptors of this host, for moving raw twins that do not begin
on 16 bytes (JAXE_RAW_MOVE_PROBE=0: not looked at): behind a pointer, understood
and tried: such twins are moved by it
the first raw twin that does not begin on 16 bytes moved by this host's layout by=8 bytes=608008
raw twins of buffer views made per frame: 18,305, of them 690.1 that do not begin
on 16 bytes (0.0 null)
<!-- greyfinch-sync:eikkapine/jaxe:comment:7406611305 --> Imported from [eikkapine/jaxe](https://github.com/eikkapine/jaxe/pull/197#issuecomment-7406611305). Originally posted by [Skilletz-ttv](https://github.com/Skilletz-ttv) on 2026-12-04T08:55:57Z. --- **Confirms the fix on RDNA2 (RX 6950 XT): the probe found this card's layout too** Applied to a local build of `amd` @ `0902398` with `89bd07d`'s change to `crates/jaxe-gpu/src/descriptor/host.rs`. Reporting because the PR lists only an RX 9070 XT as tested, and this is an older driver generation where the descriptor layout is evidently not the RX 7000 one either — the probe read it correctly with no modification. | | | | --- | --- | | GPU | RX 6950 XT (RDNA2, gfx1030), 16 GB | | Driver | 32.0.21045.29003 (Adrenalin 26.11.2) | | CPU / RAM | Ryzen 7 5800X / 32 GB | | OS | Windows 11, build 26300 | | Settings | Series S profile, 1080p output, FSR 3 Quality, locked 30 | **Before** — standing still at a spot with dense vegetation: ~20,000 raw twins a frame, 745 of them not beginning on 16 bytes, **745 null**. Continuous flicker of individual trees and roadside props, near and far, every frame. **After** — same spot, same settings: ```text raw buffer view descriptors of this host, for moving raw twins that do not begin on 16 bytes (JAXE_RAW_MOVE_PROBE=0: not looked at): behind a pointer, understood and tried: such twins are moved by it the first raw twin that does not begin on 16 bytes moved by this host's layout by=8 bytes=608008 raw twins of buffer views made per frame: 18,305, of them 690.1 that do not begin on 16 bytes (0.0 null)
mahhnameisjeff commented 2026-12-04 10:03:03 +00:00 (Migrated from github.com)

Imported from eikkapine/jaxe. Originally posted by mahhnameisjeff on 2026-12-04T10:03:03Z.


Tested on an RX 6700 XT (RDNA2) on top of amd: same problem there, and this fixes it.

Before (hour-long run, open world): every raw twin off 16 bytes was null, ~650 per frame (e.g. 19091, of them 653.9 that do not begin on 16 bytes (653.9 null)).

With this PR the layout is found at start ("behind a pointer, understood and tried: such twins are moved by it"), and none are left null:

raw twins of buffer views made per frame: 16028, of them 524.1 that do not begin on 16 bytes (0.0 null)

The flicker of single objects is gone in game. raw_layouts_are_found_or_left_alone passes.

<!-- greyfinch-sync:eikkapine/jaxe:comment:7408171761 --> Imported from [eikkapine/jaxe](https://github.com/eikkapine/jaxe/pull/197#issuecomment-7408171761). Originally posted by [mahhnameisjeff](https://github.com/mahhnameisjeff) on 2026-12-04T10:03:03Z. --- Tested on an RX 6700 XT (RDNA2) on top of `amd`: same problem there, and this fixes it. Before (hour-long run, open world): every raw twin off 16 bytes was null, ~650 per frame (e.g. `19091, of them 653.9 that do not begin on 16 bytes (653.9 null)`). With this PR the layout is found at start ("behind a pointer, understood and tried: such twins are moved by it"), and none are left null: ``` raw twins of buffer views made per frame: 16028, of them 524.1 that do not begin on 16 bytes (0.0 null) ``` The flicker of single objects is gone in game. `raw_layouts_are_found_or_left_alone` passes.
staticman256 commented 2026-12-04 10:19:01 +00:00 (Migrated from github.com)

Imported from eikkapine/jaxe. Originally posted by staticman256 on 2026-12-04T10:19:01Z.


im going to push a very performance-cheap part 2 of the fix that solves the remaining batch flashes with a different cause. please stand by

<!-- greyfinch-sync:eikkapine/jaxe:comment:7408534025 --> Imported from [eikkapine/jaxe](https://github.com/eikkapine/jaxe/pull/197#issuecomment-7408534025). Originally posted by [staticman256](https://github.com/staticman256) on 2026-12-04T10:19:01Z. --- im going to push a very performance-cheap part 2 of the fix that solves the remaining batch flashes with a different cause. please stand by
staticman256 commented 2026-12-04 10:25:18 +00:00 (Migrated from github.com)

Imported from eikkapine/jaxe. Originally posted by staticman256 on 2026-12-04T10:25:18Z.


Updated with the KIlflash Pt.2 @mahhnameisjeff @Skilletz-ttv recommend retesting.

<!-- greyfinch-sync:eikkapine/jaxe:comment:7408689605 --> Imported from [eikkapine/jaxe](https://github.com/eikkapine/jaxe/pull/197#issuecomment-7408689605). Originally posted by [staticman256](https://github.com/staticman256) on 2026-12-04T10:25:18Z. --- Updated with the KIlflash Pt.2 @mahhnameisjeff @Skilletz-ttv recommend retesting.
dardack commented 2026-12-04 14:41:23 +00:00 (Migrated from github.com)

Imported from eikkapine/jaxe. Originally posted by dardack on 2026-12-04T14:41:23Z.


i always come back to this build over revictory, even with these fixes in Re, i still get some flickering of sky or random objects, but this did have random trees or poles pop, this seems to fix. just still trees are duller until close, and they have blocking around them, but that was in this build without or without commit.

<!-- greyfinch-sync:eikkapine/jaxe:comment:7414709257 --> Imported from [eikkapine/jaxe](https://github.com/eikkapine/jaxe/pull/197#issuecomment-7414709257). Originally posted by [dardack](https://github.com/dardack) on 2026-12-04T14:41:23Z. --- i always come back to this build over revictory, even with these fixes in Re, i still get some flickering of sky or random objects, but this did have random trees or poles pop, this seems to fix. just still trees are duller until close, and they have blocking around them, but that was in this build without or without commit.
staticman256 commented 2026-12-04 14:52:55 +00:00 (Migrated from github.com)

Imported from eikkapine/jaxe. Originally posted by staticman256 on 2026-12-04T14:52:55Z.


Reverted to the original commit only due to performance concerns.

<!-- greyfinch-sync:eikkapine/jaxe:comment:7415000977 --> Imported from [eikkapine/jaxe](https://github.com/eikkapine/jaxe/pull/197#issuecomment-7415000977). Originally posted by [staticman256](https://github.com/staticman256) on 2026-12-04T14:52:55Z. --- Reverted to the original commit only due to performance concerns.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/197:upstream-pr/197'
git switch 'upstream-pr/197'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'amd'
git merge --no-ff 'upstream-pr/197'
git switch 'upstream-pr/197'
git rebase 'amd'
git switch 'amd'
git merge --ff-only 'upstream-pr/197'
git switch 'upstream-pr/197'
git rebase 'amd'
git switch 'amd'
git merge --no-ff 'upstream-pr/197'
git switch 'amd'
git merge --squash 'upstream-pr/197'
git switch 'amd'
git merge --ff-only 'upstream-pr/197'
git switch 'amd'
git merge 'upstream-pr/197'
git push origin 'amd'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
eikkapine/jaxe!197
No description provided.