Browse Source

[texture_cache] Fix a rare visual corruption under specific conditions (#3986)

This fixes a rare visual corruption that can occur under specific conditions depending on the hardware used.

This bug is known to affect the loading screens in The Legend of Zelda: Tears of the Kingdom.

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3986
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
pull/4010/head
MaranBr 4 days ago
committed by crueter
parent
commit
573e06131d
No known key found for this signature in database GPG Key ID: 425ACD2D4830EBC6
  1. 5
      src/common/lru_cache.h
  2. 2
      src/video_core/texture_cache/texture_cache.h

5
src/common/lru_cache.h

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@ -60,7 +63,7 @@ public:
template <typename Func>
void ForEachItemBelow(TickType tick, Func&& func) {
static constexpr bool RETURNS_BOOL =
std::is_same_v<std::invoke_result<Func, ObjectType>, bool>;
std::is_same_v<std::invoke_result_t<Func, ObjectType>, bool>;
Item* iterator = first_item;
while (iterator) {
if (static_cast<s64>(tick) - static_cast<s64>(iterator->tick) < 0) {

2
src/video_core/texture_cache/texture_cache.h

@ -128,6 +128,7 @@ void TextureCache<P>::RunGarbageCollector() {
if (num_iterations == 0) {
return true;
}
--num_iterations;
auto& image = slot_images[image_id];
if (True(image.flags & ImageFlagBits::IsDecoding)) {
return false;
@ -136,7 +137,6 @@ void TextureCache<P>::RunGarbageCollector() {
if ((!aggressive_mode && True(image.flags & ImageFlagBits::CostlyLoad)) || (!high_priority_mode && must_download)) {
return false;
}
--num_iterations;
if (must_download) {
auto map = runtime.DownloadStagingBuffer(image.unswizzled_size_bytes);
const auto copies = FixSmallVectorADL(FullDownloadCopies(image.info));

Loading…
Cancel
Save