dont panic when submitting same commandbuffer multiple times (#2449)

This commit is contained in:
Leo Kettmeir 2022-02-02 14:52:08 +01:00 committed by GitHub
parent 63dfd98d68
commit e50b62fae4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -1474,6 +1474,9 @@
queueRid: device.rid,
commandBuffers: commandBufferRids,
});
for (const commandBuffer of commandBuffers) {
commandBuffer[_rid] = undefined;
}
device.pushError(err);
}

View File

@ -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))
}