GPU: a texture subresource lying wholly in untracked memory is never uploaded #2636

Open
opened 2026-11-25 17:23:32 +00:00 by BastienRodz · 1 comment
BastienRodz commented 2026-11-25 17:23:32 +00:00 (Migrated from github.com)
Contributor

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-25T17:23:32Z.


What happens

Since 280b150, a change tracker leaves untracked any 64 KiB page that touches memory other than the runtime's. Such parts are "copied whole at each use" (watch.rs, Tracked::untracked), and such a tracker is "never clean". Buffer copies follow this; shadow::tests::bytes_off_the_runtimes_memory_are_copied_at_each_use checks it.

Texture staging does not. Staging::refresh_now (texture.rs) asks only Tracked::take for changed pages, and since cc5f961 it reads and re-detiles only the subresources those pages touch. A subresource whose bytes lie only in untracked pages is therefore never touched, so it is never uploaded, not even at the first refresh, and its host texture keeps its initial (zero) contents. Before cc5f961, the first refresh read the whole texture.

Example: a linear RGBA8 128×128 texture with two mips, placed at p + 48 KiB, where [p, p + 64 KiB) is only reserved (the runtime's) and [p + 64 KiB, p + 128 KiB) is plain committed memory. The first submission uploads mip 1 only. Mip 0 is never uploaded, even after the title writes it.

Expected

As for buffer copies: untracked parts are read at each refresh, and their subresources are uploaded at first and whenever their bytes change.

Where

crates/victory-gpu/src/texture.rs, Staging::refresh_now: the ranges from t.take(..) and the touched filter.

280b150 measured no memory copied whole in boot-to-world runs, so like that commit this is about robustness. AI-assisted (Claude Opus 5.5 found it, Claude Code reviewed and verified it); synthetic test only, no game data.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6609924726 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/2638). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-25T17:23:32Z. --- ### What happens Since 280b150, a change tracker leaves untracked any 64 KiB page that touches memory other than the runtime's. Such parts are "copied whole at each use" (`watch.rs`, `Tracked::untracked`), and such a tracker is "never clean". Buffer copies follow this; `shadow::tests::bytes_off_the_runtimes_memory_are_copied_at_each_use` checks it. Texture staging does not. `Staging::refresh_now` (`texture.rs`) asks only `Tracked::take` for changed pages, and since cc5f961 it reads and re-detiles only the subresources those pages touch. A subresource whose bytes lie only in untracked pages is therefore never touched, so it is never uploaded, not even at the first refresh, and its host texture keeps its initial (zero) contents. Before cc5f961, the first refresh read the whole texture. Example: a linear RGBA8 128×128 texture with two mips, placed at `p + 48 KiB`, where `[p, p + 64 KiB)` is only reserved (the runtime's) and `[p + 64 KiB, p + 128 KiB)` is plain committed memory. The first submission uploads mip 1 only. Mip 0 is never uploaded, even after the title writes it. ### Expected As for buffer copies: untracked parts are read at each refresh, and their subresources are uploaded at first and whenever their bytes change. ### Where `crates/victory-gpu/src/texture.rs`, `Staging::refresh_now`: the `ranges` from `t.take(..)` and the `touched` filter. 280b150 measured no memory copied whole in boot-to-world runs, so like that commit this is about robustness. AI-assisted (Claude Opus 5.5 found it, Claude Code reviewed and verified it); synthetic test only, no game data.
Marvisak commented 2026-11-25 19:06:31 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T18:46:46Z.


Automated triage for the maintainers.

Confirmed in main (13f91ca): Staging::refresh_now in crates/victory-gpu/src/texture.rs builds its candidate ranges only from t.take(start, start + size), and the touched filter keeps only subresources that overlap those ranges. Untracked parts are never consulted there (unlike buffer copies), so a subresource lying wholly in untracked pages is never read or uploaded.

Fix PRs: #2639 (open, by the reporter) adds t.untracked(..) ranges as candidates and keeps the whole-page shortcut for tracked pages only. #2689 was closed unmerged as a duplicate of #2639, so nothing for this issue is in main yet.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7171387605 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/2638#issuecomment-7171387605). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T18:46:46Z. --- <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-25T17:23:32Z at=2026-11-25T18:47:45Z --> Automated triage for the maintainers. Confirmed in main (13f91ca): `Staging::refresh_now` in `crates/victory-gpu/src/texture.rs` builds its candidate ranges only from `t.take(start, start + size)`, and the `touched` filter keeps only subresources that overlap those ranges. Untracked parts are never consulted there (unlike buffer copies), so a subresource lying wholly in untracked pages is never read or uploaded. Fix PRs: #2639 (open, by the reporter) adds `t.untracked(..)` ranges as candidates and keeps the whole-page shortcut for tracked pages only. #2689 was closed unmerged as a duplicate of #2639, so nothing for this issue is in main yet. --- _Generated by [Claude Code](https://claude.ai/code)_
Sign in to join this conversation.
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
Marvisak/VIctory#2636
No description provided.