mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-15 08:06:19 +00:00
Deprecation of using 0 as default size in buffer mapAsync
For size parameter in mapAsync, use wgpu::kWholeMapSize rather than 0 to indicate using the default size, i.e. remaining buffer size after offset. Using size=0 is still available but will cause a deprecation warning. Bug: dawn:1159 Change-Id: I474d87ecae4a54ceb28d636f883a6233c91f16fa Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/66284 Auto-Submit: Zhaoming Jiang <zhaoming.jiang@intel.com> Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
180ec459ea
commit
2a5b981a87
@@ -219,13 +219,21 @@ TEST_F(BufferValidationTest, MapAsync_OffsetSizeOOB) {
|
||||
// Valid case: empty range at the end of the buffer is ok.
|
||||
{
|
||||
wgpu::Buffer buffer = CreateMapReadBuffer(8);
|
||||
buffer.MapAsync(wgpu::MapMode::Read, 8, 0, nullptr, nullptr);
|
||||
// Currently using size=0 will cause a deprecation warning, and result in default size.
|
||||
// After the deprecation is finished, size=0 will result in a mapping with zero size
|
||||
// exactly.
|
||||
// TODO(dawn:1058): Remove the deprecation warning expection after the removal.
|
||||
EXPECT_DEPRECATION_WARNING(buffer.MapAsync(wgpu::MapMode::Read, 8, 0, nullptr, nullptr));
|
||||
}
|
||||
|
||||
// Error case, offset is larger than the buffer size (even if size is 0).
|
||||
{
|
||||
wgpu::Buffer buffer = CreateMapReadBuffer(12);
|
||||
AssertMapAsyncError(buffer, wgpu::MapMode::Read, 16, 0);
|
||||
// Currently using size=0 will cause a deprecation warning, and result in default size.
|
||||
// After the deprecation is finished, size=0 will result in a mapping with zero size
|
||||
// exactly.
|
||||
// TODO(dawn:1058): Remove the deprecation warning expection after the removal.
|
||||
EXPECT_DEPRECATION_WARNING(AssertMapAsyncError(buffer, wgpu::MapMode::Read, 16, 0));
|
||||
}
|
||||
|
||||
// Error case, offset + size is larger than the buffer
|
||||
@@ -819,7 +827,7 @@ TEST_F(BufferValidationTest, GetMappedRange_OffsetSizeOOB) {
|
||||
// Valid case: full range is ok with defaulted MapAsync size
|
||||
{
|
||||
wgpu::Buffer buffer = CreateMapWriteBuffer(8);
|
||||
buffer.MapAsync(wgpu::MapMode::Write, 0, 0, nullptr, nullptr);
|
||||
buffer.MapAsync(wgpu::MapMode::Write, 0, wgpu::kWholeMapSize, nullptr, nullptr);
|
||||
WaitForAllOperations(device);
|
||||
EXPECT_NE(buffer.GetMappedRange(0, 8), nullptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user