mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
buffer_cache: Use Common::ScratchBuffer for ImmediateBuffer usage
This commit is contained in:
parent
4bc2d82130
commit
bdef22ff85
|
@ -20,6 +20,7 @@
|
||||||
#include "common/lru_cache.h"
|
#include "common/lru_cache.h"
|
||||||
#include "common/microprofile.h"
|
#include "common/microprofile.h"
|
||||||
#include "common/polyfill_ranges.h"
|
#include "common/polyfill_ranges.h"
|
||||||
|
#include "common/scratch_buffer.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
#include "video_core/buffer_cache/buffer_base.h"
|
#include "video_core/buffer_cache/buffer_base.h"
|
||||||
|
@ -422,8 +423,7 @@ private:
|
||||||
IntervalSet common_ranges;
|
IntervalSet common_ranges;
|
||||||
std::deque<IntervalSet> committed_ranges;
|
std::deque<IntervalSet> committed_ranges;
|
||||||
|
|
||||||
size_t immediate_buffer_capacity = 0;
|
Common::ScratchBuffer<u8> immediate_buffer_alloc;
|
||||||
std::unique_ptr<u8[]> immediate_buffer_alloc;
|
|
||||||
|
|
||||||
struct LRUItemParams {
|
struct LRUItemParams {
|
||||||
using ObjectType = BufferId;
|
using ObjectType = BufferId;
|
||||||
|
@ -1926,11 +1926,8 @@ std::span<const u8> BufferCache<P>::ImmediateBufferWithData(VAddr cpu_addr, size
|
||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
std::span<u8> BufferCache<P>::ImmediateBuffer(size_t wanted_capacity) {
|
std::span<u8> BufferCache<P>::ImmediateBuffer(size_t wanted_capacity) {
|
||||||
if (wanted_capacity > immediate_buffer_capacity) {
|
immediate_buffer_alloc.resize(wanted_capacity);
|
||||||
immediate_buffer_capacity = wanted_capacity;
|
return std::span<u8>(immediate_buffer_alloc.data(), wanted_capacity);
|
||||||
immediate_buffer_alloc = std::make_unique<u8[]>(wanted_capacity);
|
|
||||||
}
|
|
||||||
return std::span<u8>(immediate_buffer_alloc.get(), wanted_capacity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
|
|
Loading…
Reference in a new issue