( device: GPUDevice, stage: ShaderStageModuleSource )
| 85 | }; |
| 86 | |
| 87 | const getStageModule = ( |
| 88 | device: GPUDevice, |
| 89 | stage: ShaderStageModuleSource |
| 90 | ): { readonly module: GPUShaderModule; readonly entryPoint: string; readonly constants?: Record<string, GPUPipelineConstantValue> } => { |
| 91 | if ('module' in stage) { |
| 92 | return { |
| 93 | module: stage.module, |
| 94 | entryPoint: stage.entryPoint || '', |
| 95 | constants: stage.constants, |
| 96 | }; |
| 97 | } |
| 98 | |
| 99 | return { |
| 100 | module: createShaderModule(device, stage.code, stage.label), |
| 101 | entryPoint: stage.entryPoint || '', |
| 102 | constants: stage.constants, |
| 103 | }; |
| 104 | }; |
| 105 | |
| 106 | /** |
| 107 | * Creates a shader module from WGSL source. |
no test coverage detected