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

Open
opened 2026-11-26 05:10:55 +00:00 by github-bot · 1 comment
Owner

@⁠BastienRodz on GitHub · 2026-11-25 17:23 UTC · original

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.

**@⁠BastienRodz** on GitHub · 2026-11-25 17:23 UTC · [original](https://github.com/Marvisak/VIctory/issues/2638) ### 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:10:55 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 18:46 UTC · original

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

**@⁠Marvisak** on GitHub · 2026-11-25 18:46 UTC · [original](https://github.com/Marvisak/VIctory/issues/2638#issuecomment-7171387605) <!-- 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)_
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/Marvisak--VIctory#2638
No description provided.