Shaders: trace a geometry program's signature memory #3220
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3222"
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 kotekompotek on 2026-11-26T13:37:52Z.
Grand Theft Auto VI's
GS_VoxelizeGenericprograms (all 195 of them - the single biggest refusal bucket invictory translate --list shaders.rpf) keep the pointer to their root signature memory in user data 0-1 - their first user SGPRs, s[8:9] - and load through it like a compute program does through s[0:1]:spill_loadswas gated onHwStage::Cs, so the base address wasn't recognized asUSER_DATAmemory and the program was refused with "an address in an SGPR that is no root parameter".Now
spill_loadsandparam_word's spilled path admitHwStage::Gs, reading the pointer fromstage.user_sgpr(0..1)instead of hardcoding s[0:1]. A geometry program's signature memory is there whenever user data 0-1 holds no parameter (it doesn't need the >16-dwords overflow condition compute has).Verified on six real
GS_VoxelizeGenericprograms extracted fromshaders.rpf(v1.0.2.1) - all six now trace toUSER_DATAaddresses instead of failing. Regression test synthesizes the prologue + load.Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T13:50:41Z.
Review: APPROVED
Verified against
origin/main(63bcca4):cargo test -p victory-shader --lib resource::tests:: -- --test-threads=1: 36/36 passed (includinga_geometry_programs_signature_memory_loads_through_its_pointer).cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly traces a geometry program's signature memory loads through its pointer.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Venom2054 on 2026-11-26T13:45:35Z.
I repeated the resource-tracking test on all 195 distinct
GS_VoxelizeGenericgeometry shader containers in my local index, using the same inputs on the parent63bcca43and PR head879f2126.resource::trackrefused all 195 at instruction0x44because it could not identify the address in the scalar register pair.resource::tracksucceeded for all 195. In each case it identified one load fromUSER_DATAat that instruction.emit::translateentry point, both revisions still refused all 195 at stage selection, before producing DXIL. A separate compute control emitted 2,160 bytes of DXIL and passed the Windows SDK validator on both revisions.This confirms the signature-memory fix across the whole family. It leaves geometry-stage translation and in-game rendering as separate checks. Codex assisted with the offline comparison.
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T18:15:56Z.
Full-pack verification,
victory translate --liston the shipped shaders.rpf (v1.0.2.1, 26 503 containers, 26 084 programs):The 195 programs do not just track now — they emit: mesh programs stay 8 765 / 8 765 emitted. Every remaining refusal in the pack is a different, already-accounted bucket (13 lane-mask join — FIND-6; 5 v_cvt_f32_f64 — #1262; 4 lane mask read as data — FIND-6; 1 descriptor read only as data — #329; 1 barycentrics; 1 v_permlanex16_b32).
Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-26T22:43:15Z.
NVIDIA full-suite run, to go with the reports above by Dukestar69, since none of them names a GPU run. Tested exact head
879f212(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 867 passed, 0 failed, 10 ignored.a_geometry_programs_signature_memory_loads_through_its_pointer.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T23:35:45Z.
Review: CHANGES_REQUESTED
Thanks for extending signature memory tracking to
HwStage::Gs! One regression againstmaincame up inparam_word:user_data >= 16lose their high half (crates/victory-shader/src/resource.rs:488, 546, 641, 941-943):Line 546 now routes all
user_data >= 16lookups onHwStage::Cs | HwStage::Gsexclusively toself.first_spilled. However,spill_loads()explicitly skips spill scanning wheneverself.layout.iter().any(|p| p.user_data < 2 && p.sgprs > 0)(line 488), leavingself.first_spilledempty. Because merged GS stages have up to 32 user SGPRs (s[8 + user_data]), if a GS layout occupiesuser_data < 2and also passes aRootType::Descriptorin entry SGPRs atuser_data >= 16,param_of(line 641) matches the incoming SGPR, butparam_word(param, 1)now returnsNoneinstead of reading the incoming high SGPR (asmaindid), causing line 943 to fail with"a root descriptor without its high half".Gating line 546 on whether signature memory is active for GS (e.g.
if self.stage == HwStage::Cs || !self.layout.iter().any(|p| p.user_data < 2 && p.sgprs > 0), or falling back to entry SGPRs whenself.first_spilledis empty onHwStage::Gs) preserves register-backed GS descriptors cleanly.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.