From ce78ce2e2868f54ed68db2fe7eab9bb00828ff93 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Sat, 22 Aug 2020 11:08:34 +0000 Subject: [PATCH] Tiny cleanup of GetMappedRange. Fix the last TODOs for the deletion of the "old mapping". Bug: dawn:445 Change-Id: Ie7443446e4696cf38801980db3d3cfdb09094578 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27060 Reviewed-by: Austin Eng Reviewed-by: Stephen White Commit-Queue: Corentin Wallez --- src/dawn_native/Buffer.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/dawn_native/Buffer.cpp b/src/dawn_native/Buffer.cpp index dcdfb9c595..b2bd30042b 100644 --- a/src/dawn_native/Buffer.cpp +++ b/src/dawn_native/Buffer.cpp @@ -266,8 +266,6 @@ namespace dawn_native { return GetMappedRangeInternal(false, offset, size); } - // TODO(dawn:445): When CreateBufferMapped is removed, make GetMappedRangeInternal also take - // care of the validation of GetMappedRange. void* BufferBase::GetMappedRangeInternal(bool writable, size_t offset, size_t size) { if (!CanGetMappedRange(writable, offset, size)) { return nullptr; @@ -461,11 +459,9 @@ namespace dawn_native { return true; case BufferState::Mapped: - // TODO(dawn:445): When mapRead/WriteAsync is removed, check against mMapMode - // instead of mUsage - ASSERT(bool(mUsage & wgpu::BufferUsage::MapRead) ^ - bool(mUsage & wgpu::BufferUsage::MapWrite)); - return !writable || (mUsage & wgpu::BufferUsage::MapWrite); + ASSERT(bool(mMapMode & wgpu::MapMode::Read) ^ + bool(mMapMode & wgpu::MapMode::Write)); + return !writable || (mMapMode & wgpu::MapMode::Write); case BufferState::Unmapped: case BufferState::Destroyed: