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

Open
github-bot wants to merge 1 commit from github-bot/gh-2916 into main AGit
Owner

@⁠Proudnoob4 on GitHub · 2026-11-29 18:48 UTC · original
Proudnoob4:pr/code-table-loads → main · +75 −0 · 2 files · 1 commits · open

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.

**@⁠Proudnoob4** on GitHub · 2026-11-29 18:48 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2916) `Proudnoob4:pr/code-table-loads` → `main` · +75 −0 · 2 files · 1 commits · open ## 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.
A constant table the compiler appends to the code is read through `s_getpc_b64`: scalar loads (`smem`, the
`Source::Built { param: CODE }` case) and `global_load` (`flat`) of it were lowered from the table already,
but a vector buffer load through a descriptor built around the PC (`s_getpc_b64`, `s_add_u32` of the
table's offset, then `buffer_load_dword ... offen` through `s[n:n+3]` with num_records set) went to
`handle`, which refused it ("a descriptor built around a table in the code"). A load has no effect of its
own, so the refusal only left its registers missing and the joins after it read 0: the program still
translated, wrong, and nothing was logged.

The title's ACES tone-map table bake, in the form it hands to DeserializeComputePipelineStateX (0x218),
reads its spline coefficients so: all 18 of its coefficient loads read 0, and every cell of the 32^3 table
it bakes came out one colour. Its plain container's code reads the same table with `global_load`, which
translated, so regular pipelines did not meet this.

Now such loads read the table's dwords (`code_dword`), 0 at bytes past the descriptor's size as the
console's range check gives; stores, atomics, typed, sub-dword and indexed accesses through one stay refused.

Checked offline: the DXIL of that 0x218 program, run for six cells of the table by an interpreter beside the
DXIL of its plain container, stored the same values in all six (before: one colour in every cell).
Test: a_vector_load_through_a_descriptor_built_around_a_table_in_the_code (refused before).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 18:51:24 +00:00
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/lower/tests.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2916/head:github-bot/gh-2916'
git switch 'github-bot/gh-2916'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2916'
git switch 'github-bot/gh-2916'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2916'
git switch 'github-bot/gh-2916'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2916'
git switch 'main'
git merge --squash 'github-bot/gh-2916'
git switch 'main'
git merge --ff-only 'github-bot/gh-2916'
git switch 'main'
git merge 'github-bot/gh-2916'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

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