use encase::{ShaderType, internal::WriteInto};

pub fn to_wgsl_bytes<T: ?Sized + ShaderType + WriteInto>(t: &T) -> Vec<u8> {
    let mut buffer = encase::UniformBuffer::new(Vec::new());
    buffer.write(t).expect("failed to write");
    buffer.into_inner()
}
