summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2020-11-19 13:54:00 +0100
committerLioncash <mathew1800@gmail.com>2020-11-19 13:54:03 +0100
commit412044960a39180bc9990f6b35e1872c6a69591b (patch)
tree2423f639b1713380aab4196d0abb682789416c49 /src
parentMerge pull request #4936 from lioncash/page (diff)
downloadyuzu-412044960a39180bc9990f6b35e1872c6a69591b.tar
yuzu-412044960a39180bc9990f6b35e1872c6a69591b.tar.gz
yuzu-412044960a39180bc9990f6b35e1872c6a69591b.tar.bz2
yuzu-412044960a39180bc9990f6b35e1872c6a69591b.tar.lz
yuzu-412044960a39180bc9990f6b35e1872c6a69591b.tar.xz
yuzu-412044960a39180bc9990f6b35e1872c6a69591b.tar.zst
yuzu-412044960a39180bc9990f6b35e1872c6a69591b.zip
Diffstat (limited to 'src')
-rw-r--r--src/common/virtual_buffer.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/common/virtual_buffer.h b/src/common/virtual_buffer.h
index 078e61c77..91d430036 100644
--- a/src/common/virtual_buffer.h
+++ b/src/common/virtual_buffer.h
@@ -43,9 +43,14 @@ public:
}
void resize(std::size_t count) {
+ const auto new_size = count * sizeof(T);
+ if (new_size == alloc_size) {
+ return;
+ }
+
FreeMemoryPages(base_ptr, alloc_size);
- alloc_size = count * sizeof(T);
+ alloc_size = new_size;
base_ptr = reinterpret_cast<T*>(AllocateMemoryPages(alloc_size));
}