GPU: distant buildings black: small textures packed back to back made one another's slots null #1264

Merged
CristianCiubancan merged 1 commit from upstream-pr/1264 into main 2026-11-28 19:39:38 +00:00
CristianCiubancan commented 2026-11-28 16:44:49 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by CristianCiubancan on 2026-11-28T16:44:49Z.


What was wrong. Buildings and towers seen from a distance have black walls; the same building is right up close. A game frame recorded at two copies of one building, the near one beige and the far one black, shows the far walls' draws (MS_VS_TransformD with PS_DeferredTextured) writing an albedo of zero although their textures and vertex streams all hold data.

The far mesh program takes the walls' tint from a colour table: a 1D texture picked from the heap by an index in the material record, read with image_load. In the recorded frame that slot holds a null view.

Why. Spans::note under Rule::Start makes an older placed view stale when a newer one starts within HEAD (4 KiB) of it, on the ground that no two textures share the block of their smallest levels. The title's colour tables are 256 bytes each and lie back to back, so every table written makes its neighbours null. A run with each such event written down (RTX 5070 Ti, Series X profile, a few minutes of play):

Why the older view was made stale Events
One of the two views is at address 0 108,157
Starts within 4 KiB, but the two share no byte 31,436 (31,133 of the older views are 4 KiB or less)
Same start, another length 1
Starts within 4 KiB and they overlap 1

The far building's table, from that log: slot 76523, [0xc042be000, 0xc042be100), made stale by a view at 0xc042bea00 and again by the next table at 0xc042be100.

The change.

  • Two spans clash only where one begins inside the other's head: its first 4 KiB, or all of it where it is shorter (heads_meet). Larger textures are judged as before.
  • A view at address 0 describes no memory: it makes nothing stale and is not kept among the spans.

Tested.

  • New tests small_neighbours_stay (the logged addresses) and views_of_no_memory_take_no_place. Both fail on main and pass here. packed_neighbours_stay and spans_say_the_next_start_and_the_lowest_level_viewed pass unchanged.
  • cargo test -p victory-gpu --lib: 456 passed, 0 failed, 36 ignored.
  • In the game, same places: with VICTORY_STALE_TEXTURES=0 on main plus #996 the walls are right, which pointed at the rule; with this change and the rule at its default they are right too. Checked by eye by the user who reported it, on a build that also had #996 and #1197.

Not measured. Memory and frame rate. Slots that used to be made null now keep their textures, so the texture queue holds somewhat more; I have no figure for it.

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5542417312 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1264). Originally posted by [CristianCiubancan](https://github.com/CristianCiubancan) on 2026-11-28T16:44:49Z. --- **What was wrong.** Buildings and towers seen from a distance have black walls; the same building is right up close. A game frame recorded at two copies of one building, the near one beige and the far one black, shows the far walls' draws (`MS_VS_TransformD` with `PS_DeferredTextured`) writing an albedo of zero although their textures and vertex streams all hold data. The far mesh program takes the walls' tint from a colour table: a 1D texture picked from the heap by an index in the material record, read with `image_load`. In the recorded frame that slot holds a null view. **Why.** `Spans::note` under `Rule::Start` makes an older placed view stale when a newer one starts within `HEAD` (4 KiB) of it, on the ground that no two textures share the block of their smallest levels. The title's colour tables are 256 bytes each and lie back to back, so every table written makes its neighbours null. A run with each such event written down (RTX 5070 Ti, Series X profile, a few minutes of play): | Why the older view was made stale | Events | |---|---:| | One of the two views is at address 0 | 108,157 | | Starts within 4 KiB, but the two share no byte | 31,436 (31,133 of the older views are 4 KiB or less) | | Same start, another length | 1 | | Starts within 4 KiB and they overlap | 1 | The far building's table, from that log: slot 76523, `[0xc042be000, 0xc042be100)`, made stale by a view at `0xc042bea00` and again by the next table at `0xc042be100`. **The change.** - Two spans clash only where one begins inside the other's head: its first 4 KiB, or all of it where it is shorter (`heads_meet`). Larger textures are judged as before. - A view at address 0 describes no memory: it makes nothing stale and is not kept among the spans. **Tested.** - New tests `small_neighbours_stay` (the logged addresses) and `views_of_no_memory_take_no_place`. Both fail on `main` and pass here. `packed_neighbours_stay` and `spans_say_the_next_start_and_the_lowest_level_viewed` pass unchanged. - `cargo test -p victory-gpu --lib`: 456 passed, 0 failed, 36 ignored. - In the game, same places: with `VICTORY_STALE_TEXTURES=0` on `main` plus #996 the walls are right, which pointed at the rule; with this change and the rule at its default they are right too. Checked by eye by the user who reported it, on a build that also had #996 and #1197. **Not measured.** Memory and frame rate. Slots that used to be made null now keep their textures, so the texture queue holds somewhat more; I have no figure for it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Marsietiss commented 2026-11-28 19:18:30 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Marsietiss on 2026-11-28T19:18:30Z.


Heads-up from testing (RTX 5080, Series S mode): in our merged build (our tree + #1264 + Vice-Tay #424 + #1298 + #1322 + a RAM-trim change) we saw wrong textures in game: a pedestrian's face painted rainbow-coloured and a glass door filled with blocky gold tiles. The same happened in the build without the RAM-trim change. #1264 is our main suspect, since it touches descriptor slots / address-0 views, but we have NOT bisected it yet, so this may well be one of the other changes or an interaction. I will report back if I can pin it down by removing #1264 alone.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7244446496 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1264#issuecomment-7244446496). Originally posted by [Marsietiss](https://github.com/Marsietiss) on 2026-11-28T19:18:30Z. --- Heads-up from testing (RTX 5080, Series S mode): in our merged build (our tree + #1264 + Vice-Tay #424 + #1298 + #1322 + a RAM-trim change) we saw wrong textures in game: a pedestrian's face painted rainbow-coloured and a glass door filled with blocky gold tiles. The same happened in the build without the RAM-trim change. #1264 is our main suspect, since it touches descriptor slots / address-0 views, but we have NOT bisected it yet, so this may well be one of the other changes or an interaction. I will report back if I can pin it down by removing #1264 alone.
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
trustno1-coder/VIctory-NVIDIA!1264
No description provided.