Shaders: the code table starts after the instructions (RTX 5090 Xid 13, GBs of VRAM on other NVIDIA cards) #550
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!550
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-550"
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?
@kibagami-nc on GitHub · 2026-11-28 00:39 UTC · original
kibagami-nc:fix/code-table-after-instructions→main· +50 −6 · 2 files · 1 commits · openThe problem
code_dword(crates/victory-shader/src/emit/lower.rs) turns the program's code into a constant table, starting at the lowest offset any load or descriptor names. A load at a computed offset names offset 0, so the table is the whole program: 4,160 to 4,596 dwords (16 to 18 KiB) in the lighting computes reached at world entry.NVIDIA's compiler keeps up to 16 KiB of such arrays in constant memory and copies a larger one into every thread's local memory:
The change
A program's constants follow its instructions, and a load at a computed offset reads them. So the table now starts where the instructions end, unless a load at a fixed offset reads below that. A computed index below the start is clamped, like one past the end, as before.
Upstream logged 1,149 code-table reads in 114 programs. None of them falls below the new start, and the tables that were 3,200 to 4,600 dwords are now 154 to 177.
This is a port of desplmfao's fix (Marvisak/VIctory#2143, commits 524e2834 and a68ae559), as carried to fxceless/victory-fork#1006. The regression test is in emit's own test module, with
code_table_startmadepub(super)for it.The shader cache key (
env!("VICTORY_TRANSLATOR")) follows the translator's source, so translations cached with the old tables are made again.Tests
cargo test -p victory-shader: 290 passed, 4 ignored.cargo clippy --workspace -- -D warningsalready stops on lintsmainhas (see #425, #265 and #86). This change adds no warning.No game files, dumps or extracted data are included.
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.