Skip to content

Commit

Permalink
add_shader on the engine doesn't return a failure. (#564)
Browse files Browse the repository at this point in the history
Simplify this by recognizing that `Engine::add_shader` won't return an
`Error` so it doesn't need to return a `Result`.
  • Loading branch information
waywardmonkeys authored May 3, 2024
1 parent 49322a3 commit 90d3514
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/shaders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions src/wgpu_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ impl WgpuEngine {
wgsl: Cow<'static, str>,
layout: &[BindType],
cpu_shader: CpuShaderType,
) -> Result<ShaderId, Error> {
) -> ShaderId {
let mut add = |shader| {
let id = self.shaders.len();
self.shaders.push(shader);
Ok(ShaderId(id))
ShaderId(id)
};

if self.use_cpu {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 90d3514

Please sign in to comment.