Resource Management 6: VK support for resource allocation.
Refactor existing memory allocators by using a common
memory type and handle.
BUG=dawn:27
Change-Id: Ieed4fa30a0bd8fedfb3a3c580920805f40b56fae
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/10680
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
diff --git a/src/dawn_native/ResourceMemoryAllocation.cpp b/src/dawn_native/ResourceMemoryAllocation.cpp
index 1ace4d4..5d26f21 100644
--- a/src/dawn_native/ResourceMemoryAllocation.cpp
+++ b/src/dawn_native/ResourceMemoryAllocation.cpp
@@ -19,16 +19,23 @@
namespace dawn_native {
- static constexpr uint64_t INVALID_OFFSET = std::numeric_limits<uint64_t>::max();
+ static constexpr uint64_t kInvalidOffset = std::numeric_limits<uint64_t>::max();
ResourceMemoryAllocation::ResourceMemoryAllocation()
- : mMethod(AllocationMethod::kInvalid), mOffset(INVALID_OFFSET), mResourceHeap(nullptr) {
+ : mMethod(AllocationMethod::kInvalid),
+ mOffset(0),
+ mResourceHeap(nullptr),
+ mMappedPointer(nullptr) {
}
ResourceMemoryAllocation::ResourceMemoryAllocation(uint64_t offset,
ResourceHeapBase* resourceHeap,
- AllocationMethod method)
- : mMethod(method), mOffset(offset), mResourceHeap(resourceHeap) {
+ AllocationMethod method,
+ uint8_t* mappedPointer)
+ : mMethod(method),
+ mOffset(offset),
+ mResourceHeap(resourceHeap),
+ mMappedPointer(mappedPointer) {
}
ResourceHeapBase* ResourceMemoryAllocation::GetResourceHeap() const {
@@ -46,8 +53,13 @@
return mMethod;
}
+ uint8_t* ResourceMemoryAllocation::GetMappedPointer() const {
+ return mMappedPointer;
+ }
+
void ResourceMemoryAllocation::Invalidate() {
mResourceHeap = nullptr;
mMethod = AllocationMethod::kInvalid;
+ mOffset = kInvalidOffset;
}
} // namespace dawn_native
\ No newline at end of file