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 <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2019-05-01 12:07:37 +00:00 committed by Commit Bot service account
parent 11b703904a
commit cc141797df
2 changed files with 4 additions and 1 deletions

View File

@ -344,6 +344,7 @@ void DawnTest::SetUp() {
dawn::SwapChainDescriptor swapChainDesc;
swapChainDesc.implementation = mBinding->GetSwapChainImplementation();
swapchain = device.CreateSwapChain(&swapChainDesc);
FlushWire();
swapchain.Configure(
static_cast<dawn::TextureFormat>(mBinding->GetPreferredSwapChainTextureFormat()),
dawn::TextureUsageBit::OutputAttachment, 400, 400);
@ -353,6 +354,7 @@ void DawnTest::SetUp() {
}
void DawnTest::TearDown() {
swapchain = dawn::SwapChain();
FlushWire();
MapSlotsSynchronously();

View File

@ -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<DawnTestParam> {
detail::Expectation* expectation);
void WaitABit();
void FlushWire();
void SwapBuffersForCapture();
@ -182,7 +184,6 @@ class DawnTest : public ::testing::TestWithParam<DawnTestParam> {
std::unique_ptr<dawn_wire::WireClient> mWireClient;
std::unique_ptr<utils::TerribleCommandBuffer> mC2sBuf;
std::unique_ptr<utils::TerribleCommandBuffer> mS2cBuf;
void FlushWire();
// Tracking for validation errors
static void OnDeviceError(const char* message, DawnCallbackUserdata userdata);