diff options
author | crowlKats <13135287+crowlKats@users.noreply.github.com> | 2021-05-03 16:42:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-03 16:42:59 +0200 |
commit | 7bc03523d075ae4a5a508f9bdf59a1686f7bcdce (patch) | |
tree | 478b04458b054e62e02a7edb2a6f56a77f952439 /extensions/webgpu/binding.rs | |
parent | 3a37444cb547b8a0336060f0ef7c96bfd661d202 (diff) |
refactor(op_crates/webgpu): simplify gfx_select macro & add gfx_put and gfx_ok macros (#10044)
Diffstat (limited to 'extensions/webgpu/binding.rs')
-rw-r--r-- | extensions/webgpu/binding.rs | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/extensions/webgpu/binding.rs b/extensions/webgpu/binding.rs index fd4e75784..e6bd7fc7c 100644 --- a/extensions/webgpu/binding.rs +++ b/extensions/webgpu/binding.rs @@ -195,17 +195,11 @@ pub fn op_webgpu_create_bind_group_layout( entries: Cow::from(entries), }; - let (bind_group_layout, maybe_err) = gfx_select!(device => instance.device_create_bind_group_layout( + gfx_put!(device => instance.device_create_bind_group_layout( device, &descriptor, std::marker::PhantomData - )); - - let rid = state - .resource_table - .add(WebGpuBindGroupLayout(bind_group_layout)); - - Ok(WebGpuResult::rid_err(rid, maybe_err)) + ) => state, WebGpuBindGroupLayout) } #[derive(Deserialize)] @@ -244,17 +238,11 @@ pub fn op_webgpu_create_pipeline_layout( push_constant_ranges: Default::default(), }; - let (pipeline_layout, maybe_err) = gfx_select!(device => instance.device_create_pipeline_layout( + gfx_put!(device => instance.device_create_pipeline_layout( device, &descriptor, std::marker::PhantomData - )); - - let rid = state - .resource_table - .add(super::pipeline::WebGpuPipelineLayout(pipeline_layout)); - - Ok(WebGpuResult::rid_err(rid, maybe_err)) + ) => state, super::pipeline::WebGpuPipelineLayout) } #[derive(Deserialize)] @@ -340,13 +328,9 @@ pub fn op_webgpu_create_bind_group( entries: Cow::from(entries), }; - let (bind_group, maybe_err) = gfx_select!(device => instance.device_create_bind_group( + gfx_put!(device => instance.device_create_bind_group( device, &descriptor, std::marker::PhantomData - )); - - let rid = state.resource_table.add(WebGpuBindGroup(bind_group)); - - Ok(WebGpuResult::rid_err(rid, maybe_err)) + ) => state, WebGpuBindGroup) } |