Shaders: lower unlisted table constant buffer loads as guarded raw SRVs #2066
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2068"
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?
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T04:20:32Z.
Closes #1595.
Summary
s_buffer_load_dword*) fromRootType::Tabledescriptors with no matchingUsedResourceentry (kind.is_none()) as guarded raw buffer SRVs(11, 0)instead ofcbufferLoadLegacyCBV handles(13, 0x1_0000).heap_constants, unlisted-tableself.heaptracking, andLower::buffer_guardstrictly to descriptors whose leaves are all tracked loads fromRootType::ResourceHeaporRootType::Table(is_view_heap/is_unlisted_table), leavingSource::Constant,Source::Built, other root parameters, andVIEW_STRIDESbuffer-vs-non-buffer (stride == 0) semantics unchanged.Verification
emit::stride_tests::an_unlisted_table_constant_load_reads_as_a_raw_buffer: tests unlistedRootType::Tables_buffer_load_dwordagainstView::NullTexture1d(slot 0 -> 0),View::Texture(slot 1 -> 0), andView::Buffer(slot 2 -> 9) across NVIDIA GeForce RTX 5090, AMD Radeon(TM) Graphics, and D3D12 WARP.emit::stride_tests::unlisted_table_constant_lowering_rejects_non_heap_sources: verifiesSource::Constant,RootType::Constants, and mixedTable+Constantphis remain rejected while pureTablephis lower and validate viadxil.dll.cargo clippy -p victory-shader --tests --locked -- -D warningsandcargo xtask policy: passed.Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T04:31:10Z.
Review: APPROVED
Verified locally merged onto
origin/main(940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):cargo test -p victory-shader --lib an_unlisted_table_constant_load_reads_as_a_raw_buffer— passed on both RTX 5090 hardware andVICTORY_D3D12_WARP=1cargo test -p victory-gpu --lib table_stride_separates_shader_and_unordered_buffers— passedcargo clippy -p victory-shader -p victory-gpu --all-targets— 0 warningscargo xtask policy— ok (183 files ok)Clean lowering of unlisted table constant loads as raw SRVs and separation of SRV/UAV buffer guards across
victory-shaderandvictory-gpu. Looks good.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T04:33:53Z.
Review: APPROVED
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main
940d32f69b,cargo test -p victory-shader --locked.144 passed / 0 failed / 2 ignored. Unlisted table constant loads as raw SRVs — table-constant fallback path; mixed gpu+shader, gpu half Windows-only.
Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-25T04:27:36Z.
Triage verdict — Keep the descriptor-kind fixes, leave #1595 open for typed-null coverage (
cba3f26)Evidence
Checks and limits
Next step
This verification was AI-assisted.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T05:10:49Z.
Thanks @jeremygold02 — pushed
421de01caddressing all three points:#2030texture D16 rounding tags: movedVIEW_STRIDE_UAVdown to1 << 28(VIEW_BUFFER_STRIDE_MASK = (1 << 28) - 1), leaving bits29..=31untouched for texture metadata while covering the 14-bit GFX10 buffer stride range (0..=16383).RootType::Tablebuffer handles: whenself.used_kind(src).is_none(),buffer_guardandself.heap[0] = truenow run alongside the dynamic-heap path so unlisted table constant loads get the exact SRV byte-length guard and refresh the stride table.View::NullTexture1dat heap slot0alongside normalized texture tag bits (0xC000_0000/0xE000_0000) and SRV vs. UAV stride separation.Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T09:18:16Z.
Offline measurement on a retail dump
Result: no count change against
main.I merged head
421de01contomain940d32f(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).
[PR #2068] Shaders, GPU: lower unlisted table constant loads as raw SRVs and separate SRV/UAV buffer guardsto [PR #2068] Shaders: lower unlisted table constant buffer loads as guarded raw SRVsImported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T10:25:20Z.
Automated triage for the maintainers.
Recommended for a look (merge candidate). After the rebase, scalar buffer loads whose descriptor comes from a table slot with no used-resource entry are lowered as raw buffer SRV reads, guarded through the view-stride table, instead of
cbufferLoadLegacy(Lowerincrates/victory-shader/src/emit/lower.rs:heap_constants,buffer_guard, and the newis_view_heap/is_unlisted_table). Such reads also mark the program as heap-reading. I checked that the new predicate only accepts descriptors whose leaves are all loads fromResourceHeap/Tableparameters, so constants, built descriptors and mixed phis keep the old path (the newunlisted_table_constant_lowering_rejects_non_heap_sourcestest covers this).View::NullTexture1dinemit/host.rsis used only by the test fixture. This head no longer contains the polarity and bit-31 changes discussed above, and #1595 supplies the behaviour being fixed. A retail offline run reported no change in validated programs. CI:checkpassing on this head.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T11:02:18Z.
Updated in
7c8c0f7dper triage feedback:VIEW_STRIDE_UAV/Lower::buffer_guardSRV-vs-UAV polarity changes (crates/victory-gpu/src/descriptor/host.rsandshader.rsare untouched relative tomain, andbuffer_guardonly redirectsstride == 0non-buffer slots as onmain).smem'sheap_constantsexpansion and unlisted-tableself.heap/buffer_guardhandling strictly to descriptors whose leaves are all tracked loads fromRootType::ResourceHeaporRootType::Table(is_view_heap/is_unlisted_table), addingunlisted_table_constant_lowering_rejects_non_heap_sourcesto lock outConstant,RootType::Constants, and mixedTable+Constantphis.#2030's normalized-format tag encoding.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:05:36Z.
Automated triage for the maintainers, second look (a review against current
main, with builds and tests where they could change the verdict).Closing because the issue it closes, #1595, is fixed in
mainat the source: heap-direct constant data is read through raw views (c75fdba3), and a zero view-stride entry selects a null buffer view (d71c3889). What this adds is the case of a table descriptor that no used-resource entry covers, and no title program has one (a whole-set run onmainreports "0 traced parameters not listed"). The tests also add their own adapter enumeration and a newVICTORY_WARPswitch beside the existingHost::new(warp).If this is mistaken, reply here with what was missed and it will be looked at again. Thank you for the contribution.
Pull request closed