From 14092fff9445cbd5ee18fcf53b432553f7aaf138 Mon Sep 17 00:00:00 2001 From: crowlkats Date: Fri, 8 Oct 2021 07:34:15 +0200 Subject: [PATCH] op cleanup --- deno_webgpu/src/buffer.rs | 4 +--- deno_webgpu/src/queue.rs | 7 ++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/deno_webgpu/src/buffer.rs b/deno_webgpu/src/buffer.rs index 79325a177..e93318b2d 100644 --- a/deno_webgpu/src/buffer.rs +++ b/deno_webgpu/src/buffer.rs @@ -1,6 +1,5 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -use deno_core::error::null_opbuf; use deno_core::error::type_error; use deno_core::error::AnyError; use deno_core::futures::channel::oneshot; @@ -170,9 +169,8 @@ pub struct BufferGetMappedRangeArgs { pub fn op_webgpu_buffer_get_mapped_range( state: &mut OpState, args: BufferGetMappedRangeArgs, - zero_copy: Option, + mut zero_copy: ZeroCopyBuf, ) -> Result { - let mut zero_copy = zero_copy.ok_or_else(null_opbuf)?; let instance = state.borrow::(); let buffer_resource = state.resource_table.get::(args.buffer_rid)?; let buffer = buffer_resource.0; diff --git a/deno_webgpu/src/queue.rs b/deno_webgpu/src/queue.rs index 8013ac8f8..c46f511b2 100644 --- a/deno_webgpu/src/queue.rs +++ b/deno_webgpu/src/queue.rs @@ -2,7 +2,6 @@ use std::num::NonZeroU32; -use deno_core::error::null_opbuf; use deno_core::error::AnyError; use deno_core::OpState; use deno_core::ResourceId; @@ -74,9 +73,8 @@ pub struct QueueWriteBufferArgs { pub fn op_webgpu_write_buffer( state: &mut OpState, args: QueueWriteBufferArgs, - zero_copy: Option, + zero_copy: ZeroCopyBuf, ) -> Result { - let zero_copy = zero_copy.ok_or_else(null_opbuf)?; let instance = state.borrow::(); let buffer_resource = state .resource_table @@ -112,9 +110,8 @@ pub struct QueueWriteTextureArgs { pub fn op_webgpu_write_texture( state: &mut OpState, args: QueueWriteTextureArgs, - zero_copy: Option, + zero_copy: ZeroCopyBuf, ) -> Result { - let zero_copy = zero_copy.ok_or_else(null_opbuf)?; let instance = state.borrow::(); let texture_resource = state .resource_table