Shaders: an address in two root constants is a root view (#614) #667
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/667"
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 AlanQiang0418 on 2026-11-24T06:25:25Z.
Part 2 of #614: the ray-tracing builder passes buffer addresses as a pair of root constants instead of root views, and its programs fail with
an address from a root parameter that is no address.What
resource.rs): a root constant is an address's low half when the next dword of the same parameter is its high half.Address::dwordsays which dword. Halves split over two parameters stay refused.emit/lower.rs,emit/mod.rs,emit/shader.rs): such an address is bound as a root CBV or raw SRV, like root descriptors, at a register that names the parameter and the dword:RootView,(dword + 1) << 8 | slot. A root descriptor's register is still its slot. Root view registers are 16 bits now.draw.rs,pipeline/host.rs): the address is read from the two constants the title set, then bound through the existingroot_viewpath (alignment, scratch copy).VSH2(16-bit registers), so old entries are translated again.Tests
Synthetic programs only, no game data. Windows 11, RTX 5080 (driver 621.14), and WARP.
resource.rs: an address in constants 2 and 3 is traced to that view; halves in two parameters are refused.lower.rs: a compute program reading through a descriptor built around two constants lowers to a root CBV at the new register. The module passesdxil.dllvalidation, andHost::compute_pipelineaccepts it on the RTX 5080 and on WARP.draw.rs: the address comes from the right constants; a missing high half, the wrong parameter kind and the other pipeline kind give none.shader_cache.rs: the round trip includes a 16-bit register.cargo test -p victory-shader -p victory-gpu: 72 + 44 passed. Clippy is clean for the changed code, andcargo xtask policypasses.Not covered
a root UAV or typed root view. The spill table (#302) is also needed before any of this runs in the title.Overlap
VSH2and widens root views, so whichever lands second needs a rebase.Tracer::address/suminresource.rsand stops treating root constants as a base. This PR gives constant-pair addresses their own path inaddress().AI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by LAKSHYA-cmd-tech on 2026-11-24T06:37:11Z.
Review: APPROVED
LGTM! Tested on Windows 11 with MSVC Rust 1.98.1. cargo test -p victory-shader passed (72 passed) and cargo test -p victory-gpu passed (44 passed, 1 benchmark ignored). Tracing addresses passed in root constants into root views cleanly satisfies DXIL validation and D3D12 pipeline creation for ray-tracing builder shaders.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T06:42:15Z.
Review: APPROVED
Verified locally on macOS 26 arm64, rustc 1.98.1 (aarch64-apple-darwin, rust-toolchain.toml) at head
995f7f3:cargo test -p victory-shader --locked: 59 passed, 0 failed (includes the new diff_tests for an address in two root constants)The
victory-gpuside of this PR is Windows-only and can't be exercised on this machine, but the shader-crate changes — the part with the test coverage — are fully green. Approving on that basis; the GPU path still needs a Windows run before merge if the maintainer wants runtime confirmation.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:27:06Z.
Automated triage for the maintainers. Closing because this change is already in
main, ormainhas since replaced the code it patches.An address in two root constants: main reads such addresses as title memory through the page table (resource.rs address(): 'an address from a root parameter that is no address' becomes MEMORY;
27c3dc9d). Same case as #710.If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
upstream-sync referenced this pull request2026-11-25 02:06:28 +00:00
Pull request closed