summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorameerj <52414509+ameerj@users.noreply.github.com>2022-12-16 06:20:24 +0100
committerameerj <52414509+ameerj@users.noreply.github.com>2022-12-20 00:08:04 +0100
commitbdef22ff8530f936e10d9ca8bed288445f8bda20 (patch)
treee2db1d1c995a67108172d7165de8ca7580c788ec
parentvideo_core: Add usages of ScratchBuffer (diff)
downloadyuzu-bdef22ff8530f936e10d9ca8bed288445f8bda20.tar
yuzu-bdef22ff8530f936e10d9ca8bed288445f8bda20.tar.gz
yuzu-bdef22ff8530f936e10d9ca8bed288445f8bda20.tar.bz2
yuzu-bdef22ff8530f936e10d9ca8bed288445f8bda20.tar.lz
yuzu-bdef22ff8530f936e10d9ca8bed288445f8bda20.tar.xz
yuzu-bdef22ff8530f936e10d9ca8bed288445f8bda20.tar.zst
yuzu-bdef22ff8530f936e10d9ca8bed288445f8bda20.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index 502b4d90a..a8bd5585b 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -20,6 +20,7 @@
#include "common/lru_cache.h"
#include "common/microprofile.h"
#include "common/polyfill_ranges.h"
+#include "common/scratch_buffer.h"
#include "common/settings.h"
#include "core/memory.h"
#include "video_core/buffer_cache/buffer_base.h"
@@ -422,8 +423,7 @@ private:
IntervalSet common_ranges;
std::deque<IntervalSet> committed_ranges;
- size_t immediate_buffer_capacity = 0;
- std::unique_ptr<u8[]> immediate_buffer_alloc;
+ Common::ScratchBuffer<u8> immediate_buffer_alloc;
struct LRUItemParams {
using ObjectType = BufferId;
@@ -1926,11 +1926,8 @@ std::span<const u8> BufferCache<P>::ImmediateBufferWithData(VAddr cpu_addr, size
template <class P>
std::span<u8> BufferCache<P>::ImmediateBuffer(size_t wanted_capacity) {
- if (wanted_capacity > immediate_buffer_capacity) {
- immediate_buffer_capacity = wanted_capacity;
- immediate_buffer_alloc = std::make_unique<u8[]>(wanted_capacity);
- }
- return std::span<u8>(immediate_buffer_alloc.get(), wanted_capacity);
+ immediate_buffer_alloc.resize(wanted_capacity);
+ return std::span<u8>(immediate_buffer_alloc.data(), wanted_capacity);
}
template <class P>