diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp index e3752be297..9c9ab288e5 100644 --- a/src/tests/DawnTest.cpp +++ b/src/tests/DawnTest.cpp @@ -203,6 +203,12 @@ DawnTest::~DawnTest() { swapchain = dawn::SwapChain(); device = dawn::Device(); + mWireClient = nullptr; + mWireServer = nullptr; + if (gTestEnv->UsesWire()) { + backendProcs.deviceRelease(backendDevice); + } + dawnSetProcs(nullptr); } @@ -301,7 +307,6 @@ void DawnTest::SetUp() { mPCIInfo = backendAdapter.GetPCIInfo(); - DawnDevice backendDevice; const char* forceEnabledWorkaround = GetParam().forceEnabledWorkaround; if (forceEnabledWorkaround != nullptr) { ASSERT(gTestEnv->GetInstance()->GetToggleInfo(forceEnabledWorkaround) != nullptr); @@ -311,7 +316,7 @@ void DawnTest::SetUp() { backendDevice = backendAdapter.CreateDevice(nullptr); } - DawnProcTable backendProcs = dawn_native::GetProcs(); + backendProcs = dawn_native::GetProcs(); // Get the test window and create the device using it (esp. for OpenGL) GLFWwindow* testWindow = gTestEnv->GetWindowForBackend(backendType); diff --git a/src/tests/DawnTest.h b/src/tests/DawnTest.h index 591bd5c914..e31ec2eda7 100644 --- a/src/tests/DawnTest.h +++ b/src/tests/DawnTest.h @@ -157,6 +157,9 @@ class DawnTest : public ::testing::TestWithParam { dawn::Queue queue; dawn::SwapChain swapchain; + DawnProcTable backendProcs = {}; + DawnDevice backendDevice = nullptr; + // Helper methods to implement the EXPECT_ macros std::ostringstream& AddBufferExpectation(const char* file, int line,