Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.
C++
Vsync keeps a one-deep queue; video-memory watchdog with module inventory
Veyra Goal Agent496a72c65d22
diff --git a/include/veyra/engine/EngineController.h b/include/veyra/engine/EngineController.hindex fdf6d11b..3f2158bd 100644--- a/include/veyra/engine/EngineController.h+++ b/include/veyra/engine/EngineController.h@@ -49,6 +49,9 @@ struct PlayerSnapshot {std::wstring presentationStatus;TransportState transport=TransportState::Empty;uint64_t sessionId=0,rejectedRevision=0;float volume=1;bool muted=false,audioAvailable=false;+ // Video memory that kept growing with no settings change (MiB above the session's low point),+ // 0 until the watchdog fires. Field logs 2026-10-01: +3 GB a minute in fullscreen only.+ uint64_t vramRunawayMiB=0;std::wstring status=L"请打开视频或图片";EnhancementSettings desired,applied;bool applying=false;bool nrActive=false,srActive=false,fgActive=false;diff --git a/include/veyra/gfx/PresentationHooks.h b/include/veyra/gfx/PresentationHooks.hindex 426c35ff..8d8813e5 100644--- a/include/veyra/gfx/PresentationHooks.h+++ b/include/veyra/gfx/PresentationHooks.h@@ -8,6 +8,10 @@// and the driver crashed on a window change. The same tools are fine with the ordinary// DXGI swapchain and with DLSS frame generation.#include <windows.h>+#include <psapi.h>+#include <algorithm>+#include <iterator>+#include <string>namespace veyra::gfx {@@ -30,4 +34,33 @@ inline const PresentationHook* injectedPresentationHook() {return nullptr;}+// Every loaded module that is neither part of Windows nor shipped next to the executable,+// as "name; name; …" for the log. Overlays, recorders and monitoring tools show up here;+// a field log with a mystery slowdown can then say which of them was in the process.+inline std::string thirdPartyModules() {+ HMODULE modules[1024]; DWORD needed = 0;+ if (!K32EnumProcessModules(GetCurrentProcess(), modules, sizeof(modules), &needed)) return "unavailable";+ wchar_t windowsDir[MAX_PATH]{}, exeDir[MAX_PATH]{};+ GetWindowsDirectoryW(windowsDir, MAX_PATH);+ GetModuleFileNameW(nullptr, exeDir, MAX_PATH);+ if (auto* slash = wcsrchr(exeDir, L'\\')) slash[1] = 0;+ const auto startsWith = [](const wchar_t* path, const wchar_t* prefix) {+ const size_t n = wcslen(prefix); return n && _wcsnicmp(path, prefix, n) == 0;+ };+ std::string out;+ const DWORD count = std::min<DWORD>(needed / sizeof(HMODULE), DWORD(std::size(modules)));+ for (DWORD i = 0; i < count; ++i) {+ wchar_t path[MAX_PATH]{};+ if (!GetModuleFileNameW(modules[i], path, MAX_PATH)) continue;+ // Driver components live under Windows\System32\DriverStore; keep those, they carry+ // the driver's own overlay and filter modules.+ if ((startsWith(path, windowsDir) && !wcsstr(path, L"\\DriverStore\\")) || startsWith(path, exeDir)) continue;+ char utf8[MAX_PATH * 3]{};+ WideCharToMultiByte(CP_UTF8, 0, path, -1, utf8, int(sizeof(utf8)), nullptr, nullptr);+ if (!out.empty()) out += "; ";+ out += utf8;+ }+ return out.empty() ? "none" : out;+}+} // namespace veyra::gfxdiff --git a/scripts/ui-check/leak-fullscreen-file.qml b/scripts/ui-check/leak-fullscreen-file.qmlnew file mode 100644index 00000000..fdb9d586--- /dev/null+++ b/scripts/ui-check/leak-fullscreen-file.qml@@ -0,0 +1,13 @@++ // ---- VRAM-leak run: capture with NR, then fullscreen for a while (field log: +3 GB/min) ----+ Timer { interval: 150; running: true; repeat: true; onTriggered: veyra.logUi("uitest-tick", "") }+ Timer {+ interval: 1000; running: true; repeat: true+ property int ticks: 0+ onTriggered: {+ ++ticks+ if (ticks === 2) { veyra.openUrl("@VIDEO@"); veyra.nrEnabled = true }+ if (ticks === 40) { veyra.logUi("uitest", "UITEST_NOTE windowed phase done"); root.toggleFullscreen() }+ if (ticks === @END@) { root.toggleFullscreen(); veyra.logUi("uitest", "UITEST_DONE"); running = false }+ }+ }diff --git a/scripts/ui-check/leak-fullscreen-screen.qml b/scripts/ui-check/leak-fullscreen-screen.qmlnew file mode 100644index 00000000..6bedd46f--- /dev/null+++ b/scripts/ui-check/leak-fullscreen-screen.qml@@ -0,0 +1,14 @@++ // ---- VRAM-leak run: capture with NR, then fullscreen for a while (field log: +3 GB/min) ----+ Timer { interval: 150; running: true; repeat: true; onTriggered: veyra.logUi("uitest-tick", "") }+ Timer {+ interval: 1000; running: true; repeat: true+ property int ticks: 0+ onTriggered: {+ ++ticks+ if (ticks === 2) veyra.openScreenCaptureDialog()+ if (ticks === 5) { const t = veyra.screenTargets; veyra.logUi("uitest", "UITEST_NOTE targets=" + JSON.stringify(t).slice(0, 300)); if (t.length) veyra.screenTargetId = t[0].id; veyra.nrEnabled = true; veyra.logUi("uitest", "UITEST_NOTE screen=" + veyra.startScreenCapture()); dialogs.close() }+ if (ticks === 40) { veyra.logUi("uitest", "UITEST_NOTE windowed phase done"); root.toggleFullscreen() }+ if (ticks === @END@) { root.toggleFullscreen(); veyra.logUi("uitest", "UITEST_DONE"); running = false }+ }+ }diff --git a/scripts/ui-check/leak-fullscreen.qml b/scripts/ui-check/leak-fullscreen.qmlnew file mode 100644index 00000000..e4269eef--- /dev/null+++ b/scripts/ui-check/leak-fullscreen.qml@@ -0,0 +1,21 @@++ // ---- VRAM-leak run: capture with NR, then fullscreen for a while (field log: +3 GB/min) ----+ Timer { interval: 150; running: true; repeat: true; onTriggered: veyra.logUi("uitest-tick", "") }+ Timer {+ interval: 1000; running: true; repeat: true+ property int ticks: 0+ onTriggered: {+ ++ticks+ if (ticks === 2) dialogs.open("capture")+ if (ticks === 6) {+ const f = veyra.captureFormats.find(x => x.label.indexOf("2560 x 1440 @ 60") === 0 && x.label.indexOf("NV12") > 0)+ if (f) veyra.captureFormatKey = f.id+ veyra.logUi("uitest", "UITEST_NOTE format=" + (f ? f.label : "not found"))+ veyra.nrEnabled = true+ veyra.fgEnabled = false+ veyra.startCaptureSession(); dialogs.close()+ }+ if (ticks === 40) { veyra.logUi("uitest", "UITEST_NOTE windowed phase done"); root.toggleFullscreen() }+ if (ticks === @END@) { root.toggleFullscreen(); veyra.logUi("uitest", "UITEST_DONE"); running = false }+ }+ }diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cppindex 3bc6f4d2..dc51ef19 100644--- a/src/engine/EngineController.cpp+++ b/src/engine/EngineController.cpp@@ -34,6 +34,7 @@#include "veyra/sink/ImageExportSink.h"#include "veyra/gfx/D3D12DeviceContext.h"#include "veyra/gfx/CommandSlotRing.h"+#include "veyra/gfx/PresentationHooks.h"#include "veyra/RuntimePaths.h"#include "veyra/engine/GraphDescription.h"#include "veyra/engine/EffectChain.h"@@ -640,6 +641,31 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sstd::array<TimingWindow,size_t(diagnostics::GpuStage::Count)> gpuStageTimes;std::array<uint64_t,size_t(diagnostics::GpuStage::Count)> lastGpuSampleEnd{};auto nextTimingLog=Clock::now()+std::chrono::seconds(1);+ // Video memory watchdog. A field log (RTX 5060 Ti, 2026-10-01) grew +3 GB a minute while+ // fullscreen, kept it after leaving fullscreen, and every pass slowed down once usage+ // passed the budget (5 fps). Unreproduced here; the log line names what else was loaded.+ uint64_t vramFloor=0,vramRevision=~0ull;auto vramSettleUntil=Clock::now();bool vramWarned=false;+ // VEYRA_TEST_VRAM_LEAK_MIB=n: hold on to n MiB more of video memory every second.+ const uint64_t testLeakMiB=[]{wchar_t v[16]{};return GetEnvironmentVariableW(L"VEYRA_TEST_VRAM_LEAK_MIB",v,16)?uint64_t(_wtoi(v)):0ull;}();+ std::vector<Microsoft::WRL::ComPtr<ID3D12Resource>> testLeak;+ auto watchVram=[&](uint64_t usage,uint64_t budget){+ if(testLeakMiB){+ const D3D12_HEAP_PROPERTIES heap{D3D12_HEAP_TYPE_DEFAULT};+ D3D12_RESOURCE_DESC desc{};desc.Dimension=D3D12_RESOURCE_DIMENSION_BUFFER;desc.Width=testLeakMiB<<20;desc.Height=1;desc.DepthOrArraySize=1;desc.MipLevels=1;desc.SampleDesc.Count=1;desc.Layout=D3D12_TEXTURE_LAYOUT_ROW_MAJOR;+ Microsoft::WRL::ComPtr<ID3D12Resource> r;+ if(SUCCEEDED(ctx.device()->CreateCommittedResource(&heap,D3D12_HEAP_FLAG_NONE,&desc,D3D12_RESOURCE_STATE_COMMON,nullptr,IID_PPV_ARGS(&r))))testLeak.push_back(r);+ }+ if(!usage)return;+ if(options.settings.revision!=vramRevision){vramRevision=options.settings.revision;vramFloor=0;vramSettleUntil=Clock::now()+std::chrono::seconds(10);}+ if(Clock::now()<vramSettleUntil)return;+ if(!vramFloor||usage<vramFloor)vramFloor=usage;+ const uint64_t growth=usage-vramFloor,limit=std::max<uint64_t>(2048ull<<20,budget/4);+ if(vramWarned||growth<=limit)return;+ vramWarned=true;+ veyra::log::warn("vram-watch",std::format("video memory grew {} MiB with no settings change (now {} of {} MiB budget); third-party modules: {}",+ growth>>20,usage>>20,budget>>20,gfx::thirdPartyModules()));+ std::lock_guard lock(mutex_);snapshot_.vramRunawayMiB=growth>>20;+ };auto anchor=Clock::now(),statsStart=anchor;double anchorMs=0;uint64_t frames=0,sourceFrames=0;bool wasPaused=false;double discardBefore=0;double lastAudioClockMs=0;bool audioClockExhausted=false;auto audioTailAnchor=anchor;bool publishedAudioRecovery=false;HRESULT publishedAudioError=S_OK;uint64_t publishedAudioRecoveries=0;@@ -1960,13 +1986,14 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sif(veyra::log::verboseFrameLogs()){veyra::log::info("present-deviation",std::format("samples={} entryAbsP95Ms={:.3f} returnAbsP95Ms={:.3f} (one sample per actual submission; media-clock deviation, not scanout latency)",presentReturnDeviation.size(),presentEntryDeviation.p95(),presentReturnDeviation.p95()));veyra::log::info("output-queue",std::format("pendingFrames={} enhancementProcessingMs={:.3f} extraDelayEstimateMs={:.3f}",dashboard.pendingOutputFrames,dashboard.enhancementProcessing.mean.value_or(-1),dashboard.cpuTiming[size_t(diagnostics::CpuStage::EnhancementDelayEstimate)].mean.value_or(-1)));}- veyra::log::info("player-timing",std::format("revision={} decodeP95Ms={:.3f} graphSubmitP95Ms={:.3f} gpuReadyP95Ms={:.3f} presentP95Ms={:.3f} gpuColorP95Ms={:.3f} gpuSrP95Ms={:.3f} gpuFlowP95Ms={:.3f} gpuNrP95Ms={:.3f} gpuResidualP95Ms={:.3f} gpuFgBatchP95Ms={:.3f} gpuBlitP95Ms={:.3f} slotWaits={} slotWaitMs={:.3f} commandSubmits={} displaySubmits={} expiredGenerated={} previewSkipped={} playbackSpeed={:.3f} processed={} entryAbsP95Ms={:.3f} returnAbsP95Ms={:.3f} pendingFrames={} enhancementProcessingMs={:.3f}",options.settings.revision,decodeTimes.p95(),processTimes.p95(),liveScheduler?completed.readyP95:gpuReadyTimes.p95(),presentP95,gpuP95(diagnostics::GpuStage::Color),gpuP95(diagnostics::GpuStage::Sr),gpuP95(diagnostics::GpuStage::Flow),gpuP95(diagnostics::GpuStage::Nr),gpuP95(diagnostics::GpuStage::Residual),gpuP95(diagnostics::GpuStage::FgBatch),gpuP95(diagnostics::GpuStage::Blit),slotWaitCount,slotWaitMilliseconds,commandSubmits,submitted,expired,measured.flow.counters.previewSkippedBeforeGraph,playbackSpeedNow,sourceFrames-statsSourceBase,presentEntryDeviation.p95(),presentReturnDeviation.p95(),dashboard.pendingOutputFrames,dashboard.enhancementProcessing.mean.value_or(-1)));nextTimingLog=Clock::now()+std::chrono::seconds(1);}+ uint64_t vramBudget=0,vramUsage=0;ctx.videoMemoryInfo(vramBudget,vramUsage);watchVram(vramUsage,vramBudget);+ veyra::log::info("player-timing",std::format("vramMiB={} budgetMiB={} revision={} decodeP95Ms={:.3f} graphSubmitP95Ms={:.3f} gpuReadyP95Ms={:.3f} presentP95Ms={:.3f} gpuColorP95Ms={:.3f} gpuSrP95Ms={:.3f} gpuFlowP95Ms={:.3f} gpuNrP95Ms={:.3f} gpuResidualP95Ms={:.3f} gpuFgBatchP95Ms={:.3f} gpuBlitP95Ms={:.3f} slotWaits={} slotWaitMs={:.3f} commandSubmits={} displaySubmits={} expiredGenerated={} previewSkipped={} playbackSpeed={:.3f} processed={} entryAbsP95Ms={:.3f} returnAbsP95Ms={:.3f} pendingFrames={} enhancementProcessingMs={:.3f}",vramUsage>>20,vramBudget>>20,options.settings.revision,decodeTimes.p95(),processTimes.p95(),liveScheduler?completed.readyP95:gpuReadyTimes.p95(),presentP95,gpuP95(diagnostics::GpuStage::Color),gpuP95(diagnostics::GpuStage::Sr),gpuP95(diagnostics::GpuStage::Flow),gpuP95(diagnostics::GpuStage::Nr),gpuP95(diagnostics::GpuStage::Residual),gpuP95(diagnostics::GpuStage::FgBatch),gpuP95(diagnostics::GpuStage::Blit),slotWaitCount,slotWaitMilliseconds,commandSubmits,submitted,expired,measured.flow.counters.previewSkippedBeforeGraph,playbackSpeedNow,sourceFrames-statsSourceBase,presentEntryDeviation.p95(),presentReturnDeviation.p95(),dashboard.pendingOutputFrames,dashboard.enhancementProcessing.mean.value_or(-1)));nextTimingLog=Clock::now()+std::chrono::seconds(1);}if(isCapture&&Clock::now()>=nextTimingLog){logFrameFlow(measured.flow,"active");const auto rates=snapshot();// Adapter memory every second: a long session that slowly runs out of video// memory gets slower in every pass at once (field log 2026-10-01).- uint64_t vramBudget=0,vramUsage=0;ctx.videoMemoryInfo(vramBudget,vramUsage);+ uint64_t vramBudget=0,vramUsage=0;ctx.videoMemoryInfo(vramBudget,vramUsage);watchVram(vramUsage,vramBudget);veyra::log::info("frame-rate",std::format("revision={} gpuCompletedFps={:.2f} completedReal={} capture60To30={} rateSkipped={} presentSubmitFps={:.2f} windowMs=1000 vramMiB={} budgetMiB={} (not scanout FPS)",options.settings.revision,rates.fps,rates.processedCompleted,rates.captureHalfRate,rates.captureRateSkipped,rates.submissionFps.value_or(0),vramUsage>>20,vramBudget>>20));veyra::log::info("capture-timing",std::format("revision={} received={} processed={} dropped={} callbackFps={:.2f} readAgeMs={:.3f} callbackToPresentReturnP95Ms={:.3f} processCpuP95Ms={:.3f} gpuReadyP95Ms={:.3f} schedulingWaitP95Ms={:.3f} presentCpuP95Ms={:.3f} gpuColorP95Ms={:.3f} gpuSrP95Ms={:.3f} gpuFlowP95Ms={:.3f} gpuNrP95Ms={:.3f} gpuResidualP95Ms={:.3f} gpuFgBatchP95Ms={:.3f} gpuBlitP95Ms={:.3f} slotWaits={} slotWaitMs={:.3f} commandSubmits={} displaySubmits={} expiredGenerated={} nr={} nvof={} generated={} historyResets={} presentationDrains={} presentationCompletedReal={} presentationSkippedGenerated={} presentationCancelledJobs={} singleGpuOwner=1 batchCapacity=2 (not HDMI-to-display latency)",options.settings.revision,captureStats.received,sourceFrames-statsSourceBase,captureStats.dropped,captureStats.callbackFps,captureStats.readAgeMs,ageP95,processTimes.p95(),liveScheduler?completed.readyP95:gpuReadyTimes.p95(),waitP95,presentP95,gpuP95(diagnostics::GpuStage::Color),gpuP95(diagnostics::GpuStage::Sr),gpuP95(diagnostics::GpuStage::Flow),gpuP95(diagnostics::GpuStage::Nr),gpuP95(diagnostics::GpuStage::Residual),gpuP95(diagnostics::GpuStage::FgBatch),gpuP95(diagnostics::GpuStage::Blit),slotWaitCount,slotWaitMilliseconds,commandSubmits,submitted,expired,graphStats.nrEvaluateCount,graphStats.nvofExecuteCount,graphStats.fgGeneratedFrames,historyResets.load(),presentationDrains.load(),presentationCompletedReal.load(),presentationSkippedGenerated.load(),presentationCancelledJobs.load()));nextTimingLog=Clock::now()+std::chrono::seconds(1);diff --git a/src/engine/VideoPresenter.cpp b/src/engine/VideoPresenter.cppindex 2ca01abc..25c90339 100644--- a/src/engine/VideoPresenter.cpp+++ b/src/engine/VideoPresenter.cpp@@ -315,7 +315,14 @@ PresentationSettings VideoPresenter::configurePresentation(gfx::D3D12DeviceContereturn effective;}providerOwnedPresentation_=false;- if(!requested.enabled){const bool restored=sink_.configurePacing(false,vsync,tearing);status=(restored?L"低延迟队列已关闭 · ":L"低延迟队列恢复失败 · ")+sync;if(effective.outputRate==OutputRateMode::Custom)status+=std::format(L" · 输出上限 {:.3f} FPS",effective.customFps);status+=capNotice;return effective;}+ if(!requested.enabled){+ // Vertical sync with the default 3-frame queue lets presents pile up behind the+ // refresh: on a 60 Hz panel that is up to ~50 ms, and a capture user measured+ // "twice 1.4.4's latency" with 2.0 on vsync against 1.4.4 on tearing (field logs+ // 2026-10-01). Under vsync the queue stays one deep even without 低延迟队列.+ const bool shallow=vsync&&sink_.configurePacing(true,vsync,tearing);+ const bool restored=shallow||sink_.configurePacing(false,vsync,tearing);+ status=(shallow?L"垂直同步 · 队列深度 1 · ":restored?L"低延迟队列已关闭 · ":L"低延迟队列恢复失败 · ")+sync;if(effective.outputRate==OutputRateMode::Custom)status+=std::format(L" · 输出上限 {:.3f} FPS",effective.customFps);status+=capNotice;return effective;}if(!sink_.configurePacing(true,vsync,tearing)){effective.enabled=false;status=L"显示队列控制不可用 · "+sync;return effective;}// Low latency = queue depth 1, plus Reflex when frame generation is off// (generated outputs would need separately validated out-of-band markers).diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex 7479b184..e02c9aa6 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -122,6 +122,7 @@ struct QmlPlayerBridge::Impl {bool haveSnapshot = false;bool openingSource = false;uint64_t openingSessionId = 0;+ uint64_t vramNoticeSession = 0; // the session the video-memory warning was shown for// The chain the UI edits, kept in step with the facade's pending settings.engine::EffectChain chain;@@ -791,6 +792,13 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesystconst auto wasTransport = impl_->snapshot.transport;const uint64_t wasSession = impl_->snapshot.sessionId;if(impl_->poll()){emit settingsChanged();emit chainChanged();}+ if (impl_->snapshot.vramRunawayMiB && impl_->vramNoticeSession != impl_->snapshot.sessionId) {+ impl_->vramNoticeSession = impl_->snapshot.sessionId;+ emit notice(tr("显存在设置没变的情况下涨了 %1 GB,继续下去会越来越卡。常见原因是游戏加加、小飞机(RTSS)、"+ "显卡叠加层/即时重放或录屏软件在全屏时注入了本程序:请关掉它们的游戏内显示后重开本软件。"+ "当时加载的第三方模块已写进日志(vram-watch)")+ .arg(impl_->snapshot.vramRunawayMiB / 1024.0, 0, 'f', 1), true);+ }tickSubtitles();tickImageBatch();tickCapture();@@ -873,7 +881,8 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesyststruct Seen { const wchar_t* module; const char* product; };static const Seen others[] = {{L"graphics-hook64.dll", "OBS game capture"}, {L"DiscordHook64.dll", "Discord overlay"},- {L"gameoverlayrenderer64.dll", "Steam overlay"},+ {L"gameoverlayrenderer64.dll", "Steam overlay"}, {L"nvspcap64.dll", "NVIDIA overlay / instant replay"},+ {L"ow-graphics-hook64.dll", "Overwolf overlay"},};static bool loggedOthers[std::size(others)]{};for (size_t k = 0; k < std::size(others); ++k)@@ -899,7 +908,9 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesyst.arg(QString::fromUtf8(hook->product)), false);}}- if (GetTickCount64() - started > 120000) hookTimer->stop();+ // Overlays inject when they decide the window is a game, e.g. on entering fullscreen+ // long after start; after the first two minutes look every 10 s instead of every 2 s.+ if (GetTickCount64() - started > 120000 && hookTimer->interval() < 10000) hookTimer->setInterval(10000);});hookTimer->start(2000);// A saved FSR 4 ML choice on a non-AMD GPU crashed at the first open; move it on.