Vulkan: prevent degenerate buffer sizes from reaching the driver

Allocating buffers with sizes close to UINT64_MAX caused issues in all
Vulkan drivers. See https://gitlab.khronos.org/vulkan/vulkan/issues/1904
for more context. Do early validation to prevent such cases from
reaching the driver.

Bug: dawn:241
Fixed: dawn:241

Change-Id: I7edbb25999b4c11767047518b69edc1fa624cd3b
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14641
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
Corentin Wallez
2019-12-17 17:34:21 +00:00
committed by Commit Bot service account
parent 6ea362cae0
commit 1586b4d73e
2 changed files with 10 additions and 5 deletions

View File

@@ -733,11 +733,6 @@ TEST_P(CreateBufferMappedTests, LargeBufferFails) {
// TODO(http://crbug.com/dawn/27): Missing support.
DAWN_SKIP_TEST_IF(IsMetal() || IsOpenGL());
// TODO(http://crbug.com/dawn/241): Fails on NVIDIA cards when Vulkan validation layers are
// enabled becuase the maximum size of a single allocation cannot be larger than or equal to
// 4G on some platforms.
DAWN_SKIP_TEST_IF(IsVulkan() && IsNvidia() && IsBackendValidationEnabled());
wgpu::BufferDescriptor descriptor;
descriptor.size = std::numeric_limits<uint64_t>::max();
descriptor.usage = wgpu::BufferUsage::MapRead | wgpu::BufferUsage::CopyDst;