aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/buffer_cache/buffer_cache.h
diff options
context:
space:
mode:
authorJPikachu <jpikachu.eden@gmail.com>2025-06-29 17:14:23 +0000
committerJPikachu <jpikachu@noreply.localhost>2025-06-29 17:14:23 +0000
commit91a662431cfe419bd46b6ca4ed298a4ba70d7820 (patch)
tree686cf38ab4c6d697e336be4684626707284afca2 /src/video_core/buffer_cache/buffer_cache.h
parentb5b1d20e1e0756066abf0457bd66695dde40bab7 (diff)
[Texture_cache] Better memory handling for devices with lower memory allocations (#233)
Means games like Minecraft Dungeons, Sea of Stars, Luigi Mansion 2, Astroneer, Alan Wake, etc are now playable. It also cleans up the recent abi.cpp and bindless texture commits a bit. Everything is in #ifdef ANDROID - The biggest change is CACHING_PAGEBITS = 12. Without that the way the buffercache grows and joins buffers can cause Android to run out of memory (as you end up with just one big buffer that needs to be copied every time it grows) Also patches up ffmpeg issues. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/233 Co-authored-by: JPikachu <jpikachu.eden@gmail.com> Co-committed-by: JPikachu <jpikachu.eden@gmail.com>
Diffstat (limited to 'src/video_core/buffer_cache/buffer_cache.h')
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index af237703d5..c7e287553e 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -50,7 +50,7 @@ BufferCache<P>::~BufferCache() = default;
template <class P>
void BufferCache<P>::RunGarbageCollector() {
const bool aggressive_gc = total_used_memory >= critical_memory;
- const u64 ticks_to_destroy = aggressive_gc ? 60 : 120;
+ const u64 ticks_to_destroy = aggressive_gc ? 60 : 150;
int num_iterations = aggressive_gc ? 64 : 32;
const auto clean_up = [this, &num_iterations](BufferId buffer_id) {
if (num_iterations == 0) {
@@ -1380,6 +1380,9 @@ void BufferCache<P>::JoinOverlap(BufferId new_buffer_id, BufferId overlap_id,
});
new_buffer.MarkUsage(copies[0].dst_offset, copies[0].size);
runtime.CopyBuffer(new_buffer, overlap, copies, true);
+#ifdef ANDROID
+ runtime.Finish();
+#endif
DeleteBuffer(overlap_id, true);
}
@@ -1671,7 +1674,12 @@ void BufferCache<P>::DeleteBuffer(BufferId buffer_id, bool do_not_mark) {
}
Unregister(buffer_id);
+
+#ifdef ANDROID
+ if (!do_not_mark)
+#endif
delayed_destruction_ring.Push(std::move(slot_buffers[buffer_id]));
+
slot_buffers.erase(buffer_id);
if constexpr (HAS_PERSISTENT_UNIFORM_BUFFER_BINDINGS) {