GPU: a slot's read in the submission right after its texture is placed or given up is wiped, so the view stays null #2574

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

@⁠BastienRodz on GitHub · 2026-11-25 16:08 UTC · original

What happens

Since 52d14b1 ("placed textures made when shaders read their heap slots"), a heap slot whose texture view is left null is forgotten with shadow::forget_read, so that its next read marks it again and take_reads, run after the submission, has its view made. That covers a placed texture written into the heap (HostHeap::mirror from sync_heaps) and, since 69d1e8e, a texture given up (HostHeap::evict from resource::evict_unused). Both run in Host::execute before ExecuteCommandLists. The forgotten marks are only cleared inside take_reads, after the submission has run. So the mark a shader of that very submission set on the slot is wiped together with the old one, and the slot is not made.

The slot gets its view only after a later submission reads it again, which means at least one more frame of a null (black) view. If nothing reads it again, it never does.

Expected

52d14b1's message: "After each submission the host takes the newly set marks and makes the views of those slots that were left null, so the next submission reads the texture; a slot made null again is forgotten so its next read marks it again." HostHeap::evict's comment: "the next draw reading it through a table or shader reading it through the heap (its read mark, cleared) makes it again." The marks of slots forgotten before a submission should be cleared before it runs, so that its reads count.

Where

crates/victory-gpu/src/shadow.rs (READS, forget_read, take_reads) and crates/victory-gpu/src/host.rs (Host::execute: evict_unused and sync_heaps before ExecuteCommandLists, take_reads after).

AI-assisted (Gemini 4 Neon found it, Claude Code reviewed and verified it); synthetic test only, no game data.

**@⁠BastienRodz** on GitHub · 2026-11-25 16:08 UTC · [original](https://github.com/Marvisak/VIctory/issues/2574) ### What happens Since 52d14b1 ("placed textures made when shaders read their heap slots"), a heap slot whose texture view is left null is forgotten with `shadow::forget_read`, so that its next read marks it again and `take_reads`, run after the submission, has its view made. That covers a placed texture written into the heap (`HostHeap::mirror` from `sync_heaps`) and, since 69d1e8e, a texture given up (`HostHeap::evict` from `resource::evict_unused`). Both run in `Host::execute` before `ExecuteCommandLists`. The forgotten marks are only cleared inside `take_reads`, after the submission has run. So the mark a shader of that very submission set on the slot is wiped together with the old one, and the slot is not made. The slot gets its view only after a later submission reads it again, which means at least one more frame of a null (black) view. If nothing reads it again, it never does. ### Expected 52d14b1's message: "After each submission the host takes the newly set marks and makes the views of those slots that were left null, so the next submission reads the texture; a slot made null again is forgotten so its next read marks it again." `HostHeap::evict`'s comment: "the next draw reading it through a table or shader reading it through the heap (its read mark, cleared) makes it again." The marks of slots forgotten before a submission should be cleared before it runs, so that its reads count. ### Where `crates/victory-gpu/src/shadow.rs` (`READS`, `forget_read`, `take_reads`) and `crates/victory-gpu/src/host.rs` (`Host::execute`: `evict_unused` and `sync_heaps` before `ExecuteCommandLists`, `take_reads` after). AI-assisted (Gemini 4 Neon 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:09:34 +00:00
Author
Owner

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

Automated triage for the maintainers.

Confirmed in main (13f91ca). In crates/victory-gpu/src/shadow.rs, forget_read only queues the slot, and take_reads clears the queued slots' bits in both bitmaps when it next runs. In Host::execute (crates/victory-gpu/src/host.rs), evict_unused and sync_heaps (which forget slots) run before ExecuteCommandLists, and take_reads runs after it. So a mark the same submission's shaders set on a forgotten slot is cleared before it is taken, and the view stays null until a later read.

Open PR #2576 addresses this.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 18:45 UTC · [original](https://github.com/Marvisak/VIctory/issues/2574#issuecomment-7171358229) <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-25T16:08:13Z at=2026-11-25T19:03:00Z --> Automated triage for the maintainers. Confirmed in main (`13f91ca`). In `crates/victory-gpu/src/shadow.rs`, `forget_read` only queues the slot, and `take_reads` clears the queued slots' bits in both bitmaps when it next runs. In `Host::execute` (`crates/victory-gpu/src/host.rs`), `evict_unused` and `sync_heaps` (which forget slots) run before `ExecuteCommandLists`, and `take_reads` runs after it. So a mark the same submission's shaders set on a forgotten slot is cleared before it is taken, and the view stays null until a later read. Open PR #2576 addresses this. --- _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#2574
No description provided.