Shaders: a texture read at a computed table entry sets no read mark, so a placed texture there stays null (since 2d6c0df) #2722
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#2722
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@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::tablesmakes onetable_entryper used-resource entry. It makes a whole range only for tables it builds afresh, and even then only up to the last listed entry. Since52d14b1, 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_dwordx8from a table pointer with an SGPRsoffset, 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::handlenotes the read mark only whenis_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 referenced this issue2026-11-26 05:12:48 +00:00
@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). Incrates/victory-shader/src/emit/lower.rs,Lower::handlepushes a texture read mark only whenis_heap_direct(src)holds, so a texture read through a table at a computed entry sets no mark. On the host side,State::tablesincrates/victory-gpu/src/draw.rsmakes atable_entryonly 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
@rezioliver-collab on GitHub · 2026-11-25 23:41 UTC · original
Both #2724 and #2822 left
VIEW_READSempty 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.
+nmeans only bitVIEW_READS + nwas set. The texel read back identified the same slot on all three revisions.main(842b0cb7)569aa6ad)03914d9d)+31+31+32+32+37+37+68+68I ran this on an Apple M1 (macOS 14.7, Rust 1.98.1). The two synthetic Wave32 shaders differ only in the
SOFFSETfield of the second descriptor load. I checked that the resource tracker produced aSource::Phiwith 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.