Rename Buffer::IsMapWritable to Buffer::IsMappableAtCreation
Renaming method to better reflect the actual usage.
Bug: none
Change-Id: I3fcdeffaa06fceae9d5818f79c3b7985fb1885ad
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/24701
Reviewed-by: Bryan Bernhart <bryan.bernhart@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn_native/Buffer.cpp b/src/dawn_native/Buffer.cpp
index 5f814be..1db64a7 100644
--- a/src/dawn_native/Buffer.cpp
+++ b/src/dawn_native/Buffer.cpp
@@ -54,7 +54,7 @@
}
private:
- bool IsMapWritable() const override {
+ bool IsMappableAtCreation() const override {
UNREACHABLE();
return false;
}
@@ -173,7 +173,7 @@
}
// Mappable buffers don't use a staging buffer and are just as if mapped through MapAsync.
- if (IsMapWritable()) {
+ if (IsMappableAtCreation()) {
DAWN_TRY(MapAtCreationImpl());
return {};
}
@@ -348,7 +348,7 @@
if (mStagingBuffer != nullptr) {
mStagingBuffer.reset();
} else if (mSize != 0) {
- ASSERT(IsMapWritable());
+ ASSERT(IsMappableAtCreation());
Unmap();
}
}
@@ -399,7 +399,7 @@
if (mStagingBuffer != nullptr) {
GetDevice()->ConsumedError(CopyFromStagingBuffer());
} else if (mSize != 0) {
- ASSERT(IsMapWritable());
+ ASSERT(IsMappableAtCreation());
UnmapImpl();
}
}
diff --git a/src/dawn_native/Buffer.h b/src/dawn_native/Buffer.h
index f4a5377..457e415 100644
--- a/src/dawn_native/Buffer.h
+++ b/src/dawn_native/Buffer.h
@@ -83,7 +83,7 @@
virtual void DestroyImpl() = 0;
virtual void* GetMappedPointerImpl() = 0;
- virtual bool IsMapWritable() const = 0;
+ virtual bool IsMappableAtCreation() const = 0;
MaybeError CopyFromStagingBuffer();
void* GetMappedRangeInternal(bool writable);
void CallMapReadCallback(uint32_t serial,
diff --git a/src/dawn_native/d3d12/BufferD3D12.cpp b/src/dawn_native/d3d12/BufferD3D12.cpp
index 808b134..c38545b 100644
--- a/src/dawn_native/d3d12/BufferD3D12.cpp
+++ b/src/dawn_native/d3d12/BufferD3D12.cpp
@@ -243,7 +243,7 @@
return mResourceAllocation.GetGPUPointer();
}
- bool Buffer::IsMapWritable() const {
+ bool Buffer::IsMappableAtCreation() const {
// TODO(enga): Handle CPU-visible memory on UMA
return (GetUsage() & (wgpu::BufferUsage::MapRead | wgpu::BufferUsage::MapWrite)) != 0;
}
diff --git a/src/dawn_native/d3d12/BufferD3D12.h b/src/dawn_native/d3d12/BufferD3D12.h
index bb25558..33804d7 100644
--- a/src/dawn_native/d3d12/BufferD3D12.h
+++ b/src/dawn_native/d3d12/BufferD3D12.h
@@ -57,7 +57,7 @@
void UnmapImpl() override;
void DestroyImpl() override;
- bool IsMapWritable() const override;
+ bool IsMappableAtCreation() const override;
virtual MaybeError MapAtCreationImpl() override;
void* GetMappedPointerImpl() override;
MaybeError MapInternal(bool isWrite, const char* contextInfo);
diff --git a/src/dawn_native/metal/BufferMTL.h b/src/dawn_native/metal/BufferMTL.h
index 38c403c..f26c7e0 100644
--- a/src/dawn_native/metal/BufferMTL.h
+++ b/src/dawn_native/metal/BufferMTL.h
@@ -47,7 +47,7 @@
void DestroyImpl() override;
void* GetMappedPointerImpl() override;
- bool IsMapWritable() const override;
+ bool IsMappableAtCreation() const override;
MaybeError MapAtCreationImpl() override;
void InitializeToZero(CommandRecordingContext* commandContext);
diff --git a/src/dawn_native/metal/BufferMTL.mm b/src/dawn_native/metal/BufferMTL.mm
index 5b10a8d..d231e86 100644
--- a/src/dawn_native/metal/BufferMTL.mm
+++ b/src/dawn_native/metal/BufferMTL.mm
@@ -104,7 +104,7 @@
return mMtlBuffer;
}
- bool Buffer::IsMapWritable() const {
+ bool Buffer::IsMappableAtCreation() const {
// TODO(enga): Handle CPU-visible memory on UMA
return (GetUsage() & (wgpu::BufferUsage::MapRead | wgpu::BufferUsage::MapWrite)) != 0;
}
diff --git a/src/dawn_native/null/DeviceNull.cpp b/src/dawn_native/null/DeviceNull.cpp
index 71085cd..ab430c3 100644
--- a/src/dawn_native/null/DeviceNull.cpp
+++ b/src/dawn_native/null/DeviceNull.cpp
@@ -280,7 +280,7 @@
ToBackend(GetDevice())->DecrementMemoryUsage(GetSize());
}
- bool Buffer::IsMapWritable() const {
+ bool Buffer::IsMappableAtCreation() const {
// Only return true for mappable buffers so we can test cases that need / don't need a
// staging buffer.
return (GetUsage() & (wgpu::BufferUsage::MapRead | wgpu::BufferUsage::MapWrite)) != 0;
diff --git a/src/dawn_native/null/DeviceNull.h b/src/dawn_native/null/DeviceNull.h
index 1c98664..94d3826 100644
--- a/src/dawn_native/null/DeviceNull.h
+++ b/src/dawn_native/null/DeviceNull.h
@@ -204,7 +204,7 @@
void UnmapImpl() override;
void DestroyImpl() override;
- bool IsMapWritable() const override;
+ bool IsMappableAtCreation() const override;
MaybeError MapAtCreationImpl() override;
void* GetMappedPointerImpl() override;
diff --git a/src/dawn_native/opengl/BufferGL.cpp b/src/dawn_native/opengl/BufferGL.cpp
index c0bd7f3..e7398d6 100644
--- a/src/dawn_native/opengl/BufferGL.cpp
+++ b/src/dawn_native/opengl/BufferGL.cpp
@@ -92,7 +92,7 @@
SetIsDataInitialized();
}
- bool Buffer::IsMapWritable() const {
+ bool Buffer::IsMappableAtCreation() const {
// TODO(enga): All buffers in GL can be mapped. Investigate if mapping them will cause the
// driver to migrate it to shared memory.
return true;
diff --git a/src/dawn_native/opengl/BufferGL.h b/src/dawn_native/opengl/BufferGL.h
index 9bc870e..8dbe764 100644
--- a/src/dawn_native/opengl/BufferGL.h
+++ b/src/dawn_native/opengl/BufferGL.h
@@ -40,7 +40,7 @@
void UnmapImpl() override;
void DestroyImpl() override;
- bool IsMapWritable() const override;
+ bool IsMappableAtCreation() const override;
MaybeError MapAtCreationImpl() override;
void* GetMappedPointerImpl() override;
uint64_t GetAppliedSize() const;
diff --git a/src/dawn_native/vulkan/BufferVk.cpp b/src/dawn_native/vulkan/BufferVk.cpp
index 4175324..a3dcf2e 100644
--- a/src/dawn_native/vulkan/BufferVk.cpp
+++ b/src/dawn_native/vulkan/BufferVk.cpp
@@ -234,7 +234,7 @@
mLastUsage = usage;
}
- bool Buffer::IsMapWritable() const {
+ bool Buffer::IsMappableAtCreation() const {
// TODO(enga): Handle CPU-visible memory on UMA
return mMemoryAllocation.GetMappedPointer() != nullptr;
}
diff --git a/src/dawn_native/vulkan/BufferVk.h b/src/dawn_native/vulkan/BufferVk.h
index 14be757..d0d3ea2 100644
--- a/src/dawn_native/vulkan/BufferVk.h
+++ b/src/dawn_native/vulkan/BufferVk.h
@@ -61,7 +61,7 @@
void UnmapImpl() override;
void DestroyImpl() override;
- bool IsMapWritable() const override;
+ bool IsMappableAtCreation() const override;
MaybeError MapAtCreationImpl() override;
void* GetMappedPointerImpl() override;