From cc141797dfc8fd0d10eafb96c9bfab7b341b8bd4 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Wed, 1 May 2019 12:07:37 +0000 Subject: [PATCH] Fix dawn_end2end_tests -w Code surrounding the swapchain needs to Flush the wire so that the native swapchain implementation is initialized before GetPreferredFormat is called. Likewise the swapchain should be destroyed before the last FlushWire otherwise the native swapchain will still be using the window at the beginning of the next test. Also fixes the newly added ASSERT_DEVICE_ERROR not working with -w. BUG=dawn:143 Change-Id: Ie3d6fa8c9236f68f5bff1ad7abd112ab25035843 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/6860 Reviewed-by: Austin Eng Reviewed-by: Kai Ninomiya Commit-Queue: Corentin Wallez --- src/tests/DawnTest.cpp | 2 ++ src/tests/DawnTest.h | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp index af6e716a93..ec1f7c652d 100644 --- a/src/tests/DawnTest.cpp +++ b/src/tests/DawnTest.cpp @@ -344,6 +344,7 @@ void DawnTest::SetUp() { dawn::SwapChainDescriptor swapChainDesc; swapChainDesc.implementation = mBinding->GetSwapChainImplementation(); swapchain = device.CreateSwapChain(&swapChainDesc); + FlushWire(); swapchain.Configure( static_cast(mBinding->GetPreferredSwapChainTextureFormat()), dawn::TextureUsageBit::OutputAttachment, 400, 400); @@ -353,6 +354,7 @@ void DawnTest::SetUp() { } void DawnTest::TearDown() { + swapchain = dawn::SwapChain(); FlushWire(); MapSlotsSynchronously(); diff --git a/src/tests/DawnTest.h b/src/tests/DawnTest.h index a098a145ba..c3c9d4544f 100644 --- a/src/tests/DawnTest.h +++ b/src/tests/DawnTest.h @@ -47,6 +47,7 @@ #define ASSERT_DEVICE_ERROR(statement) \ StartExpectDeviceError(); \ statement; \ + FlushWire(); \ ASSERT_TRUE(EndExpectDeviceError()); struct RGBA8 { @@ -173,6 +174,7 @@ class DawnTest : public ::testing::TestWithParam { detail::Expectation* expectation); void WaitABit(); + void FlushWire(); void SwapBuffersForCapture(); @@ -182,7 +184,6 @@ class DawnTest : public ::testing::TestWithParam { std::unique_ptr mWireClient; std::unique_ptr mC2sBuf; std::unique_ptr mS2cBuf; - void FlushWire(); // Tracking for validation errors static void OnDeviceError(const char* message, DawnCallbackUserdata userdata);