Skip to content

Commit 7484178

Browse files
Add wgpuCommandBufferRelease after calling wgpuQueueSubmit
1 parent dccf3e5 commit 7484178

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
@@ -1002,6 +1002,7 @@ inline void wait(Context &ctx, std::future<void> &future) {
10021002
inline void toCPU(Context &ctx, Tensor &tensor, void *data, size_t bufferSize,
10031003
CopyData &op) {
10041004
wgpuQueueSubmit(ctx.queue, 1, &op.commandBuffer);
1005+
wgpuCommandBufferRelease(op.commandBuffer);
10051006
CallbackData callbackData = {op.readbackBuffer, bufferSize, data, &op.promise,
10061007
&op.future};
10071008
wgpuQueueOnSubmittedWorkDone(
@@ -1109,6 +1110,7 @@ inline void toCPU(Context &ctx, WGPUBuffer buffer, void *data,
11091110
check(op.commandBuffer, "Create command buffer", __FILE__, __LINE__);
11101111
}
11111112
wgpuQueueSubmit(ctx.queue, 1, &op.commandBuffer);
1113+
wgpuCommandBufferRelease(op.commandBuffer);
11121114
CallbackData callbackData = {op.readbackBuffer, bufferSize, data, &op.promise,
11131115
&op.future};
11141116
wgpuQueueOnSubmittedWorkDone(
@@ -1513,6 +1515,7 @@ inline void dispatchKernel(Context &ctx, Kernel &kernel,
15131515
resetCommandBuffer(ctx.device, kernel);
15141516
}
15151517
wgpuQueueSubmit(ctx.queue, 1, &kernel->commandBuffer);
1518+
wgpuCommandBufferRelease(kernel->commandBuffer);
15161519
kernel->used = true;
15171520
wgpuQueueOnSubmittedWorkDone(
15181521
ctx.queue,

0 commit comments

Comments
 (0)