summaryrefslogtreecommitdiffstats
path: root/src/video_core/vulkan_common/vulkan_memory_allocator.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-01-06 05:18:37 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2021-01-15 20:19:40 +0100
commit301e2b5b7a130730f42de2bb6615c0cacd78c7de (patch)
tree1d1ac74ac0f0f9be667c961f1e7a225454b384ec /src/video_core/vulkan_common/vulkan_memory_allocator.cpp
parentvk_texture_cache: Use Download memory types for texture flushes (diff)
downloadyuzu-301e2b5b7a130730f42de2bb6615c0cacd78c7de.tar
yuzu-301e2b5b7a130730f42de2bb6615c0cacd78c7de.tar.gz
yuzu-301e2b5b7a130730f42de2bb6615c0cacd78c7de.tar.bz2
yuzu-301e2b5b7a130730f42de2bb6615c0cacd78c7de.tar.lz
yuzu-301e2b5b7a130730f42de2bb6615c0cacd78c7de.tar.xz
yuzu-301e2b5b7a130730f42de2bb6615c0cacd78c7de.tar.zst
yuzu-301e2b5b7a130730f42de2bb6615c0cacd78c7de.zip
Diffstat (limited to 'src/video_core/vulkan_common/vulkan_memory_allocator.cpp')
-rw-r--r--src/video_core/vulkan_common/vulkan_memory_allocator.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/video_core/vulkan_common/vulkan_memory_allocator.cpp b/src/video_core/vulkan_common/vulkan_memory_allocator.cpp
index f15061d0c..d6eb3af31 100644
--- a/src/video_core/vulkan_common/vulkan_memory_allocator.cpp
+++ b/src/video_core/vulkan_common/vulkan_memory_allocator.cpp
@@ -71,7 +71,7 @@ public:
.end = *alloc + size,
};
commits.insert(std::ranges::upper_bound(commits, *alloc, {}, &Range::begin), range);
- return std::make_optional<MemoryCommit>(device, this, *memory, *alloc, *alloc + size);
+ return std::make_optional<MemoryCommit>(this, *memory, *alloc, *alloc + size);
}
void Free(u64 begin) {
@@ -127,9 +127,9 @@ private:
std::span<u8> memory_mapped_span; ///< Memory mapped span. Empty if not queried before.
};
-MemoryCommit::MemoryCommit(const Device& device_, MemoryAllocation* allocation_,
- VkDeviceMemory memory_, u64 begin, u64 end) noexcept
- : device{&device_}, allocation{allocation_}, memory{memory_}, interval{begin, end} {}
+MemoryCommit::MemoryCommit(MemoryAllocation* allocation_, VkDeviceMemory memory_, u64 begin_,
+ u64 end_) noexcept
+ : allocation{allocation_}, memory{memory_}, begin{begin_}, end{end_} {}
MemoryCommit::~MemoryCommit() {
Release();
@@ -137,28 +137,28 @@ MemoryCommit::~MemoryCommit() {
MemoryCommit& MemoryCommit::operator=(MemoryCommit&& rhs) noexcept {
Release();
- device = rhs.device;
allocation = std::exchange(rhs.allocation, nullptr);
memory = rhs.memory;
- interval = rhs.interval;
+ begin = rhs.begin;
+ end = rhs.end;
span = std::exchange(rhs.span, std::span<u8>{});
return *this;
}
MemoryCommit::MemoryCommit(MemoryCommit&& rhs) noexcept
- : device{rhs.device}, allocation{std::exchange(rhs.allocation, nullptr)}, memory{rhs.memory},
- interval{rhs.interval}, span{std::exchange(rhs.span, std::span<u8>{})} {}
+ : allocation{std::exchange(rhs.allocation, nullptr)}, memory{rhs.memory}, begin{rhs.begin},
+ end{rhs.end}, span{std::exchange(rhs.span, std::span<u8>{})} {}
std::span<u8> MemoryCommit::Map() {
if (span.empty()) {
- span = allocation->Map().subspan(interval.first, interval.second - interval.first);
+ span = allocation->Map().subspan(begin, end - begin);
}
return span;
}
void MemoryCommit::Release() {
if (allocation) {
- allocation->Free(interval.first);
+ allocation->Free(begin);
}
}