refactor: Deprecating cache layout for now

This commit is contained in:
2026-11-22 16:58:05 +01:00
parent 42f85757d5
commit 34e5215001
14 changed files with 165 additions and 222 deletions
+37
View File
@@ -271,6 +271,43 @@ impl AttributesLayout
hash
}
///
/// Produces a wgsl declaration describing this layout :
///
/// ```wgsl
///
/// const ATTRIBUTE_COUNT: u32 = /* attribute count */;
/// const ATTRIBUTE_WORD_COUNTS: array<u32, ...> = {
/// /* word count for attribute 0 */,
/// /* word count for attribute 1 */,
/// ...
/// };
///
///
/// ```
pub fn wgsl_layout_decl(&self) -> String
{
let mut decl = String::new();
decl += &format!("const ATTRIBUTE_COUNT: u32 = {};", self.attributes.len());
// Word counts
decl += &format!(
"const ATTRIBUTE_WORD_COUNTS: array<u32, {}> = array<u32, {}>(",
self.attributes.len(),
self.attributes.len()
);
for attribute in self.attributes.iter()
{
decl += &format!(" {},", attribute.word_count);
}
decl += ");";
decl
}
}
fn fnv1a(hash: &mut u64, bytes: &[u8])