Shaders: read program constant tables from a root SRV instead of per-thread scratch #8
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/ImTaneax--VIctory-RTX3050-4gb!8
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-8"
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?
@adib-cyber007 on GitHub · 2026-12-02 08:41 UTC · original
adib-cyber007:pr/5-shader-const-table-srv→main· +197 −8 · 18 files · 1 commits · openPort of
DoubleGhosty/cool_foxea59cc01(PR #176, GPL-3.0), usingSLOT_CODE_TABLE = 249so it does not collide with this fork'sSLOT_VIEW_ADDRESSES = 250.Why (high impact for 4 GB VRAM / 16 GB RAM)
When a shader keeps its program constant table as an internal constant array and indexes it dynamically, NVIDIA's driver puts it into per-thread scratch memory and reserves ~125 MB per KB of table across all GPU warp slots — never freed. The title's 17–21 KB hair-strand and fog-raymarch constant tables alone take up to ~4.3 GB on desktop cards, which on a 4 GB RTX 3050 overflows straight into shared system RAM (
5.4–6.5 GBinbench/nightlog.md) and drives pagefile thrashing.Moving constant tables into a single read-only raw root SRV (
SLOT_CODE_TABLE) made once per pipeline eliminates that per-thread scratch allocation.Toggle & Cache
VICTORY_CODE_TABLE_PRIVATE=1keeps the old form for before/after comparison.VICTORY_CODE_TABLE_PRIVATEand cleanly round-tripscode_table(tested with non-empty tables). Runvictory.exe shaders <game_folder>once after merging.Verification
emit::lower::tests::the_code_table_starts_after_the_instructions,emit::tests::the_code_table_starts_after_the_instructions,shader_cache::tests::entries_round_trip_and_reject_damage(including non-emptycode_table), and default +--features diagnosticsbuilds passed with zero new warnings.shaders: read program constant tables from a root SRV instead of per-…to Shaders: read program constant tables from a root SRV instead of per-thread scratchView 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.