shader: the vertex buffer table is not read from user data where root views are title memory #260
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/260"
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 LakshanSivakumar/Native-Victory-macOS. Originally posted by Sandile-0511 on 2026-11-27T05:37:57Z.
What this changes
Fixes a black window from the first frame on
main(seen on76c001aand on2a3b03d): the menus and the boot movie's sound play with no picture. A guessed vertex program's vertex buffer table was read from user data that no host fills.Since
8f8d72a(#207), a vertex or pixel program translated withzero_copy_memoryreads a root descriptor's address from its user data, because root views are title memory there. The vertex buffer table of a guessed vertex program (graphics::VERTEX_TABLE, slot 253) is aRootType::Descriptorin the layout too. A program that copies s0/s1 before loading through them (s_mov_b32 s2, s0; s_mov_b32 s3, s1; s_load_dwordx4 s[8:11], s[2:3]) reachesLower::userfor that parameter, which now returned the user-data dwords. The host has no root argument for slot 253, gave 0, and the vertex fetch read nothing. The draws are still recorded and encoded, so the frame counters look normal.Lower::usernow leaves the vertex table out of that arm, which is what it did before8f8d72a. Root SRVs and UAVs still go through the page table, so #207's fix for vertex buffers whose pages are mapped apart in the pool is unchanged.Possibly related: #246 reports a black window at
76c001a. I can't tell from that report whether this is its cause.How it was tested
cargo test -p victory-shader -p victory-hleandcargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory: all pass. New teststhe_vertex_tables_address_used_as_a_number_is_refused(the negative asked for in review) andthe_vertex_table_is_not_read_from_user_data_where_root_views_are_title_memory: without the change it fails with[UserData { index: 0, slot: 253, root: Descriptor, dword: 0 }, UserData { index: 1, slot: 253, root: Descriptor, dword: 1 }].cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings(clean, run on a Mac)cargo xtask policy(369 files ok)23911f5and76c001aby the contents of the game window ended at8f8d72a. A temporary log line in the draw path then showed every menu pipeline's vertex binding with user data253:Descriptor:0and253:Descriptor:1; with this change they are gone. Results, one run each:76c001a76c001awith thestage != Cscondition of8f8d72aturned off76c001awith this change2a3b03d2a3b03dwith this changeChecklist
VICTORY_*variable and documented (none added)Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T06:48:35Z.
Thank you for the bisect and for naming the commit that introduced it. The change is one condition and the log line (
253:Descriptor:0/1) makes the cause easy to follow.Before it can merge:
Lower::userit returns the missing value there, but a test should say so.main. Your table shows2a3b03dreaching menus and movie with this change and the world still black. Please say which commit shows the black menus.Animacustoms reports in #258 a black picture during the intro on current main. This may be the cause. I have not checked.
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Sandile-0511 on 2026-11-27T07:46:34Z.
Thank you for the review. All three are done; the new test is in
8612fe4.1. The negative.
the_vertex_tables_address_used_as_a_number_is_refused: three vertex programs that use s0 of the vertex table as a number (exported as it is; copied to another SGPR and exported; with an offset added and exported) are refused with "a root descriptor", with and withoutzero_copy_memory. Without the change the first of them translates withzero_copy_memory, the address read from user data, so the test fails there: that accept goes away with the fix too.2. Corpus, by output fingerprint. 21,608 containers (every shader the title registered in a run that reached the prologue world), translated with
emit::translate_withand the native host's options; this branch against2a3b03d1. Two sweeps of one build are identical.The 415 are exactly the vertex shaders whose translation on main has user data of slot 253: all 415 have it on main, none has it on the branch, and no shader that has it is unchanged. For all 415 the rest of what the host is told (
HostShaderwithout the DXIL) is identical; only the two dwords are gone. 43 of the 415 were bound in that run, 6 of them before the first world frame.3. Which commit shows the black menus. Both mains I have run. The description named only the first; I have corrected it.
76c001a2a3b03d2a3b03dwith this branchThe two
2a3b03drows are from today: one run each, each build in a target directory of its own.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T08:10:19Z.
Thank you. All three points are answered. I ran the branch over my own corpus as well (33,625 containers, by output fingerprint, against main): vertex 415 changed, nothing gained or lost; pixel and compute unchanged. That is your table exactly.
Merged. For testers: if your picture is black in the intro with the sound playing (#258, #265), please update to current main and try again.