From 49aae0f3bde201d10f1b17d362b0d5b8f85dceb4 Mon Sep 17 00:00:00 2001 From: Jiawei Shao Date: Fri, 19 Jul 2019 00:09:28 +0000 Subject: [PATCH] Double the size of the ring buffer only when it is not big enough Currently Dawn always doubles the size of the largest ring buffer everytime when DynamicUploader::Allocate() is called, which is not necessary and will cause out-of-memory errors when this function is called for too many times. This time fixes this behaviour by only doubling the size of the largest ring buffer when it is not big enough for the request buffer size. BUG=dawn:108 TEST=dawn_end2end_tests Change-Id: I734493dbc632ca8e9a30c1ceeb0b7b9e0474656b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9160 Reviewed-by: Corentin Wallez Reviewed-by: Austin Eng Commit-Queue: Jiawei Shao --- src/dawn_native/DynamicUploader.cpp | 2 +- src/tests/end2end/BufferTests.cpp | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/dawn_native/DynamicUploader.cpp b/src/dawn_native/DynamicUploader.cpp index d5c04504fe..344214b1dc 100644 --- a/src/dawn_native/DynamicUploader.cpp +++ b/src/dawn_native/DynamicUploader.cpp @@ -54,7 +54,7 @@ namespace dawn_native { // request. if (uploadHandle.mappedBuffer == nullptr) { // Compute the new max size (in powers of two to preserve alignment). - size_t newMaxSize = largestRingBuffer->GetSize() * 2; + size_t newMaxSize = largestRingBuffer->GetSize(); while (newMaxSize < size) { newMaxSize *= 2; } diff --git a/src/tests/end2end/BufferTests.cpp b/src/tests/end2end/BufferTests.cpp index ed6e407a58..9a9f242703 100644 --- a/src/tests/end2end/BufferTests.cpp +++ b/src/tests/end2end/BufferTests.cpp @@ -176,10 +176,6 @@ TEST_P(BufferSetSubDataTests, SmallDataAtOffset) { // Stress test for many calls to SetSubData TEST_P(BufferSetSubDataTests, ManySetSubData) { - // Test failing on Mac Metal Intel, maybe because Metal runs out of space to encode commands. - // See https://bugs.chromium.org/p/dawn/issues/detail?id=108 - DAWN_SKIP_TEST_IF(IsMacOS() && IsMetal() && IsIntel()); - // Test failing on Linux Vulkan Intel. It works on Ubuntu 14.04 but fails on // 19.04. // See https://bugs.chromium.org/p/chromium/issues/detail?id=980737