Shaders: a texture read at a computed table entry sets no read mark, so a placed texture there stays null (since 2d6c0df) #2722

Open
opened 2026-11-26 05:12:45 +00:00 by github-bot · 2 comments
Owner

@⁠BastienRodz on GitHub · 2026-11-25 18:50 UTC · original

Since 2d6c0df ("read marks only for texture views taken from the heap itself"), a texture read through a table sets no read mark. The commit's reason is that "the host makes table slots for the draw". That holds for the entries the used-resource list names, but not for a table read at a computed entry.

Where. draw::State::tables makes one table_entry per used-resource entry. It makes a whole range only for tables it builds afresh, and even then only up to the last listed entry. Since 52d14b1, placed textures (device 0x230, no resource object) are left null in the host heap until a read mark or a table entry makes them.

Input that goes wrong. A descriptor array indexed by data, for example s_load_dwordx8 from a table pointer with an SGPR soffset, or a per-lane or waterfall descriptor load from a table. The slot it reaches can lie past the listed entries.

What happens on main 13f91ca. Lower::handle notes the read mark only when is_heap_direct(src) holds. A computed table entry is not heap-direct, so no mark is emitted. If the slot holds a placed texture that the host left null, nothing ever makes it, and the view reads null for as long as only such reads reach it.

Before 2d6c0df. Every texture read set its mark, so the host made the slot after the first submission that read it.

Expected. Only a table entry at a fixed offset, one the host makes for the draw, should skip the mark. Heap-direct reads and computed table entries should keep it.

Found by reading the code; I have no in-game observation of a texture reading black because of this. No game data was used. Analysis assisted by Claude Code.

**@⁠BastienRodz** on GitHub · 2026-11-25 18:50 UTC · [original](https://github.com/Marvisak/VIctory/issues/2722) Since 2d6c0df ("read marks only for texture views taken from the heap itself"), a texture read through a table sets no read mark. The commit's reason is that "the host makes table slots for the draw". That holds for the entries the used-resource list names, but not for a table read at a computed entry. **Where.** `draw::State::tables` makes one `table_entry` per used-resource entry. It makes a whole range only for tables it builds afresh, and even then only up to the last listed entry. Since 52d14b1, placed textures (device 0x230, no resource object) are left null in the host heap until a read mark or a table entry makes them. **Input that goes wrong.** A descriptor array indexed by data, for example `s_load_dwordx8` from a table pointer with an SGPR `soffset`, or a per-lane or waterfall descriptor load from a table. The slot it reaches can lie past the listed entries. **What happens on main 13f91ca.** `Lower::handle` notes the read mark only when `is_heap_direct(src)` holds. A computed table entry is not heap-direct, so no mark is emitted. If the slot holds a placed texture that the host left null, nothing ever makes it, and the view reads null for as long as only such reads reach it. **Before 2d6c0df.** Every texture read set its mark, so the host made the slot after the first submission that read it. **Expected.** Only a table entry at a fixed offset, one the host makes for the draw, should skip the mark. Heap-direct reads and computed table entries should keep it. Found by reading the code; I have no in-game observation of a texture reading black because of this. No game data was used. Analysis assisted by Claude Code.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:12:45 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 21:46 UTC · original · edited 2026-11-26 00:44 UTC

Automated triage for the maintainers.

Confirmed by reading main (63bcca4). In crates/victory-shader/src/emit/lower.rs, Lower::handle pushes a texture read mark only when is_heap_direct(src) holds, so a texture read through a table at a computed entry sets no mark. On the host side, State::tables in crates/victory-gpu/src/draw.rs makes a table_entry only for the entries the used-resource list names; for a table it builds afresh, it makes the range only up to the last listed entry. A placed texture at a slot past those entries is therefore never made. No in-game effect has been observed yet, as the report says.

Open PRs: #2724 and #2822. Per the comparison above, both mark the slot read when one phi input is computed, but neither marks anything when both inputs are fixed table entries, so that case remains open with either.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 21:46 UTC · [original](https://github.com/Marvisak/VIctory/issues/2722#issuecomment-7175513645) · edited 2026-11-26 00:44 UTC <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-25T23:41:42Z at=2026-11-26T01:04:30Z --> Automated triage for the maintainers. Confirmed by reading `main` (63bcca4). In `crates/victory-shader/src/emit/lower.rs`, `Lower::handle` pushes a texture read mark only when `is_heap_direct(src)` holds, so a texture read through a table at a computed entry sets no mark. On the host side, `State::tables` in `crates/victory-gpu/src/draw.rs` makes a `table_entry` only for the entries the used-resource list names; for a table it builds afresh, it makes the range only up to the last listed entry. A placed texture at a slot past those entries is therefore never made. No in-game effect has been observed yet, as the report says. Open PRs: #2724 and #2822. Per the comparison above, both mark the slot read when one phi input is computed, but neither marks anything when both inputs are fixed table entries, so that case remains open with either. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠rezioliver-collab on GitHub · 2026-11-25 23:41 UTC · original

Both #2724 and #2822 left VIEW_READS empty when both inputs to the descriptor phi were fixed table entries. With one fixed and one computed input, both PRs set exactly one bit for the slot actually read, including when the fixed arm ran.

The table below uses heap slot 30 as the table base. +n means only bit VIEW_READS + n was set. The texel read back identified the same slot on all three revisions.

Phi inputs Arm taken Slot read main (842b0cb7) #2724 (569aa6ad) #2822 (03914d9d)
Fixed / fixed A 31 Empty Empty Empty
Fixed / fixed B 32 Empty Empty Empty
Fixed / computed A (fixed) 31 Empty +31 +31
Fixed / computed B, index 0 32 Empty +32 +32
Fixed / computed B, index 5 37 Empty +37 +37
Fixed / computed B, index 36 68 Empty +68 +68

I ran this on an Apple M1 (macOS 14.7, Rust 1.98.1). The two synthetic Wave32 shaders differ only in the SOFFSET field of the second descriptor load. I checked that the resource tracker produced a Source::Phi with two table inputs, then replayed the emitted shader code on the CPU with a distinct texel in each slot and a full-size software bitmap.

Across all three revisions I tested 72 configurations covering table bases 7 and 30, both branch outcomes, and runtime indices 0, 5 and 36. I ran each configuration twice, checking the returned texel and every bitmap byte after each invocation. The second read issued no additional atomic OR. Both PRs also emitted byte-identical DXIL bitcode for each corresponding shader. This test covers shader-side read marking. D3D12 execution and host-side texture materialization are outside its scope.

**@⁠rezioliver-collab** on GitHub · 2026-11-25 23:41 UTC · [original](https://github.com/Marvisak/VIctory/issues/2722#issuecomment-7177919664) **Both #2724 and #2822 left `VIEW_READS` empty when both inputs to the descriptor phi were fixed table entries. With one fixed and one computed input, both PRs set exactly one bit for the slot actually read, including when the fixed arm ran.** The table below uses heap slot 30 as the table base. `+n` means only bit `VIEW_READS + n` was set. The texel read back identified the same slot on all three revisions. | Phi inputs | Arm taken | Slot read | `main` (`842b0cb7`) | #2724 (`569aa6ad`) | #2822 (`03914d9d`) | |---|---|---:|---|---|---| | Fixed / fixed | A | 31 | Empty | Empty | Empty | | Fixed / fixed | B | 32 | Empty | Empty | Empty | | Fixed / computed | A (fixed) | 31 | Empty | `+31` | `+31` | | Fixed / computed | B, index 0 | 32 | Empty | `+32` | `+32` | | Fixed / computed | B, index 5 | 37 | Empty | `+37` | `+37` | | Fixed / computed | B, index 36 | 68 | Empty | `+68` | `+68` | I ran this on an Apple M1 (macOS 14.7, Rust 1.98.1). The two synthetic Wave32 shaders differ only in the `SOFFSET` field of the second descriptor load. I checked that the resource tracker produced a `Source::Phi` with two table inputs, then replayed the emitted shader code on the CPU with a distinct texel in each slot and a full-size software bitmap. Across all three revisions I tested 72 configurations covering table bases 7 and 30, both branch outcomes, and runtime indices 0, 5 and 36. I ran each configuration twice, checking the returned texel and every bitmap byte after each invocation. The second read issued no additional atomic OR. Both PRs also emitted byte-identical DXIL bitcode for each corresponding shader. This test covers shader-side read marking. D3D12 execution and host-side texture materialization are outside its scope.
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#2722
No description provided.