1
1
use alloc:: {
2
- borrow:: Cow ,
3
2
string:: { String , ToString as _} ,
4
3
vec,
5
4
vec:: Vec ,
@@ -11,9 +10,9 @@ use crate::*;
11
10
/// Handle to a compiled shader module.
12
11
///
13
12
/// A `ShaderModule` represents a compiled shader module on the GPU. It can be created by passing
14
- /// source code to [`Device::create_shader_module`] or valid SPIR-V binary to
15
- /// [`Device::create_shader_module_spirv `]. Shader modules are used to define programmable stages
16
- /// of a pipeline.
13
+ /// source code to [`Device::create_shader_module`]. MSL shader or SPIR-V binary can also be passed
14
+ /// directly using [`Device::create_shader_module_passthrough `]. Shader modules are used to define
15
+ /// programmable stages of a pipeline.
17
16
///
18
17
/// Corresponds to [WebGPU `GPUShaderModule`](https://gpuweb.github.io/gpuweb/#shader-module).
19
18
#[ derive( Debug , Clone ) ]
@@ -182,14 +181,14 @@ pub enum ShaderSource<'a> {
182
181
///
183
182
/// See also: [`util::make_spirv`], [`include_spirv`]
184
183
#[ cfg( feature = "spirv" ) ]
185
- SpirV ( Cow < ' a , [ u32 ] > ) ,
184
+ SpirV ( alloc :: borrow :: Cow < ' a , [ u32 ] > ) ,
186
185
/// GLSL module as a string slice.
187
186
///
188
187
/// Note: GLSL is not yet fully supported and must be a specific ShaderStage.
189
188
#[ cfg( feature = "glsl" ) ]
190
189
Glsl {
191
190
/// The source code of the shader.
192
- shader : Cow < ' a , str > ,
191
+ shader : alloc :: borrow :: Cow < ' a , str > ,
193
192
/// The shader stage that the shader targets. For example, `naga::ShaderStage::Vertex`
194
193
stage : naga:: ShaderStage ,
195
194
/// Key-value pairs to represent defines sent to the glsl preprocessor.
@@ -199,10 +198,10 @@ pub enum ShaderSource<'a> {
199
198
} ,
200
199
/// WGSL module as a string slice.
201
200
#[ cfg( feature = "wgsl" ) ]
202
- Wgsl ( Cow < ' a , str > ) ,
201
+ Wgsl ( alloc :: borrow :: Cow < ' a , str > ) ,
203
202
/// Naga module.
204
203
#[ cfg( feature = "naga-ir" ) ]
205
- Naga ( Cow < ' static , naga:: Module > ) ,
204
+ Naga ( alloc :: borrow :: Cow < ' static , naga:: Module > ) ,
206
205
/// Dummy variant because `Naga` doesn't have a lifetime and without enough active features it
207
206
/// could be the last one active.
208
207
#[ doc( hidden) ]
0 commit comments