From 3f48d842960c6d7e3814b75c611c69209098a0b6 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Wed, 10 May 2023 19:49:22 +0200 Subject: [PATCH] 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 Part-of: --- src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs b/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs index ed5f7df..d6458da 100644 --- a/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs +++ b/src/gallium/frontends/rusticl/mesa/compiler/clc/spirv.rs @@ -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("")); -- 2.7.4