From fa600b88b180bc3de4009c1ee771f2cc1a481730 Mon Sep 17 00:00:00 2001 From: CamilleLaVey Date: Mon, 30 Jun 2025 12:57:21 +0000 Subject: revert 91a662431cfe419bd46b6ca4ed298a4ba70d7820 (#240) revert [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 Co-committed-by: JPikachu Had showed some regressions on devices with higher specifications, will be refined to return as a toggle in a later commit. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/240 --- src/video_core/buffer_cache/buffer_cache.h | 10 +--------- src/video_core/buffer_cache/buffer_cache_base.h | 17 +---------------- 2 files changed, 2 insertions(+), 25 deletions(-) (limited to 'src/video_core/buffer_cache') diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index c7e287553e..af237703d5 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -50,7 +50,7 @@ BufferCache

::~BufferCache() = default; template void BufferCache

::RunGarbageCollector() { const bool aggressive_gc = total_used_memory >= critical_memory; - const u64 ticks_to_destroy = aggressive_gc ? 60 : 150; + const u64 ticks_to_destroy = aggressive_gc ? 60 : 120; int num_iterations = aggressive_gc ? 64 : 32; const auto clean_up = [this, &num_iterations](BufferId buffer_id) { if (num_iterations == 0) { @@ -1380,9 +1380,6 @@ void BufferCache

::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); } @@ -1674,12 +1671,7 @@ void BufferCache

::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) { diff --git a/src/video_core/buffer_cache/buffer_cache_base.h b/src/video_core/buffer_cache/buffer_cache_base.h index 3a40bbad19..240e9f0150 100644 --- a/src/video_core/buffer_cache/buffer_cache_base.h +++ b/src/video_core/buffer_cache/buffer_cache_base.h @@ -156,11 +156,7 @@ template class BufferCache : public VideoCommon::ChannelSetupCaches { // Page size for caching purposes. // This is unrelated to the CPU page size and it can be changed as it seems optimal. -#ifdef ANDROID - static constexpr u32 CACHING_PAGEBITS = 12; -#else static constexpr u32 CACHING_PAGEBITS = 16; -#endif static constexpr u64 CACHING_PAGESIZE = u64{1} << CACHING_PAGEBITS; static constexpr bool IS_OPENGL = P::IS_OPENGL; @@ -174,15 +170,9 @@ class BufferCache : public VideoCommon::ChannelSetupCaches slot_buffers; -#ifdef ANDROID - static constexpr size_t TICKS_TO_DESTROY = 2; -#else - static constexpr size_t TICKS_TO_DESTROY = 8; -#endif - DelayedDestructionRing delayed_destruction_ring; + DelayedDestructionRing delayed_destruction_ring; const Tegra::Engines::DrawManager::IndirectParams* current_draw_indirect{}; -- cgit v1.2.3