Skip to content

Commit 8e604a9

Browse files
WebGPU: fixed memory leaks in tests (close #647)
1 parent 951dba2 commit 8e604a9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Tests/GPUTestFramework/src/WebGPU/TestingEnvironmentWebGPU.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2024 Diligent Graphics LLC
2+
* Copyright 2023-2025 Diligent Graphics LLC
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -98,6 +98,8 @@ void TestingEnvironmentWebGPU::SubmitCommandEncoder(WGPUCommandEncoder wgpuCmdEn
9898
VERIFY_EXPR(wgpuCmdQueue != nullptr);
9999

100100
wgpuQueueSubmit(wgpuCmdQueue, 1, &wgpuCmdBuffer);
101+
wgpuCommandBufferRelease(wgpuCmdBuffer);
102+
101103
if (WaitForIdle)
102104
{
103105
bool IsWorkDone = false;
@@ -108,8 +110,7 @@ void TestingEnvironmentWebGPU::SubmitCommandEncoder(WGPUCommandEncoder wgpuCmdEn
108110
DEV_ERROR("Failed wgpuQueueOnSubmittedWorkDone: ", Status);
109111
};
110112

111-
WGPUQueue wgpuQueue = wgpuDeviceGetQueue(m_wgpuDevice);
112-
wgpuQueueOnSubmittedWorkDone(wgpuQueue, WorkDoneCallback, &IsWorkDone);
113+
wgpuQueueOnSubmittedWorkDone(wgpuCmdQueue, WorkDoneCallback, &IsWorkDone);
113114

114115
while (!IsWorkDone)
115116
{
@@ -118,6 +119,8 @@ void TestingEnvironmentWebGPU::SubmitCommandEncoder(WGPUCommandEncoder wgpuCmdEn
118119
#endif
119120
}
120121
}
122+
123+
wgpuQueueRelease(wgpuCmdQueue);
121124
}
122125

123126
GPUTestingEnvironment* CreateTestingEnvironmentWebGPU(const GPUTestingEnvironment::CreateInfo& CI,

0 commit comments

Comments
 (0)