mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-06 13:15:59 +00:00
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>
This commit is contained in:
parent
eafdef3818
commit
b9285f69ba
@ -54,7 +54,7 @@ namespace dawn_native {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool IsMapWritable() const override {
|
bool IsMappableAtCreation() const override {
|
||||||
UNREACHABLE();
|
UNREACHABLE();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -173,7 +173,7 @@ namespace dawn_native {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mappable buffers don't use a staging buffer and are just as if mapped through MapAsync.
|
// Mappable buffers don't use a staging buffer and are just as if mapped through MapAsync.
|
||||||
if (IsMapWritable()) {
|
if (IsMappableAtCreation()) {
|
||||||
DAWN_TRY(MapAtCreationImpl());
|
DAWN_TRY(MapAtCreationImpl());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@ -348,7 +348,7 @@ namespace dawn_native {
|
|||||||
if (mStagingBuffer != nullptr) {
|
if (mStagingBuffer != nullptr) {
|
||||||
mStagingBuffer.reset();
|
mStagingBuffer.reset();
|
||||||
} else if (mSize != 0) {
|
} else if (mSize != 0) {
|
||||||
ASSERT(IsMapWritable());
|
ASSERT(IsMappableAtCreation());
|
||||||
Unmap();
|
Unmap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -399,7 +399,7 @@ namespace dawn_native {
|
|||||||
if (mStagingBuffer != nullptr) {
|
if (mStagingBuffer != nullptr) {
|
||||||
GetDevice()->ConsumedError(CopyFromStagingBuffer());
|
GetDevice()->ConsumedError(CopyFromStagingBuffer());
|
||||||
} else if (mSize != 0) {
|
} else if (mSize != 0) {
|
||||||
ASSERT(IsMapWritable());
|
ASSERT(IsMappableAtCreation());
|
||||||
UnmapImpl();
|
UnmapImpl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ namespace dawn_native {
|
|||||||
virtual void DestroyImpl() = 0;
|
virtual void DestroyImpl() = 0;
|
||||||
virtual void* GetMappedPointerImpl() = 0;
|
virtual void* GetMappedPointerImpl() = 0;
|
||||||
|
|
||||||
virtual bool IsMapWritable() const = 0;
|
virtual bool IsMappableAtCreation() const = 0;
|
||||||
MaybeError CopyFromStagingBuffer();
|
MaybeError CopyFromStagingBuffer();
|
||||||
void* GetMappedRangeInternal(bool writable);
|
void* GetMappedRangeInternal(bool writable);
|
||||||
void CallMapReadCallback(uint32_t serial,
|
void CallMapReadCallback(uint32_t serial,
|
||||||
|
@ -243,7 +243,7 @@ namespace dawn_native { namespace d3d12 {
|
|||||||
return mResourceAllocation.GetGPUPointer();
|
return mResourceAllocation.GetGPUPointer();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Buffer::IsMapWritable() const {
|
bool Buffer::IsMappableAtCreation() const {
|
||||||
// TODO(enga): Handle CPU-visible memory on UMA
|
// TODO(enga): Handle CPU-visible memory on UMA
|
||||||
return (GetUsage() & (wgpu::BufferUsage::MapRead | wgpu::BufferUsage::MapWrite)) != 0;
|
return (GetUsage() & (wgpu::BufferUsage::MapRead | wgpu::BufferUsage::MapWrite)) != 0;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ namespace dawn_native { namespace d3d12 {
|
|||||||
void UnmapImpl() override;
|
void UnmapImpl() override;
|
||||||
void DestroyImpl() override;
|
void DestroyImpl() override;
|
||||||
|
|
||||||
bool IsMapWritable() const override;
|
bool IsMappableAtCreation() const override;
|
||||||
virtual MaybeError MapAtCreationImpl() override;
|
virtual MaybeError MapAtCreationImpl() override;
|
||||||
void* GetMappedPointerImpl() override;
|
void* GetMappedPointerImpl() override;
|
||||||
MaybeError MapInternal(bool isWrite, const char* contextInfo);
|
MaybeError MapInternal(bool isWrite, const char* contextInfo);
|
||||||
|
@ -47,7 +47,7 @@ namespace dawn_native { namespace metal {
|
|||||||
void DestroyImpl() override;
|
void DestroyImpl() override;
|
||||||
void* GetMappedPointerImpl() override;
|
void* GetMappedPointerImpl() override;
|
||||||
|
|
||||||
bool IsMapWritable() const override;
|
bool IsMappableAtCreation() const override;
|
||||||
MaybeError MapAtCreationImpl() override;
|
MaybeError MapAtCreationImpl() override;
|
||||||
|
|
||||||
void InitializeToZero(CommandRecordingContext* commandContext);
|
void InitializeToZero(CommandRecordingContext* commandContext);
|
||||||
|
@ -104,7 +104,7 @@ namespace dawn_native { namespace metal {
|
|||||||
return mMtlBuffer;
|
return mMtlBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Buffer::IsMapWritable() const {
|
bool Buffer::IsMappableAtCreation() const {
|
||||||
// TODO(enga): Handle CPU-visible memory on UMA
|
// TODO(enga): Handle CPU-visible memory on UMA
|
||||||
return (GetUsage() & (wgpu::BufferUsage::MapRead | wgpu::BufferUsage::MapWrite)) != 0;
|
return (GetUsage() & (wgpu::BufferUsage::MapRead | wgpu::BufferUsage::MapWrite)) != 0;
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ namespace dawn_native { namespace null {
|
|||||||
ToBackend(GetDevice())->DecrementMemoryUsage(GetSize());
|
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
|
// Only return true for mappable buffers so we can test cases that need / don't need a
|
||||||
// staging buffer.
|
// staging buffer.
|
||||||
return (GetUsage() & (wgpu::BufferUsage::MapRead | wgpu::BufferUsage::MapWrite)) != 0;
|
return (GetUsage() & (wgpu::BufferUsage::MapRead | wgpu::BufferUsage::MapWrite)) != 0;
|
||||||
|
@ -204,7 +204,7 @@ namespace dawn_native { namespace null {
|
|||||||
void UnmapImpl() override;
|
void UnmapImpl() override;
|
||||||
void DestroyImpl() override;
|
void DestroyImpl() override;
|
||||||
|
|
||||||
bool IsMapWritable() const override;
|
bool IsMappableAtCreation() const override;
|
||||||
MaybeError MapAtCreationImpl() override;
|
MaybeError MapAtCreationImpl() override;
|
||||||
void* GetMappedPointerImpl() override;
|
void* GetMappedPointerImpl() override;
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ namespace dawn_native { namespace opengl {
|
|||||||
SetIsDataInitialized();
|
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
|
// TODO(enga): All buffers in GL can be mapped. Investigate if mapping them will cause the
|
||||||
// driver to migrate it to shared memory.
|
// driver to migrate it to shared memory.
|
||||||
return true;
|
return true;
|
||||||
|
@ -40,7 +40,7 @@ namespace dawn_native { namespace opengl {
|
|||||||
void UnmapImpl() override;
|
void UnmapImpl() override;
|
||||||
void DestroyImpl() override;
|
void DestroyImpl() override;
|
||||||
|
|
||||||
bool IsMapWritable() const override;
|
bool IsMappableAtCreation() const override;
|
||||||
MaybeError MapAtCreationImpl() override;
|
MaybeError MapAtCreationImpl() override;
|
||||||
void* GetMappedPointerImpl() override;
|
void* GetMappedPointerImpl() override;
|
||||||
uint64_t GetAppliedSize() const;
|
uint64_t GetAppliedSize() const;
|
||||||
|
@ -234,7 +234,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
mLastUsage = usage;
|
mLastUsage = usage;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Buffer::IsMapWritable() const {
|
bool Buffer::IsMappableAtCreation() const {
|
||||||
// TODO(enga): Handle CPU-visible memory on UMA
|
// TODO(enga): Handle CPU-visible memory on UMA
|
||||||
return mMemoryAllocation.GetMappedPointer() != nullptr;
|
return mMemoryAllocation.GetMappedPointer() != nullptr;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
void UnmapImpl() override;
|
void UnmapImpl() override;
|
||||||
void DestroyImpl() override;
|
void DestroyImpl() override;
|
||||||
|
|
||||||
bool IsMapWritable() const override;
|
bool IsMappableAtCreation() const override;
|
||||||
MaybeError MapAtCreationImpl() override;
|
MaybeError MapAtCreationImpl() override;
|
||||||
void* GetMappedPointerImpl() override;
|
void* GetMappedPointerImpl() override;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user