Repository navigation
Shaders: treat RootType::Constants dword 0 as an offset in Tracer::sum - #2154
fuzeofficlal wants to merge 1 commit into
Conversation
…in Tracer::sum Tracer::sum treated dword 0 of every root parameter as a base address, which made dword 0 of RootType::Constants behave unlike dwords 1 and up: passing it as an SMEM soffset or global vaddr failed with "an offset from a root parameter", and adding it to a descriptor table or root descriptor base dropped the base because both terms carried one. Exclude RootType::Constants from the dword-0 base arm so all root-constant dwords trace as dynamic terms, while 64-bit pointers passed in root constants still classify as title memory through why_no_base.
|
I checked the shared-address case against #139, which changes the same tracer. To reproduce, take its &[TABLE, RootParam { root: RootType::Constants, user_data: 9, slot: 1, ..TABLE }]This leaves the table at s8 and makes s9 the first dword of a constants parameter. On This covers the tracker output for those two reads. Cache-hit rates and GPU execution were outside this test. AI-assisted. |
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, Rust 1.98.1 MSVC):
cargo test -p victory-shader --lib root_constant_zero_offsets— 2 passed, 0 failed (root_constant_zero_offsets_tables_and_root_descriptorsandroot_constant_zero_offsets_emit_to_dxil)cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok (183 files ok)
Clean fix treating RootType::Constants dword 0 as an offset in Tracer::sum with targeted unit tests. Looks good.
AI-assisted (Gemini 4 Neon).
catminou4
left a comment
There was a problem hiding this comment.
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f, cargo test -p victory-shader --locked.
146 passed / 0 failed / 2 ignored. RootType::Constants dword 0 treated as offset in Translate (+2 tests) — root-constant offset semantics fix.
|
I ran your mixed table and root-descriptor fixture through an actual WARP dispatch. On 940d32f it fails at translation with "an offset from a root parameter". On 3a314c8 DXIL validates, then constant dword 0 selects the expected table entry and offsets the root SRV. At byte offsets 0 and 64 the two output buffers read [103, 0] and [0, 207], respectively. d886064 is a test-only commit on that exact head. It reuses the existing synthetic program. Run the new readback explicitly with root_constant_zero_offsets_dispatch_to_the_selected_buffer --ignored. Strict shader Clippy and staged asset policy passed. The full forced-WARP suite on your head was 246 passed, 3 failed, 4 ignored, with the three failures also present in the main comparison. |
Offline measurement on a retail dumpResult: no count change against I merged head 3a314c8 onto 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). |
|
Automated triage for the maintainers. Merge candidate.
I checked that a constants (dword 0, dword 1) pair used as a 64-bit pointer still ends at A WARP readback and the #139 fixture check posted in the thread agree. A whole-title offline count shows no validation change, so this is a correctness fix with no measured title effect yet. CI: passing ( Generated by Claude Code |
Problem
Tracer::sum(crates/victory-shader/src/resource.rs:670) treatsparam_value(v) == Some((_, 0))as an addressbaseregardless ofRootType. When a shader usesdword 0of aRootType::Constantsparameter (either in an entry SGPR or loaded from spilledUSER_DATA) as a 32-bit byte offset — whereasdword 1, 2, ...work — two cases fail:soffsetorglobal_*vaddroffset fails withErr("an offset from a root parameter").RootType::Table,ResourceHeap, orDescriptorbase vias_add_u32hitsx.base.is_some() && y.base.is_some()and discards the table/descriptor base.Changes
RootType::Constantsfrom theSome((p, 0)) => Sum { base: Some(v), .. }arm inTracer::sum(64-bit pointer pairs(dword 0, dword 1)inRootType::Constantscontinue to route toMEMORYviaTracer::address).root_constant_zero_offsets_tables_and_root_descriptorsandroot_constant_zero_offsets_emit_to_dxilcovering direct and spilleddword 0offsets on descriptor tables and root descriptors alongside 64-bitMEMORYpointer pairs (dxil.dllvalidated).