Implement ResolveDeferredExpectationsNow() for dawn_end2end_tests
This patch adds ResolveDeferredExpectationsNow() as a helper function of dawn_end2end_tests to let all the deferred expectations be resolved and cleared immediately to avoid consuming too much memory for all the deferred expectations before the exit of the test body. We use ResolveDeferredExpectationsNow() in the end2end test CopyFromNonZeroMipLevelWithTexelBlockSizeLessThan4Bytes because previously because this test will always consume too much memory to allocate vectors and the allocation of std:vector will sometimes fail on the bots. Bug: chromium:1312066 Test: dawn_end2end_tests Change-Id: I5a87338b0683a3a821eef888fb6469e6ac2dc075 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/94986 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
830e75b401
commit
fd7390a587
|
@ -1084,14 +1084,7 @@ void DawnTestBase::SetUp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DawnTestBase::TearDown() {
|
void DawnTestBase::TearDown() {
|
||||||
FlushWire();
|
ResolveDeferredExpectationsNow();
|
||||||
|
|
||||||
MapSlotsSynchronously();
|
|
||||||
ResolveExpectations();
|
|
||||||
|
|
||||||
for (size_t i = 0; i < mReadbackSlots.size(); ++i) {
|
|
||||||
mReadbackSlots[i].buffer.Unmap();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!UsesWire() && device) {
|
if (!UsesWire() && device) {
|
||||||
EXPECT_EQ(mLastWarningCount,
|
EXPECT_EQ(mLastWarningCount,
|
||||||
|
@ -1605,6 +1598,18 @@ std::unique_ptr<dawn::platform::Platform> DawnTestBase::CreateTestPlatform() {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DawnTestBase::ResolveDeferredExpectationsNow() {
|
||||||
|
FlushWire();
|
||||||
|
|
||||||
|
MapSlotsSynchronously();
|
||||||
|
ResolveExpectations();
|
||||||
|
|
||||||
|
mDeferredExpectations.clear();
|
||||||
|
for (size_t i = 0; i < mReadbackSlots.size(); ++i) {
|
||||||
|
mReadbackSlots[i].buffer.Unmap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool RGBA8::operator==(const RGBA8& other) const {
|
bool RGBA8::operator==(const RGBA8& other) const {
|
||||||
return r == other.r && g == other.g && b == other.b && a == other.a;
|
return r == other.r && g == other.g && b == other.b && a == other.a;
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,6 +343,10 @@ class DawnTestBase {
|
||||||
std::string mTest;
|
std::string mTest;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Resolve all the deferred expectations in mDeferredExpectations now to avoid letting
|
||||||
|
// mDeferredExpectations get too big.
|
||||||
|
void ResolveDeferredExpectationsNow();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wgpu::Device device;
|
wgpu::Device device;
|
||||||
wgpu::Queue queue;
|
wgpu::Queue queue;
|
||||||
|
|
|
@ -2185,9 +2185,6 @@ TEST_P(CopyTests_T2T, CopyFromNonZeroMipLevelWithTexelBlockSizeLessThan4Bytes) {
|
||||||
// try bots.
|
// try bots.
|
||||||
DAWN_SUPPRESS_TEST_IF(IsVulkan() && IsWindows() && IsIntel());
|
DAWN_SUPPRESS_TEST_IF(IsVulkan() && IsWindows() && IsIntel());
|
||||||
|
|
||||||
// This test also fails on D3D12 on Intel Windows. See http://crbug.com/1312066 for details.
|
|
||||||
DAWN_SUPPRESS_TEST_IF(IsD3D12() && IsWindows() && IsIntel());
|
|
||||||
|
|
||||||
constexpr std::array<wgpu::TextureFormat, 11> kFormats = {
|
constexpr std::array<wgpu::TextureFormat, 11> kFormats = {
|
||||||
{wgpu::TextureFormat::RG8Sint, wgpu::TextureFormat::RG8Uint, wgpu::TextureFormat::RG8Snorm,
|
{wgpu::TextureFormat::RG8Sint, wgpu::TextureFormat::RG8Uint, wgpu::TextureFormat::RG8Snorm,
|
||||||
wgpu::TextureFormat::RG8Unorm, wgpu::TextureFormat::R16Float, wgpu::TextureFormat::R16Sint,
|
wgpu::TextureFormat::RG8Unorm, wgpu::TextureFormat::R16Float, wgpu::TextureFormat::R16Sint,
|
||||||
|
@ -2235,6 +2232,10 @@ TEST_P(CopyTests_T2T, CopyFromNonZeroMipLevelWithTexelBlockSizeLessThan4Bytes) {
|
||||||
DoTest(srcSpec, dstSpec, kUploadSize);
|
DoTest(srcSpec, dstSpec, kUploadSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resolve all the deferred expectations now to avoid allocating too much memory
|
||||||
|
// in mDeferredExpectations.
|
||||||
|
ResolveDeferredExpectationsNow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue