From c306f0163005b336b532ab0dca996cc89774335d Mon Sep 17 00:00:00 2001 From: ParantezTech <12572227+par274@users.noreply.github.com> Date: Tue, 28 Jul 2026 16:12:51 +0300 Subject: [PATCH] [video] restored texture cache bound and gated present diagnostics --- .../VideoOut/VulkanVideoPresenter.cs | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/src/SharpEmu.Libs/VideoOut/VulkanVideoPresenter.cs b/src/SharpEmu.Libs/VideoOut/VulkanVideoPresenter.cs index 7c0d3498..853caefe 100644 --- a/src/SharpEmu.Libs/VideoOut/VulkanVideoPresenter.cs +++ b/src/SharpEmu.Libs/VideoOut/VulkanVideoPresenter.cs @@ -8459,15 +8459,13 @@ internal static unsafe class VulkanVideoPresenter /// private void DrainGuestImageCpuSync() { - if (!SharpEmu.HLE.GuestImageWriteTracker.Enabled) - { - return; - } - - _ = Interlocked.Exchange(ref _cpuWrittenGuestImageSyncRequested, 0); - + var syncEnabled = SharpEmu.HLE.GuestImageWriteTracker.Enabled; HashSet? dirtyAddresses = null; List<(ulong Address, uint Width, uint Height, ulong ByteCount)>? extents = null; + if (syncEnabled) + { + _ = Interlocked.Exchange(ref _cpuWrittenGuestImageSyncRequested, 0); + lock (_gate) { if (_guestImageExtents.Count > 0) @@ -8536,6 +8534,8 @@ internal static unsafe class VulkanVideoPresenter } } + } + if (_textureCache.Count == 0) { if (dirtyAddresses is not null) @@ -14508,27 +14508,26 @@ internal static unsafe class VulkanVideoPresenter if (!tookPresentation) { - // Upstream also replays the last host splash here after an - // embedded-surface resize. That path is gone with the SDL - // window: there is no host surface to resize around, and the - // swapchain recreate above already covers SDL's own resize. - // // A render-loop tick with no newer flip is normal. Warn only when // an actual queued presentation is waiting on unfinished guest work. - var hasPendingPresentation = - HasPendingGuestPresentation(_presentedSequence); - SharpEmu.Libs.Diagnostics.LoadProgressDiagnostics.TracePresentNotTaken( - _presentedSequence, - hasPendingPresentation); - SharpEmu.Libs.Diagnostics.LoadProgressDiagnostics.TraceGpuWaitSnapshot(); - if (ShouldTracePresentedGuestImageContentsForDiagnostics() && - hasPendingPresentation && - _presentNotTakenLoggedSequence != _presentedSequence) + if (SharpEmu.Libs.Diagnostics.LoadProgressDiagnostics.IsActive || + ShouldTracePresentedGuestImageContentsForDiagnostics()) { - _presentNotTakenLoggedSequence = _presentedSequence; - Console.Error.WriteLine( - $"[LOADER][WARN] vk.present_not_taken seq={_presentedSequence} " + - "— presentation submitted but its required guest work isn't complete; nothing shown."); + var hasPendingPresentation = + HasPendingGuestPresentation(_presentedSequence); + SharpEmu.Libs.Diagnostics.LoadProgressDiagnostics.TracePresentNotTaken( + _presentedSequence, + hasPendingPresentation); + SharpEmu.Libs.Diagnostics.LoadProgressDiagnostics.TraceGpuWaitSnapshot(); + if (ShouldTracePresentedGuestImageContentsForDiagnostics() && + hasPendingPresentation && + _presentNotTakenLoggedSequence != _presentedSequence) + { + _presentNotTakenLoggedSequence = _presentedSequence; + Console.Error.WriteLine( + $"[LOADER][WARN] vk.present_not_taken seq={_presentedSequence} " + + "— presentation submitted but its required guest work isn't complete; nothing shown."); + } } return;