rusticl/spirv: Key optional clc features when caching.

Sadly I can't use serde yet, so I have to do this nonsense.

Signed-off-by: Karol Herbst <git@karolherbst.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23532>
This commit is contained in:
Karol Herbst
2023-05-10 19:49:22 +02:00
committed by Marge Bot
parent 23cbe6b0d5
commit 3f48d84296

View File

@@ -98,6 +98,10 @@ impl SPIRVBin {
key.extend_from_slice(h.source.as_bytes());
});
// Safety: clc_optional_features is a struct of bools and contains no padding.
// Sadly we can't guarentee this.
key.extend(unsafe { as_byte_slice(slice::from_ref(&features)) });
let mut key = cache.gen_key(&key);
if let Some(data) = cache.get(&mut key) {
return (Some(Self::from_bin(&data)), String::from(""));