Load shader from disk

This commit is contained in:
marceline-cramer 2022-02-15 17:18:10 -07:00
parent 36fa7a9dea
commit e18a434581
1 changed files with 6 additions and 1 deletions

View File

@ -140,7 +140,12 @@ impl Renderer {
push_constant_ranges: &[],
});
let shader = device.create_shader_module(&wgpu::include_wgsl!("shader.wgsl"));
let shader = device.create_shader_module(&wgpu::ShaderModuleDescriptor {
label: Some("shader.wgsl"),
source: wgpu::ShaderSource::Wgsl(
std::fs::read_to_string("src/shader.wgsl").unwrap().into(),
),
});
let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
label: Some("Render Pipeline"),