Shaders: reconstruct image descriptor dword 0 as a heap-slot proxy #1847
No reviewers
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!1847
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1847"
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?
@AdamRchd on GitHub · 2026-11-24 23:19 UTC · original
AdamRchd:fix/descriptor-address-format-as-data→main· +285 −14 · 2 files · 2 commits · openSummary
Reconstructs image descriptor dword 0 (the GPU base address) using
heap_index(site, first, false)indescriptor_data()so bound image base addresses do not remainVal::Missingwhen compared or propagated through vector instructions (such asv_cmpx_gt_u32feeding branch conditions).Changes
crates/victory-shader/src/emit/lower.rs: reconstruct image dword 0 viaheap_indexindescriptor_data().crates/victory-shader/src/emit/diff_tests.rs: addimage_descriptor_address_read_as_data_translatesregression test.Verification
cargo test -p victory-shadercargo clippy/cargo xtask policy11eeb27c2d15980dtranslates and validates cleanly, and confirmeda descriptor's address or format read as datano longer appears in a 120s game run.@upipibi on GitHub · 2026-11-24 23:23 UTC · original
At
a0553ee(onmain70564ae)victory-shaderdoesn't compile:The
Fields::Smemarm, which reads a buffer through scalar loads, still returns a pair; theImageandBufferarms now return(props, image, known_stride). By analogy with theBufferarm it would be(props, None, used.stride), unless the proxy should not apply to scalar-loaded buffers. I didn't run the tests because of this.AI-assisted (Claude Code).
@CaravelaLabs on GitHub · 2026-11-24 23:38 UTC · original
@AdamRchd, @upipibi already has the compile break: the scalar-load arm still returns a pair, so
victory-shaderdoes not build. Same error here, heada0553eemerged onto main70564ae(Linux, rustc 1.98.1). The tests did not start.The image change behind that error is a separate problem, and fixing the pair would not touch it. Dword 0 is filled with the heap-slot index of the load: the table pointer plus the byte offset, shifted right by 5. That is which slot was loaded, not the texture's base address. A null descriptor and a live one in the same slot become the same value, and on a bound heap that value is not zero, so
dword 0 > 0takes the non-null side either way. The new test only checks that lowering returns Ok. It sits in the Windows-only diff tests, so it did not run here.AI-assisted; checked on this machine.
@AdamRchd on GitHub · 2026-11-25 00:09 UTC · original
Thanks for catching both issues — I've pushed an update addressing them on top of
70564ae:Fields::Smemcompile break (E0308): updated theFields::Smemarm incrates/victory-shader/src/emit/lower.rsto return the 3-tuple(props, None, used.stride)matching the updateddescriptor_data()destructuring.heap_index— a null descriptor and a live one in the same slot share the same slot index. Switched image dword 0 tofield(self, 0)(width fromgetDimensions()), which is0for null/unbound SRVs and>= 1for live descriptors sodword_0 > 0null checks behave accurately.image_descriptor_dword0_width_proxy_null_check_lowersincrates/victory-shader/src/emit/lower.rs's#[cfg(test)]module (not gated onwindows), checking lowering success,DXBC/DXILcontainer structure, andnonuniform_handles == 0, and updated the comments indiff_tests.rs.Checked
cargo xtask policy(clean); thestride_testsandgathers_at_a_levelfailures were already present onmainat70564ae.@upipibi on GitHub · 2026-11-25 00:25 UTC · original
Re-checked
485a943on the RTX 3070 (driver 616.56, Windows 11, debug).cargo test -p victory-shader --lockedgives 209 passed, 3 failed, 2 ignored. The 3 are #1744's NVIDIA failures onmain(the twostride_testsheap-buffer reads andgathers_at_a_level_match_the_hardware). It builds again, andimage_descriptor_dword0_width_proxy_null_check_lowerspasses.AI-assisted (Claude Code).
@Marvisak on GitHub · 2026-11-25 07:25 UTC · original · edited 2026-11-25 22:18 UTC
Automated triage for the maintainers.
Needs rebase. This PR no longer merges cleanly into
main(conflict incrates/victory-shader/src/emit/lower.rs). It will be reviewed again once it is rebased.From the earlier needs-work note, still open: show the title only null-tests descriptor dword 0 and limit the lowering to that pattern (keep the refusal elsewhere), justify or drop the
stride << 16dword 1, drop the re-braced arms, and make the description match the code.Generated by Claude Code
@sinan-cmyk on GitHub · 2026-11-25 12:11 UTC · original
Offline measurement on a retail dump
Result: no count change against
main.I merged head
485a9439ontomain940d32f(clean merge) and ranvictory translate --validate --listonshaders.rpf(1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result withmainprogram by program (25,889 programs). Validated: 23,918 onmain, 23,918 with this PR.No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.
No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.