cart_tmp_wgpu/util/
mod.rs1mod belt;
4
5#[cfg(all(not(target_arch = "wasm32"), feature = "subscriber"))]
6pub use wgc::logging::subscriber::{initialize_default_subscriber, ChromeTracingLayer};
7
8pub use belt::StagingBelt;
9
10#[repr(align(4))]
12pub struct WordAligned<Bytes: ?Sized>(pub Bytes);
13
14pub fn make_spirv<'a>(data: &'a [u8]) -> super::ShaderModuleSource<'a> {
25 const MAGIC_NUMBER: u32 = 0x0723_0203;
26
27 let (pre, words, post) = unsafe { data.align_to::<u32>() };
28 assert_eq!(pre, &[], "data offset is not aligned to words!");
29 assert_eq!(post, &[], "data size is not aligned to words!");
30 assert_eq!(
31 words[0], MAGIC_NUMBER,
32 "wrong magic word {:x}. Make sure you are using a binary SPIRV file.",
33 words[0]
34 );
35 super::ShaderModuleSource::SpirV(words)
36}