From b1f3b568fbbcb41e3fbe3f86f3ba039f050efb15 Mon Sep 17 00:00:00 2001 From: Shinmegumi Date: Sat, 26 Jul 2025 18:12:54 +0200 Subject: [vk] Fix query cache leak on missed sync (#131) Provided by community member, elementary-particle. Submitted as PR by MaranBR. Fixed issues: 1. The queue cache forgot to put the host query into unregister queue if they weren't synced. This will block all the banks from freeing causing a major leak. 2. SamplesQueryCounter is not aligned with renderpass begin/end. This creates invalid queries. 3. Conditional rendering is not turned on/off at the correct location making them invalid. Co-authored-by: Maufeat Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/131 Co-authored-by: Shinmegumi Co-committed-by: Shinmegumi --- src/video_core/query_cache/query_cache.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/video_core/query_cache/query_cache.h') diff --git a/src/video_core/query_cache/query_cache.h b/src/video_core/query_cache/query_cache.h index 08b7790555..6e084cc079 100644 --- a/src/video_core/query_cache/query_cache.h +++ b/src/video_core/query_cache/query_cache.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -115,8 +118,8 @@ struct QueryCacheBase::QueryCacheBaseImpl { QueryCacheBaseImpl(QueryCacheBase* owner_, VideoCore::RasterizerInterface& rasterizer_, Tegra::MaxwellDeviceMemoryManager& device_memory_, RuntimeType& runtime_, Tegra::GPU& gpu_) - : owner{owner_}, rasterizer{rasterizer_}, - device_memory{device_memory_}, runtime{runtime_}, gpu{gpu_} { + : owner{owner_}, rasterizer{rasterizer_}, device_memory{device_memory_}, runtime{runtime_}, + gpu{gpu_} { streamer_mask = 0; for (size_t i = 0; i < static_cast(QueryType::MaxQueryTypes); i++) { streamers[i] = runtime.GetStreamerInterface(static_cast(i)); @@ -267,7 +270,11 @@ void QueryCacheBase::CounterReport(GPUVAddr addr, QueryType counter_type return; } if (False(query_base->flags & QueryFlagBits::IsFinalValueSynced)) [[unlikely]] { - ASSERT(false); + LOG_ERROR(HW_GPU, + "Query report value not synchronized. Consider increasing GPU accuracy."); + if (!is_synced) [[likely]] { + impl->pending_unregister.push_back(query_location); + } return; } query_base->value += streamer->GetAmendValue(); @@ -370,8 +377,6 @@ void QueryCacheBase::NotifySegment(bool resume) { if (resume) { impl->runtime.ResumeHostConditionalRendering(); } else { - CounterClose(VideoCommon::QueryType::ZPassPixelCount64); - CounterClose(VideoCommon::QueryType::StreamingByteCount); impl->runtime.PauseHostConditionalRendering(); } } -- cgit v1.2.3