Skip to content

Commit

Permalink
dont panic when submitting same commandbuffer multiple times (#2449)
Browse files Browse the repository at this point in the history
  • Loading branch information
crowlKats authored Feb 2, 2022
1 parent 63dfd98 commit e50b62f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions deno_webgpu/01_webgpu.js
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,9 @@
queueRid: device.rid,
commandBuffers: commandBufferRids,
});
for (const commandBuffer of commandBuffers) {
commandBuffer[_rid] = undefined;
}
device.pushError(err);
}

Expand Down
8 changes: 6 additions & 2 deletions deno_webgpu/src/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,19 @@ pub fn op_webgpu_queue_submit(

let mut ids = vec![];

for rid in args.command_buffers {
for rid in &args.command_buffers {
let buffer_resource = state
.resource_table
.get::<super::command_encoder::WebGpuCommandBuffer>(rid)?;
.get::<super::command_encoder::WebGpuCommandBuffer>(*rid)?;
ids.push(buffer_resource.0);
}

let maybe_err = gfx_select!(queue => instance.queue_submit(queue, &ids)).err();

for rid in args.command_buffers {
state.resource_table.close(rid)?;
}

Ok(WebGpuResult::maybe_err(maybe_err))
}

Expand Down

0 comments on commit e50b62f

Please sign in to comment.