From 0f110e30ca524c8bf9dfa1b24de7a6e91bdb708a Mon Sep 17 00:00:00 2001 From: Jonas Date: Thu, 5 Nov 2026 09:58:11 +0600 Subject: [PATCH] macro: flush pending query writes before native MME DMA reads Accurate GPU mode keeps report and semaphore writes in the query cache until a fence, and the MME DMA read only flushed the buffer cache. Ocarina of Time's predicate macro (0x142) then read a stale "visible" record, ran its half-res depth clears every frame and drew the fog over Link and the terrain; per-object occlusion predicates read old counts and leaves and lights flickered. Fast mode writes payloads immediately and was unaffected. Assisted-by: Claude Opus 5.5 (traced the predicate reads, wrote the fix) (cherry picked from commit 50db84983f68ba817f1a687404094d4c91d80587) --- src/video_core/macro.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/video_core/macro.cpp b/src/video_core/macro.cpp index 8f0f549835..7981a4ecb9 100644 --- a/src/video_core/macro.cpp +++ b/src/video_core/macro.cpp @@ -1433,6 +1433,12 @@ void MacroEngine::Execute(Core::System& system, Engines::Maxwell3D& maxwell3d, u } } } + // Accurate GPU mode holds report and semaphore writes in the query cache until a + // fence: write them out, or occlusion predicates read stale values. The split only + // runs with immediate payload writes, and the query cache belongs to its back. + if (!VideoCommon::GpuSplit::Get().Active()) { + memory.FlushRegion(source, read_bytes, VideoCommon::CacheType::QueryCache); + } if (memory.IsMemoryDirty(source, read_bytes, VideoCommon::CacheType::BufferCache)) { memory.FlushRegion(source, read_bytes, VideoCommon::CacheType::BufferCache); static u64 flushes{};