Shaders: vector buffer loads through a descriptor built around a table in the code #2916

Open
Proudnoob4 wants to merge 1 commit from upstream-pr/2916 into main
Proudnoob4 commented 2026-11-29 18:48:11 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Proudnoob4 on 2026-11-29T18:48:11Z.


What it fixes

A vector buffer load through a descriptor built around the PC (s_getpc_b64, s_add_u32 of the table's offset, the descriptor in s[n:n+3] with num_records set, then buffer_load_dword ... offen) was refused inside handle ("a descriptor built around a table in the code"). A load has no effect of its own, so this did not refuse the program: it only left the loaded registers missing, the joins after it read 0, and nothing was logged. Scalar (smem) and global_load reads of such tables were lowered already.

Where it shows: the title's ACES tone-map table bake, in the form it hands to DeserializeComputePipelineStateX (0x218), reads its spline coefficients this way. All 18 coefficient loads read 0 and the 32³ table it bakes came out one colour. The plain container of the same shader reads the table with global_load, so regular pipelines don't meet this.

How

The load reads the table's dwords through code_dword, as the scalar path does, with 0 at bytes past the descriptor's size (the console's range check). Stores, atomics, typed, sub-dword and indexed accesses through such a descriptor stay refused.

Tested

  • New unit test a_vector_load_through_a_descriptor_built_around_a_table_in_the_code (hand-assembled GFX10; fails on main).
  • Offline: that 0x218 program's DXIL, run for six cells of the table in an interpreter next to the DXIL of its plain container, stores the same values in all six (on main: one colour in every cell).
  • In game with VICTORY_DESERIALIZE_COMPUTE=1 (RTX 4080 16 GB, 1440p, DLSS Quality; a build with this change and other open PRs): the scene is still grey. So this removes one cause, not the last one on that path, and the switch should stay off.
  • cargo test -p victory-shader --lib --locked: 412 passed, 51 failed. Main gives 411 and the same 51 here, all for want of an SM 6.6 device (Windows 10, test binaries without the Agility SDK); none fails only with this change.
  • CI: the clippy gate currently fails on main's own crates/victory-loader/src/crash.rs:804 (as on other open PRs, e.g. #2487), before it reaches this change.

AI-assisted.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5553923369 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2916). Originally posted by [Proudnoob4](https://github.com/Proudnoob4) on 2026-11-29T18:48:11Z. --- ## What it fixes A vector buffer load through a descriptor built around the PC (`s_getpc_b64`, `s_add_u32` of the table's offset, the descriptor in `s[n:n+3]` with num_records set, then `buffer_load_dword ... offen`) was refused inside `handle` ("a descriptor built around a table in the code"). A load has no effect of its own, so this did not refuse the program: it only left the loaded registers missing, the joins after it read 0, and nothing was logged. Scalar (`smem`) and `global_load` reads of such tables were lowered already. Where it shows: the title's ACES tone-map table bake, in the form it hands to `DeserializeComputePipelineStateX` (0x218), reads its spline coefficients this way. All 18 coefficient loads read 0 and the 32³ table it bakes came out one colour. The plain container of the same shader reads the table with `global_load`, so regular pipelines don't meet this. ## How The load reads the table's dwords through `code_dword`, as the scalar path does, with 0 at bytes past the descriptor's size (the console's range check). Stores, atomics, typed, sub-dword and indexed accesses through such a descriptor stay refused. ## Tested - New unit test `a_vector_load_through_a_descriptor_built_around_a_table_in_the_code` (hand-assembled GFX10; fails on main). - Offline: that 0x218 program's DXIL, run for six cells of the table in an interpreter next to the DXIL of its plain container, stores the same values in all six (on main: one colour in every cell). - In game with `VICTORY_DESERIALIZE_COMPUTE=1` (RTX 4080 16 GB, 1440p, DLSS Quality; a build with this change and other open PRs): the scene is **still grey**. So this removes one cause, not the last one on that path, and the switch should stay off. - `cargo test -p victory-shader --lib --locked`: 412 passed, 51 failed. Main gives 411 and the same 51 here, all for want of an SM 6.6 device (Windows 10, test binaries without the Agility SDK); none fails only with this change. - CI: the clippy gate currently fails on main's own `crates/victory-loader/src/crash.rs:804` (as on other open PRs, e.g. #2487), before it reaches this change. AI-assisted.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2916:upstream-pr/2916'
git switch 'upstream-pr/2916'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/2916'
git switch 'upstream-pr/2916'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2916'
git switch 'upstream-pr/2916'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2916'
git switch 'main'
git merge --squash 'upstream-pr/2916'
git switch 'main'
git merge --ff-only 'upstream-pr/2916'
git switch 'main'
git merge 'upstream-pr/2916'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
trustno1-coder/VIctory-NVIDIA!2916
No description provided.