diff options
| author | MaranBr <maranbr@outlook.com> | 2025-09-28 07:29:19 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2025-09-28 07:29:19 +0200 |
| commit | c725641f13772aa7d5705227e8fbe2c5b85ebb6a (patch) | |
| tree | 63511fc029ded9b7a49a613a9f5fbefa4392e6ee /src/video_core/buffer_cache | |
| parent | 02016697d6c63a976cf551b8c9d2cf11fea2fe6d (diff) | |
[video_core] Fix fast buffers without performance loss (#2605)
Fixes games that have some elements flickering on the screen, such as Kirby Star Allies and others, without impacting performance.
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2605
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Co-authored-by: MaranBr <maranbr@outlook.com>
Co-committed-by: MaranBr <maranbr@outlook.com>
Diffstat (limited to 'src/video_core/buffer_cache')
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index eb18a4bd66..6f6e0c23a8 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -785,18 +785,13 @@ void BufferCache<P>::BindHostGraphicsUniformBuffers(size_t stage) { } template <class P> -void BufferCache<P>::BindHostGraphicsUniformBuffer(size_t stage, u32 index, u32 binding_index, - bool needs_bind) { +void BufferCache<P>::BindHostGraphicsUniformBuffer(size_t stage, u32 index, u32 binding_index, bool needs_bind) { + ++channel_state->uniform_cache_shots[0]; const Binding& binding = channel_state->uniform_buffers[stage][index]; const DAddr device_addr = binding.device_addr; const u32 size = (std::min)(binding.size, (*channel_state->uniform_buffer_sizes)[stage][index]); Buffer& buffer = slot_buffers[binding.buffer_id]; TouchBuffer(buffer, binding.buffer_id); - const bool sync_buffer = SynchronizeBuffer(buffer, device_addr, size); - if (sync_buffer) { - ++channel_state->uniform_cache_hits[0]; - } - ++channel_state->uniform_cache_shots[0]; const bool use_fast_buffer = binding.buffer_id != NULL_BUFFER_ID && size <= channel_state->uniform_buffer_skip_cache_size && !memory_tracker.IsRegionGpuModified(device_addr, size); @@ -827,7 +822,10 @@ void BufferCache<P>::BindHostGraphicsUniformBuffer(size_t stage, u32 index, u32 device_memory.ReadBlockUnsafe(device_addr, span.data(), size); return; } - + // Classic cached path + if (SynchronizeBuffer(buffer, device_addr, size)) { + ++channel_state->uniform_cache_hits[0]; + } // Skip binding if it's not needed and if the bound buffer is not the fast version // This exists to avoid instances where the fast buffer is bound and a GPU write happens needs_bind |= HasFastUniformBufferBound(stage, binding_index); |
