wgpu_quick_start/
my_shader.rs

1//! Module to create shaders and render pipelines to be used for rendering shapes and objects
2//!
3//!
4
5use std::borrow::Cow;
6
7/// create a shader from the given source, with the given label
8pub fn create_shader<'b>(
9    device: &wgpu::Device,
10    label: String,
11    source: Cow<'b, str>,
12) -> wgpu::ShaderModule {
13    let descriptor = wgpu::ShaderModuleDescriptor {
14        label: Some(label.as_str()),
15        source: wgpu::ShaderSource::Wgsl(source),
16    };
17
18    device.create_shader_module(descriptor)
19}