fix(vk): a new Program member no longer drops every player's shader cache #3059
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!3059
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:fix/shader-cache-stamp"
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?
Summary
Some updates made every player prepare all their shaders again although nothing about the shaders had changed. One cause: the shader caches' stamp held
sizeof(Program), so any member added to that struct, even one only the running game reads, dropped every cache (251.6 s on a Steam Deck in a tester's run of #223). A cache record is written field by field, so that size measured only members nobody stores.This takes it out of the stamp, and adds two inputs the stamp missed: the compute mesh path's record layout as resolved (its default lives in
mesh_mode.h, which no stamp held) and libstdc++'s version. A new check holds what the stamp takes, what is written as it lies, and which headers the stamped files include.Read first:
translator_stampingpu/vk/vk_shader.cpp, thentests/test_translator_stamp_inputs.py.Not done here: tracking which translator parts each program used. By the files they touch, 18 of the 20 translator changes since v3.1.0 changed shared code and would still have redone everything, so it is not worth its risk as designed.
Fixes #1510
Testing
Tested: Linux, RTX 3090 (NVIDIA 620.70.06).
dev.py rtbuilt and prepared 38,809 programs;dev.py smokepassed (in play fromkokiri-start, 900 frames, the menu opened). Then a throwaway build with an unused member added toProgramwas run on the same folder: the log says544 program keys kept, 1375 KB, the programs the first run translated (the sandboxed run keeps its ownlongshot_programs.fallback.bin).tests/test_translator_stamp_inputs.pypasses here and fails onmain(sizeof(Program)).mise run test: 864 passed, 6 failed, 12 skipped; all six failing files also fail onmain@9a926c2e.Still to test:
Measurements
Nothing to measure: no speed or picture change. The effect is whether a cache is kept, shown in Testing.
Risks
The stamp moves once, so the first start after this prepares the shaders again.
mainalready changed translator files since v3.2.0, so stable players pay nothing extra; nightly players pay it once.A member added to
Programthat does need keeping must be written input_head/program_cache_saveand take a newkProgramCacheFormat; before, the size change dropped the old cache by accident. Reverting is enough.Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named):test_framegen_auto_dlss,test_menu_ini_keys,test_option_ids,test_settings_area_keys,test_vk_wb_cpu_words_fastandtest_lifteralso fail onmain@9a926c2e.main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here.tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.🤖 Generated with Claude Code
Tested in game: Linux, RTX 3090, NVIDIA 620.70.06: dev.py smoke from kokiri-start passed (900 frames in play, the menu opened). A second run with a throwaway build that adds a member to Program kept all 544 program keys the first run translated.
WIP: fix(vk): a new Program member no longer drops every player's shader cacheto fix(vk): a new Program member no longer drops every player's shader cache