(compile_result: CompileResult)
| 171 | builder.build().unwrap() |
| 172 | }; |
| 173 | fn handle_compile_result(compile_result: CompileResult) -> CompiledShaderModules { |
| 174 | let load_spv_module = |path| { |
| 175 | let data = std::fs::read(path).unwrap(); |
| 176 | // FIXME(eddyb) this reallocates all the data pointlessly, there is |
| 177 | // not a good reason to use `ShaderModuleDescriptorSpirV` specifically. |
| 178 | let spirv = Cow::Owned(wgpu::util::make_spirv_raw(&data).into_owned()); |
| 179 | wgpu::ShaderModuleDescriptorSpirV { |
| 180 | label: None, |
| 181 | source: spirv, |
| 182 | } |
| 183 | }; |
| 184 | CompiledShaderModules { |
| 185 | named_spv_modules: match compile_result.module { |
| 186 | spirv_builder::ModuleResult::SingleModule(path) => { |
| 187 | vec![(None, load_spv_module(path))] |
| 188 | } |
| 189 | spirv_builder::ModuleResult::MultiModule(modules) => modules |
| 190 | .into_iter() |
| 191 | .map(|(name, path)| (Some(name), load_spv_module(path))) |
| 192 | .collect(), |
| 193 | }, |
| 194 | } |
| 195 | } |
| 196 | handle_compile_result(initial_result) |
| 197 | } |
| 198 | #[cfg(any(target_os = "android", target_arch = "wasm32"))] |
no test coverage detected