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 <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2020-08-22 11:08:34 +00:00 committed by Commit Bot service account
parent e8dc820fbc
commit ce78ce2e28
1 changed files with 3 additions and 7 deletions

View File

@ -266,8 +266,6 @@ namespace dawn_native {
return GetMappedRangeInternal(false, offset, size); 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) { void* BufferBase::GetMappedRangeInternal(bool writable, size_t offset, size_t size) {
if (!CanGetMappedRange(writable, offset, size)) { if (!CanGetMappedRange(writable, offset, size)) {
return nullptr; return nullptr;
@ -461,11 +459,9 @@ namespace dawn_native {
return true; return true;
case BufferState::Mapped: case BufferState::Mapped:
// TODO(dawn:445): When mapRead/WriteAsync is removed, check against mMapMode ASSERT(bool(mMapMode & wgpu::MapMode::Read) ^
// instead of mUsage bool(mMapMode & wgpu::MapMode::Write));
ASSERT(bool(mUsage & wgpu::BufferUsage::MapRead) ^ return !writable || (mMapMode & wgpu::MapMode::Write);
bool(mUsage & wgpu::BufferUsage::MapWrite));
return !writable || (mUsage & wgpu::BufferUsage::MapWrite);
case BufferState::Unmapped: case BufferState::Unmapped:
case BufferState::Destroyed: case BufferState::Destroyed: