summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-11-19 21:39:38 +0100
committerGitHub <noreply@github.com>2020-11-19 21:39:38 +0100
commit6971d088939a86b3e4cf477168be8f2592679323 (patch)
tree2423f639b1713380aab4196d0abb682789416c49 /src/common
parentMerge pull request #4936 from lioncash/page (diff)
parentvirtual_buffer: Do nothing on resize() calls with same sizes (diff)
downloadyuzu-6971d088939a86b3e4cf477168be8f2592679323.tar
yuzu-6971d088939a86b3e4cf477168be8f2592679323.tar.gz
yuzu-6971d088939a86b3e4cf477168be8f2592679323.tar.bz2
yuzu-6971d088939a86b3e4cf477168be8f2592679323.tar.lz
yuzu-6971d088939a86b3e4cf477168be8f2592679323.tar.xz
yuzu-6971d088939a86b3e4cf477168be8f2592679323.tar.zst
yuzu-6971d088939a86b3e4cf477168be8f2592679323.zip
Diffstat (limited to 'src/common')
-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));
}