shader_cache: the key holds LEONIDA_GROUP_PACK and the translator's own switch fingerprint

A run with LEONIDA_GROUP_PACK=4 was served the unpacked translations an earlier run had
cached (hits only, no misses; packed_direct=0 packed_indirect=0 in the frame line): the
runtime's key listed switches by hand and the new one was only in the shader crate's
list. The key now also takes leonida_shader::emit::translation_fingerprint(), which
covers every LEONIDA_* switch the translator reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
NotRexed
2026-11-27 06:56:01 -05:00
parent 306ec38a3b
commit 0baa9278cb

View File

@ -86,6 +86,9 @@ fn build() -> [u8; 32] {
"LEONIDA_LDS_FLAGS",
"LEONIDA_EXCHANGE_SITES",
"LEONIDA_UNIFORM_LOADS",
// Leonida: group packing changes the program's group size and words (emit/lower.rs group_pack);
// without it here a run with it set was served the unpacked translations of an earlier run.
"LEONIDA_GROUP_PACK",
] {
bytes.extend_from_slice(name.as_bytes());
bytes.push(b'=');
@ -96,6 +99,9 @@ fn build() -> [u8; 32] {
}
// And which clean-up passes ran over the translated code.
bytes.extend_from_slice(&leonida_shader::emit::shader_opt().to_le_bytes());
// Leonida: and every `LEONIDA_*` switch the translator itself reads (its build script lists them), so a
// switch added there without a line above cannot be served a translation made with another value.
bytes.extend_from_slice(&leonida_shader::emit::translation_fingerprint());
bytes
});
let mut hash = blake3::Hasher::new();