Skip to content

Instantly share code, notes, and snippets.

@apriori
Created July 5, 2021 12:11
Show Gist options
  • Save apriori/f1980bc2dfe5fea45159507a73f16976 to your computer and use it in GitHub Desktop.
Save apriori/f1980bc2dfe5fea45159507a73f16976 to your computer and use it in GitHub Desktop.
async fn maybe_watch_compute() -> wgpu::ShaderModuleDescriptor<'static> {
wgpu::include_spirv!(env!("some_shader.spv"))
}
async fn maybe_watch_compute() -> wgpu::ShaderModuleDescriptor<'static> {
let data = std::fs::read(env!("some_shader.spv")).unwrap();
let spirv = wgpu::util::make_spirv(&data);
let spirv = match spirv {
wgpu::ShaderSource::Wgsl(cow) => {
wgpu::ShaderSource::Wgsl(Cow::Owned(cow.into_owned()))
}
wgpu::ShaderSource::SpirV(cow) => {
wgpu::ShaderSource::SpirV(Cow::Owned(cow.into_owned()))
}
};
wgpu::ShaderModuleDescriptor {
label: None,
source: spirv,
flags: wgpu::ShaderFlags::default(),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment