shader cache: key on the translator's environment switches #285
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/285"
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?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by maaalrey on 2026-11-27T08:44:44Z.
What this changes
Refs #284
The native shader cache keys on the translator's sources, the entry encoding, the loop limit and the translation
Options. It doesn't key on the switches the translator reads from the environment while it translates:VICTORY_DEBUG_PS,VICTORY_DEBUG_PS_RED,VICTORY_DEBUG_VS_PARAM,VICTORY_DEBUG_VS_POS,VICTORY_DEBUG_VS_TRIandVICTORY_NO_LOCKSTEP. That has two effects:VICTORY_DEBUG_PS_RED=1 VICTORY_DEBUG_VS_TRI=1left every target black, because no shader was translated again.victory_shader::emit::TRANSLATION_SWITCHESlists the switches, andtranslation_switches()returns those that are set asNAME=valuelines, read once per process.shader_cache::build()hashes that text into the build key next to the loop limit, and logs a warning when any switch is set. Docs:native-host.md(the Translations cache entry) and the debug-graphics skill.How it was tested
the_key_covers_translator_encoding_and_settingsnow covers the switches.the_translation_switches_list_only_those_setchecks the listing.every_environment_switch_the_translator_reads_is_keyedscanssrc/emitand fails when aVICTORY_switch read there is in neither the translation list nor the short list of switches that are keyed another way or change no translation (VICTORY_SHADER_LOOP_LIMIT,VICTORY_WARP,VICTORY_PC_DXC,VICTORY_DXIL).cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory: 381 passed, 0 failedcargo test -p victory-hle -p victory -p victory-gpu -p xtask -p victory-shader(arm64): all passed butdescribed_rectangle_list_draw_uses_supplied_triangles. That test needs the Metal Shader Converter at its default path; it passes withVICTORY_MSC_DYLIBset.cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings: cleancargo xtask policy: okChecklist
VICTORY_*variable and documented (none new; existing switches documented as keyed)Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T10:32:29Z.
Thank you. Putting the debug switches into the cache key is right, and the test that fails when a new
VICTORY_switch is read inemitand listed nowhere is a good guard. Your workflow has not run; it needs my approval. The branch is behind main, please update it. I have not run it.Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by maaalrey on 2026-11-27T10:50:42Z.
Updated: main (
ce2b786) merged in. The switch scan still passes with main's new code, so everyVICTORY_read inemitis listed. The cache-key tests pass,cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warningsis clean with and without--all-features, andcargo xtask policyis ok. Thanks for the review.