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 <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
This commit is contained in:
parent
91ec571d17
commit
49aae0f3bd
|
@ -54,7 +54,7 @@ namespace dawn_native {
|
||||||
// request.
|
// request.
|
||||||
if (uploadHandle.mappedBuffer == nullptr) {
|
if (uploadHandle.mappedBuffer == nullptr) {
|
||||||
// Compute the new max size (in powers of two to preserve alignment).
|
// 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) {
|
while (newMaxSize < size) {
|
||||||
newMaxSize *= 2;
|
newMaxSize *= 2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,10 +176,6 @@ TEST_P(BufferSetSubDataTests, SmallDataAtOffset) {
|
||||||
|
|
||||||
// Stress test for many calls to SetSubData
|
// Stress test for many calls to SetSubData
|
||||||
TEST_P(BufferSetSubDataTests, ManySetSubData) {
|
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
|
// Test failing on Linux Vulkan Intel. It works on Ubuntu 14.04 but fails on
|
||||||
// 19.04.
|
// 19.04.
|
||||||
// See https://bugs.chromium.org/p/chromium/issues/detail?id=980737
|
// See https://bugs.chromium.org/p/chromium/issues/detail?id=980737
|
||||||
|
|
Loading…
Reference in New Issue