From c2eeb35c66c1b139d98c9e5761b10ed5f9fa7489 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Fri, 3 May 2024 16:11:14 +0700 Subject: [PATCH] `add_shader` on the engine doesn't return a failure. Simplify this by recognizing that `Engine::add_shader` won't return an `Error` so it doesn't need to return a `Result`. --- src/shaders.rs | 2 +- src/wgpu_engine.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/shaders.rs b/src/shaders.rs index e00c1a96a..9884b06c1 100644 --- a/src/shaders.rs +++ b/src/shaders.rs @@ -121,7 +121,7 @@ pub fn full_shaders( } else { $cpu }, - )? + ) }}; ($name:ident, $bindings:expr, $defines:expr, $cpu:expr) => {{ add_shader!($name, stringify!($name), $bindings, &$defines, $cpu) diff --git a/src/wgpu_engine.rs b/src/wgpu_engine.rs index 3d4649875..b6ccc38e5 100644 --- a/src/wgpu_engine.rs +++ b/src/wgpu_engine.rs @@ -235,11 +235,11 @@ impl WgpuEngine { wgsl: Cow<'static, str>, layout: &[BindType], cpu_shader: CpuShaderType, - ) -> Result { + ) -> ShaderId { let mut add = |shader| { let id = self.shaders.len(); self.shaders.push(shader); - Ok(ShaderId(id)) + ShaderId(id) }; if self.use_cpu { @@ -318,14 +318,14 @@ impl WgpuEngine { label, wgpu: None, cpu: None, - })?; + }); uninit.push(UninitialisedShader { wgsl, label, entries, shader_id: id, }); - return Ok(id); + return id; } let wgpu = Self::create_compute_pipeline(device, label, wgsl, entries); add(Shader {