Shaders: lower root UAV accesses as ROVs in POPS pixel shaders #2488
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2490"
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 reeledMarek on 2026-11-25T14:48:15Z.
Problem
In
crates/victory-shader/src/emit/lower.rs:self.pops == true,DB_SHADER_CONTROLbit 16),Lower::handle()ORs the ROV flag (0x2000) intoprops.0for UAV handles (0x100B->0x300B). However, theSource::Builtmatch arms only matched0x100Band11, causing any root UAV store/atomic/UAV-annotated load in a POPS pixel shader to fail translation with"a root UAV or typed root view".Lower::root_view()hardcoded(11 | 0x1000, 0)without checkingself.pops, so root UAV heap handles in POPS shaders lost the0x2000ROV annotation (andglobal_load_*on a root UAV, which passesprops.0 == 11intohandle(), also skipped settingflags::ROVS).Fix
props.0 & !0x2000inLower::handle()forSource::Builtroot descriptors so ROV-annotated raw UAV handles (0x300B) route toroot_view(..., true)(orroot_uav_handlewhenroot_memoryis active).Lower::root_view(), whenuav && self.pops, setself.s.flags |= flags::ROVSand annotate the heap handle with(11 | 0x1000 | 0x2000, 0). (Shader::heap_handlestill recordsview_indexbecause0x300B & 0x1000 != 0and0x300B & 0xFF == 11, so write marks keep working.)emit::lower::tests::pops_pixel_shader_lowers_root_uav_accesses_as_rovscoveringbuffer_store_dword,global_store_dword, andglobal_load_dwordon root UAVs in POPS and non-POPS pixel shaders (with and withoutview_marks).Verification
cargo test -p victory-shader --locked(145 passed, 0 failed)cargo test -p xtask --locked(repository_passes_policypassed)cargo clippy -p victory-shader --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings(0 warnings)Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T15:08:46Z.
Review: COMMENTED
Independent verification on Windows,
VICTORY_D3D12_WARP=1(WARP only, no hardware GPU touched). Tested commitd8e54fd834998271d3e6e315b8fe2a312519e32e(clean detached checkout).cargo test -p victory-shader --locked --lib pops_pixel_shader_lowers_root_uav— 1 passed, 0 failed, 0 ignored.if self.popsbranch inroot_viewforced off, the same test fails (panic at the firstl.rovsassert), so it guards the change.cargo test -p victory-shader --locked --lib— 248 passed, 0 failed, 3 ignored (the ignored ones are pre-existing).Code read:
root_view(.., uav=true)now setsflags::ROVSand0x2000under POPS. This covers theglobal_loadroute, wherehandle()seesprops.0 == 11without0x1000and so never adds the ROV bit itself. Theprops.0 & !0x2000mask in the root-descriptor match keeps the0x100Band(Uav, 11)arms matching. The non-POPS path is unchanged, and the test assertsrovs == falsefor it. No problems found.AI-assisted (Claude Code / Claude Sonnet 5.5)
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:58:17Z.
Automated triage for the maintainers.
Needs work: CI fails. Thanks for the rebase and the
root_memorychange. The logic reads right.classify_root_descriptorincrates/victory-shader/src/emit/lower.rsaccepts the ROV bit (0x2000) only on the!root_memoryview arms. Withroot_memory, POPS root UAVs stay refused instead of becoming unorderedroot_uav_handles.root_viewsetsflags::ROVSand0x300Bfor POPS.However, the
checkrun onf11c1b4failsxtaskpolicy::tests::repository_passes_policy:crates/victory-shader/src/emit/lower.rs: 526918 bytes exceeds the 524288-byte limit. The ~160-line test pushes the file over the policy's size cap. Please movepops_pixel_shader_lowers_root_uav_accesses_as_rovs(and, if needed,RootBinding/classify_root_descriptor) into a separate file, for example a#[cfg(test)]module next tolower.rs. Do not changextask/src/policy.rs. With CI green this would be back to a merge candidate.CI: failing (asset policy size limit).
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-25T20:05:17Z.
Updated to address the triage feedback:
0x2000ROV bit mask to the!self.root_memoryarms viaclassify_root_descriptor, keepingself.root_memory+ POPS root UAV refused (Err("a root UAV or typed root view")) instead of silently lowering to an unorderedShader::root_uav_handle.root_memory = true(both POPS refused and non-POPS allowed) alongsideroot_memory = false.Imported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-26T05:55:59Z.
Rebased cleanly onto current
main(63bcca4) and verifiedcargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-msvc --locked -- -D warningspasses.Imported from Marvisak/VIctory. Originally posted by reeledMarek on 2026-11-26T10:21:14Z.
Moved
pops_pixel_shader_lowers_root_uav_accesses_as_rovsintocrates/victory-shader/src/emit/lower/pops_tests.rs(#[cfg(test)] mod pops_tests;) solower.rsstays well below the 512 KiB asset-policy file size cap. Verifiedcargo test -p xtask --locked(6/6 passed) and Windows cross-clippy (-D warnings).Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-27T02:32:25Z.
Independent CPU-only verification on Windows (Rust 1.100.0/MSVC, worktree-local
CARGO_TARGET_DIR,CARGO_BUILD_JOBS=2, no game data).a4f4c72, merge base63bcca4.cargo test --locked -p victory-shader --lib -- emit::lower::pops_tests::pops_pixel_shader_lowers_root_uav_accesses_as_rovs --exact --test-threads=1 --quiet->test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 305 filtered out.git diff --check 63bcca4 HEAD-> exit 0.63bcca4(git grep -c ... crates/victory-shader/src/emit/lower/pops_tests.rs-> exit 1).Only the named synthetic IR-lowering test was replayed; the full crate suite was not run. GPU/driver: N/A (CPU-only lowering test). AI-assisted (Hy4 flash). No game data, assets, extracted shaders or DRM involved.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.