Skip to content

Commit a6140e0

Browse files
Add wgpuCommandEncoderRelease after calling wgpuCommandEncoderFinish
1 parent 6c52b98 commit a6140e0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

gpu.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -1063,6 +1063,7 @@ inline void toCPU(Context &ctx, Tensor &tensor, void *data, size_t bufferSize) {
10631063
wgpuCommandEncoderCopyBufferToBuffer(commandEncoder, tensor.data.buffer, 0,
10641064
op.readbackBuffer, 0, bufferSize);
10651065
op.commandBuffer = wgpuCommandEncoderFinish(commandEncoder, nullptr);
1066+
wgpuCommandEncoderRelease(commandEncoder);
10661067
check(op.commandBuffer, "Create command buffer", __FILE__, __LINE__);
10671068
}
10681069
toCPU(ctx, tensor, data, bufferSize, op);
@@ -1107,6 +1108,7 @@ inline void toCPU(Context &ctx, WGPUBuffer buffer, void *data,
11071108
wgpuCommandEncoderCopyBufferToBuffer(commandEncoder, buffer, 0,
11081109
op.readbackBuffer, 0, bufferSize);
11091110
op.commandBuffer = wgpuCommandEncoderFinish(commandEncoder, nullptr);
1111+
wgpuCommandEncoderRelease(commandEncoder);
11101112
check(op.commandBuffer, "Create command buffer", __FILE__, __LINE__);
11111113
}
11121114
wgpuQueueSubmit(ctx.queue, 1, &op.commandBuffer);
@@ -1225,6 +1227,7 @@ inline void resetCommandBuffer(WGPUDevice &device, Kernel &op) {
12251227
op->totalWorkgroups[2]);
12261228
wgpuComputePassEncoderEnd(computePassEncoder);
12271229
op->commandBuffer = wgpuCommandEncoderFinish(commandEncoder, nullptr);
1230+
wgpuCommandEncoderRelease(commandEncoder);
12281231
op->used = false;
12291232
}
12301233
}

0 commit comments

Comments
 (0)