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++
feat: make the output cap decide how many frames are generated, drop the inert pacing modes
Veyra Goal Agent55fa13aa3d7c
diff --git a/apps/veyra/SettingsWindow.cpp b/apps/veyra/SettingsWindow.cppindex 6a294953..a2eb3a87 100644--- a/apps/veyra/SettingsWindow.cpp+++ b/apps/veyra/SettingsWindow.cpp@@ -1491,14 +1491,15 @@ case WM_CREATE:{window=h;font=makeFont(h);items.clear();displayedBackendWarning.}}setText(item(1103),L"光流与补帧");- add(L"BUTTON",L"帧节奏 / 显示同步",240,BS_AUTOCHECKBOX|WS_TABSTOP,1,12,550,-1,32);- combo(241,1,590,{L"低排队",L"均匀呈现 · 前端同步",L"NVIDIA Reflex · 实验"});- combo(242,1,634,{L"显示:允许撕裂",L"显示:垂直同步",L"显示:自动"});- combo(243,1,678,{L"输出限帧:关闭",L"输出限帧:跟随显示器",L"输出限帧:自定义"});- add(L"EDIT",L"60",244,ES_AUTOHSCROLL|ES_RIGHT|WS_TABSTOP,1,182,722,90,28);- add(L"STATIC",L"FPS",1147,0,1,276,722,40,28);- add(L"STATIC",L"",1150,SS_NOPREFIX,1,12,764,-1,90);- {const auto p=controller->snapshot().presentation;check(240,p.enabled?BST_CHECKED:BST_UNCHECKED);send(241,CB_SETCURSEL,unsigned(p.mode));send(242,CB_SETCURSEL,unsigned(p.display));send(243,CB_SETCURSEL,unsigned(p.outputRate));putText(244,std::format(L"{:.3f}",p.customFps).c_str());EnableWindow(item(241),p.enabled);EnableWindow(item(242),p.enabled);EnableWindow(item(243),true);EnableWindow(item(244),p.outputRate==engine::OutputRateMode::Custom);}+ // Three independent controls. The old mode selector (low queue / even /+ // Reflex) was removed: all three measured identical (2026-09-22).+ add(L"BUTTON",L"低延迟队列(减少排队;本机无法验收)",240,BS_AUTOCHECKBOX|WS_TABSTOP,1,12,550,-1,32);+ combo(242,1,590,{L"显示同步:允许撕裂",L"显示同步:垂直同步",L"显示同步:自动"});+ combo(243,1,634,{L"输出上限:关闭",L"输出上限:跟随显示器",L"输出上限:自定义"});+ add(L"EDIT",L"60",244,ES_AUTOHSCROLL|ES_RIGHT|WS_TABSTOP,1,182,678,90,28);+ add(L"STATIC",L"FPS",1147,0,1,276,678,40,28);+ add(L"STATIC",L"",1150,SS_NOPREFIX,1,12,720,-1,134);+ {const auto p=controller->snapshot().presentation;check(240,p.enabled?BST_CHECKED:BST_UNCHECKED);send(242,CB_SETCURSEL,unsigned(p.display));send(243,CB_SETCURSEL,unsigned(p.outputRate));putText(244,std::format(L"{:.3f}",p.customFps).c_str());EnableWindow(item(241),p.enabled);EnableWindow(item(242),p.enabled);EnableWindow(item(243),true);EnableWindow(item(244),p.outputRate==engine::OutputRateMode::Custom);}button(L"Smooth Motion · 开启方法 ▾",221,1,12,358);ghost(item(221));SetPropW(item(221),L"veyra.tip",HANDLE(L"查看 NVIDIA App 的 AI 插帧开启方法。这里只提供说明,不修改驱动,也不限制叠加补帧。"));@@ -1601,12 +1602,12 @@ __declspec(noinline) LRESULT settingsCommand(HWND h,UINT msg,WPARAM wp,LPARAM lp}return 0;}- if(msg==WM_COMMAND&&!populating&&((LOWORD(wp)==240&&HIWORD(wp)==BN_CLICKED)||((LOWORD(wp)==241||LOWORD(wp)==242||LOWORD(wp)==243)&&HIWORD(wp)==CBN_SELCHANGE)|| (LOWORD(wp)==244&&HIWORD(wp)==EN_KILLFOCUS))){+ if(msg==WM_COMMAND&&!populating&&((LOWORD(wp)==240&&HIWORD(wp)==BN_CLICKED)||((LOWORD(wp)==242||LOWORD(wp)==243)&&HIWORD(wp)==CBN_SELCHANGE)|| (LOWORD(wp)==244&&HIWORD(wp)==EN_KILLFOCUS))){auto setting=controller->snapshot().presentation;setting.enabled=checked(240)==BST_CHECKED;- setting.mode=engine::PacingMode(send(241,CB_GETCURSEL));setting.display=engine::DisplaySync(send(242,CB_GETCURSEL));+ setting.display=engine::DisplaySync(send(242,CB_GETCURSEL));setting.outputRate=static_cast<engine::OutputRateMode>(send(243,CB_GETCURSEL));if(setting.outputRate==engine::OutputRateMode::Custom){wchar_t fps[64]{};GetWindowTextW(item(244),fps,64);wchar_t* end=nullptr;const auto value=wcstod(fps,&end);if(end==fps||*end||!std::isfinite(value)||value<1||value>1000){message(L"自定义限帧须为 1–1000 FPS");return 0;}setting.customFps=value;}- if(setting.valid()){controller->requestPresentation(setting);EnableWindow(item(241),setting.enabled);EnableWindow(item(242),setting.enabled);EnableWindow(item(244),setting.outputRate==engine::OutputRateMode::Custom);SendMessageW(GetParent(window),WM_APP+46,0,0);}return 0;+ if(setting.valid()){controller->requestPresentation(setting);EnableWindow(item(244),setting.outputRate==engine::OutputRateMode::Custom);SendMessageW(GetParent(window),WM_APP+46,0,0);}return 0;}if(msg==WM_COMMAND&&LOWORD(wp)==221&&HIWORD(wp)==BN_CLICKED){smoothMotionHelpExpanded=!smoothMotionHelpExpanded;putText(221,smoothMotionHelpExpanded?L"Smooth Motion · 收起说明 ▴":L"Smooth Motion · 开启方法 ▾");arrange();return 0;}if(msg==WM_COMMAND&&!populating&&(LOWORD(wp)==220||LOWORD(wp)==223)&&HIWORD(wp)==BN_CLICKED){liveField(LOWORD(wp));return 0;}@@ -1810,7 +1811,13 @@ case WM_COMMAND:{const int id=LOWORD(wp);if(!populating&&((id>=202&&id<=205||id=__declspec(noinline) LRESULT settingsTimer(HWND h,UINT msg,WPARAM wp,LPARAM lp){switch(msg){-case WM_TIMER:{auto s=controller->snapshot();putText(1150,s.presentationStatus.c_str());syncProtection(enhancementEnabled?s.desired.protection:configuredSettings.protection);if(enhancementEnabled&&!dirty&&displayedSettings!=s.desired)populate(s.desired);syncColorControls();check(200,enhancementEnabled&&s.desired.nr?BST_CHECKED:BST_UNCHECKED);check(201,enhancementEnabled&&s.desired.sr?BST_CHECKED:BST_UNCHECKED);std::wostringstream o;if(!s.running&&!s.frames&&s.transport!=engine::TransportState::Opening)o<<L"未打开媒体 · 设置待启用\n";else{+case WM_TIMER:{auto s=controller->snapshot();putText(1150,s.presentationStatus.c_str());+ // XeSS/FSR owns Present, so grey out what cannot reach its frames. The+ // flag comes from the engine, never from parsing the status text.+ {const bool owned=s.presentationProviderOwned;+ for(int id:{240,243})EnableWindow(item(id),!owned);+ EnableWindow(item(244),!owned&&s.presentation.outputRate==engine::OutputRateMode::Custom);}+syncProtection(enhancementEnabled?s.desired.protection:configuredSettings.protection);if(enhancementEnabled&&!dirty&&displayedSettings!=s.desired)populate(s.desired);syncColorControls();check(200,enhancementEnabled&&s.desired.nr?BST_CHECKED:BST_UNCHECKED);check(201,enhancementEnabled&&s.desired.sr?BST_CHECKED:BST_UNCHECKED);std::wostringstream o;if(!s.running&&!s.frames&&s.transport!=engine::TransportState::Opening)o<<L"未打开媒体 · 设置待启用\n";else{o<<L"期望版本 "<<s.desired.revision<<L" / 已应用 "<<s.applied.revision<<(s.applying?L" · 应用中":L"");const wchar_t* backend=s.applied.frameGenerationBackend==engine::FrameGenerationBackend::XeSS?L"XeSS":s.applied.frameGenerationBackend==engine::FrameGenerationBackend::Fsr?L"AMD FSR":L"DLSS";o<<L"\n"<<backend<<L" · "<<(s.applied.multiplier<=1?L"补帧关闭":s.fgActive?L"补帧运行":L"等待有效补帧");diff --git a/apps/veyra/ui/AppShell.cpp b/apps/veyra/ui/AppShell.cppindex 60930a02..facde914 100644--- a/apps/veyra/ui/AppShell.cpp+++ b/apps/veyra/ui/AppShell.cpp@@ -73,7 +73,7 @@ veyra::engine::EnhancementSettings jobExpected;uint64_t masterPendingRevision=0,std::wstring smokeView;bool smokeViewApplied=false;// Smoke-only presentation override so frame pacing can be A/B tested from the// command line (--smoke-pacing off|lowqueue|even|reflex [--smoke-pacing-vsync]).-std::wstring smokePacing;bool smokePacingVsync=false,smokePacingApplied=false;+std::wstring smokePacing,smokeOutputCap;bool smokePacingVsync=false,smokePacingApplied=false;std::wstring smokeDualOutput;bool smokeEmpty=false;DWORD modeGdiStart=0,modeHandlesStart=0;SIZE_T modePrivateStart=0;bool smokeDual=false,smokeDualPause=false,smokeMaster=false,smokeMasterReject=false,smokeAudio=false,smokeJob=false,smokeJobCancel=false,smokeJobExit=false,smokeColor=false;int dualStep=0,masterStep=0,audioStep=0,jobStep=0,colorStep=0;double pausedPosition=-1,jobPosition=0;uint64_t pausedFrames=0;ULONGLONG jobPauseTick=0;HANDLE workerMapping=nullptr;// Test/acceptance convenience: start in professional mode with the colour page@@ -861,11 +861,14 @@ setText(GetDlgItem(hwnd,EmptyTitle),s.failed?L"播放已停止":L"开始观看")if(dragging&&GetCapture()!=seekBar){dragging=false;seekPreview.released=true;}seekPreview.tick(&s);if(!dragging&&s.duration>0){int position=int((s.seekPresented<s.seekRequested&&!s.failed?s.seekTarget:s.position)/s.duration*10000);if(SendMessageW(seekBar,TBM_GETPOS,0,0)!=position)SendMessageW(seekBar,TBM_SETPOS,TRUE,position);}-if(!smokePacingApplied&&!smokePacing.empty()&&s.frames>0){smokePacingApplied=true;+if(!smokePacingApplied&&(!smokePacing.empty()||!smokeOutputCap.empty())&&s.frames>0){smokePacingApplied=true;veyra::engine::PresentationSettings p{};- p.enabled=smokePacing!=L"off";- p.mode=smokePacing==L"even"?veyra::engine::PacingMode::Even:smokePacing==L"reflex"?veyra::engine::PacingMode::Reflex:veyra::engine::PacingMode::LowQueue;+ p.enabled=smokePacing==L"lowlatency";p.display=smokePacingVsync?veyra::engine::DisplaySync::Vsync:veyra::engine::DisplaySync::Tearing;+ if(!smokeOutputCap.empty()){+ if(smokeOutputCap==L"display")p.outputRate=veyra::engine::OutputRateMode::FollowDisplay;+ else{p.outputRate=veyra::engine::OutputRateMode::Custom;p.customFps=_wtof(smokeOutputCap.c_str());}+ }engine.requestPresentation(p);}if(!smokeViewApplied&&!smokeView.empty()&&(s.frames>0||smokeEmpty)){smokeViewApplied=true;if(smokeView==L"small")SetWindowPos(hwnd,nullptr,0,0,800,600,SWP_NOMOVE|SWP_NOZORDER);if(smokeView!=L"daily"&&smokeView!=L"empty"&&uiState.mode==veyra::ui::Mode::Daily)switchMode();if(smokeView==L"export")selectInspector(3);if(smokeView==L"diagnostics"){showDiagnostics=true;layout();}if(smokeView==L"fullscreen")toggleFullscreen();}if(smokeDualPause&&pausedPosition<0&&s.frames>20){engine.pause(true);pausedPosition=s.position;pausedFrames=s.frames;}@@ -1278,7 +1281,7 @@ SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);INITCOCoInitializeEx(nullptr,COINIT_APARTMENTTHREADED);initialOptions=veyra::engine::PlayerOptions::from(veyra::ui::defaultSettings());-int argc=0;auto argv=CommandLineToArgvW(GetCommandLineW(),&argc);for(int i=1;i<argc;++i){const std::wstring arg=argv[i];if(arg==L"--export-worker"&&i+1<argc)workerMapping=reinterpret_cast<HANDLE>(_wcstoui64(argv[++i],nullptr,10));else if(arg==L"--smoke-view"&&i+1<argc)smokeView=argv[++i];else if(arg==L"--smoke-pacing"&&i+1<argc)smokePacing=argv[++i];else if(arg==L"--smoke-pacing-vsync")smokePacingVsync=true;else if(arg==L"--smoke-fg-only")smokeFgOnly=true;else if(arg==L"--smoke-transport")smokeTransport=true;else if(arg==L"--smoke-repair-ui")smokeRepair=true;else if(arg==L"--smoke-repair-ui-reject")smokeRepair=smokeRepairReject=true;else if(arg==L"--smoke-hover")smokeZoom=smokeHover=true;else if(arg==L"--smoke-protection")smokeProtection=true;else if(arg==L"--smoke-zoom")smokeZoom=true;else if(arg==L"--smoke-empty")smokeEmpty=true;else if(arg==L"--smoke-dual")smokeDual=true;else if(arg==L"--smoke-dual-pause"){smokeDual=smokeDualPause=true;}else if(arg==L"--smoke-master-reject")smokeMaster=smokeMasterReject=true;else if(arg==L"--smoke-master")smokeMaster=true;else if(arg==L"--smoke-audio")smokeAudio=true;else if(arg==L"--smoke-job-cancel")smokeJobCancel=true;else if(arg==L"--smoke-job-exit")smokeJobExit=true;else if(arg==L"--smoke-job")smokeJob=true;else if(arg==L"--smoke-dual-export"&&i+1<argc)smokeDualOutput=argv[++i];else if(arg==L"--smoke-seconds"&&i+1<argc)smokeSeconds=std::clamp(_wtoi(argv[++i]),1,240);else if(arg==L"--export-out"&&i+1<argc)exportOutput=argv[++i];else if(arg==L"--max-frames"&&i+1<argc)exportFrames=std::max(1,_wtoi(argv[++i]));else if(arg==L"--cancel-after-ms"&&i+1<argc)cancelAfterMs=std::clamp(_wtoi(argv[++i]),1,240000);else if(arg==L"--hevc")exportHevc=true;else if(arg==L"--bitrate-mbps"&&i+1<argc)initialOptions.settings.exportBitrateMbps=uint32_t(std::clamp(_wtoi(argv[++i]),0,300));else if(arg==L"--subtitle-primary"&&i+1<argc)subtitleRequestPrimary=std::clamp(_wtoi(argv[++i]),-1,64);else if(arg==L"--subtitle-secondary"&&i+1<argc)subtitleRequestSecondary=std::clamp(_wtoi(argv[++i]),-1,64);else if(arg==L"--subtitle-offset-ms"&&i+1<argc)subtitleRequestOffsetMs=std::clamp(_wtoi(argv[++i]),-30000,30000);else if(arg==L"--subtitle-font-size"&&i+1<argc)subtitlePixels=std::clamp(_wtoi(argv[++i]),16,56);else if(arg==L"--subtitle-no-outline")uiState.subtitleOutline=false;else if(arg==L"--subtitle-background")uiState.subtitleBackground=true;else if(arg==L"--subtitle-auto-align")subtitleRequestAutoAlign=true;else if(arg==L"--smoke-rollback-flow"){smokeRollback=true;smokeRollbackFlow=true;}else if(arg==L"--smoke-rollback")smokeRollback=true;else if(arg==L"--smoke-ui")smokeUi=true;else if(arg==L"--video-hdr")initialOptions.settings.videoHdr.enabled=true;else if(arg==L"--no-fg")initialOptions.fg=false;else if(arg==L"--smoke-settings")smokeSettings=true;else if(arg==L"--smoke-color")smokeColor=true;else if(arg==L"--smoke-screenshot")smokeScreenshot=true;else if(arg==L"--smoke-controls")smokeControls=true;else if(arg==L"--smoke-save"&&i+1<argc)smokeSave=argv[++i];else if(arg==L"--native")initialOptions.realtime=false;else if(arg==L"--realtime")initialOptions.realtime=true;else if(arg==L"--fg")initialOptions.fg=true;else if(arg==L"--fg-multiplier"&&i+1<argc){initialOptions.fgMultiplier=std::clamp(_wtoi(argv[++i]),2,6);initialOptions.fg=true;}else if(arg==L"--capture-audio"&&i+1<argc)initialOptions.settings.captureAudio=static_cast<veyra::engine::CaptureAudioIngress>(std::clamp(_wtoi(argv[++i]),0,2));else if(arg==L"--flow-amd")initialOptions.settings.opticalFlowBackend=veyra::engine::OpticalFlowBackend::AmdFidelityFx;else if(arg==L"--flow-gpudis")initialOptions.settings.opticalFlowBackend=veyra::engine::OpticalFlowBackend::GpuDis;else if(arg==L"--video-sr"&&i+1<argc){initialOptions.settings.videoSrQuality=std::clamp(_wtoi(argv[++i]),1,5);initialOptions.sr=true;}else if(arg==L"--nr-ampere")initialOptions.settings.nrRuntime=veyra::engine::NrRuntime::Ampere;else if(arg==L"--nr-community")initialOptions.settings.nrRuntime=veyra::engine::NrRuntime::Community;else if(arg==L"--nr-original")initialOptions.settings.nrRuntime=veyra::engine::NrRuntime::Original;else if(arg==L"--sr")initialOptions.sr=true;else if(arg==L"--no-nr")initialOptions.nr=false;else if(arg==L"--nr")initialOptions.nr=true;else if(arg==L"--no-sr")initialOptions.sr=false;else autoInput=arg;}LocalFree(argv);+int argc=0;auto argv=CommandLineToArgvW(GetCommandLineW(),&argc);for(int i=1;i<argc;++i){const std::wstring arg=argv[i];if(arg==L"--export-worker"&&i+1<argc)workerMapping=reinterpret_cast<HANDLE>(_wcstoui64(argv[++i],nullptr,10));else if(arg==L"--smoke-view"&&i+1<argc)smokeView=argv[++i];else if(arg==L"--smoke-pacing"&&i+1<argc)smokePacing=argv[++i];else if(arg==L"--smoke-output-cap"&&i+1<argc)smokeOutputCap=argv[++i];else if(arg==L"--smoke-pacing-vsync")smokePacingVsync=true;else if(arg==L"--smoke-fg-only")smokeFgOnly=true;else if(arg==L"--smoke-transport")smokeTransport=true;else if(arg==L"--smoke-repair-ui")smokeRepair=true;else if(arg==L"--smoke-repair-ui-reject")smokeRepair=smokeRepairReject=true;else if(arg==L"--smoke-hover")smokeZoom=smokeHover=true;else if(arg==L"--smoke-protection")smokeProtection=true;else if(arg==L"--smoke-zoom")smokeZoom=true;else if(arg==L"--smoke-empty")smokeEmpty=true;else if(arg==L"--smoke-dual")smokeDual=true;else if(arg==L"--smoke-dual-pause"){smokeDual=smokeDualPause=true;}else if(arg==L"--smoke-master-reject")smokeMaster=smokeMasterReject=true;else if(arg==L"--smoke-master")smokeMaster=true;else if(arg==L"--smoke-audio")smokeAudio=true;else if(arg==L"--smoke-job-cancel")smokeJobCancel=true;else if(arg==L"--smoke-job-exit")smokeJobExit=true;else if(arg==L"--smoke-job")smokeJob=true;else if(arg==L"--smoke-dual-export"&&i+1<argc)smokeDualOutput=argv[++i];else if(arg==L"--smoke-seconds"&&i+1<argc)smokeSeconds=std::clamp(_wtoi(argv[++i]),1,240);else if(arg==L"--export-out"&&i+1<argc)exportOutput=argv[++i];else if(arg==L"--max-frames"&&i+1<argc)exportFrames=std::max(1,_wtoi(argv[++i]));else if(arg==L"--cancel-after-ms"&&i+1<argc)cancelAfterMs=std::clamp(_wtoi(argv[++i]),1,240000);else if(arg==L"--hevc")exportHevc=true;else if(arg==L"--bitrate-mbps"&&i+1<argc)initialOptions.settings.exportBitrateMbps=uint32_t(std::clamp(_wtoi(argv[++i]),0,300));else if(arg==L"--subtitle-primary"&&i+1<argc)subtitleRequestPrimary=std::clamp(_wtoi(argv[++i]),-1,64);else if(arg==L"--subtitle-secondary"&&i+1<argc)subtitleRequestSecondary=std::clamp(_wtoi(argv[++i]),-1,64);else if(arg==L"--subtitle-offset-ms"&&i+1<argc)subtitleRequestOffsetMs=std::clamp(_wtoi(argv[++i]),-30000,30000);else if(arg==L"--subtitle-font-size"&&i+1<argc)subtitlePixels=std::clamp(_wtoi(argv[++i]),16,56);else if(arg==L"--subtitle-no-outline")uiState.subtitleOutline=false;else if(arg==L"--subtitle-background")uiState.subtitleBackground=true;else if(arg==L"--subtitle-auto-align")subtitleRequestAutoAlign=true;else if(arg==L"--smoke-rollback-flow"){smokeRollback=true;smokeRollbackFlow=true;}else if(arg==L"--smoke-rollback")smokeRollback=true;else if(arg==L"--smoke-ui")smokeUi=true;else if(arg==L"--video-hdr")initialOptions.settings.videoHdr.enabled=true;else if(arg==L"--no-fg")initialOptions.fg=false;else if(arg==L"--smoke-settings")smokeSettings=true;else if(arg==L"--smoke-color")smokeColor=true;else if(arg==L"--smoke-screenshot")smokeScreenshot=true;else if(arg==L"--smoke-controls")smokeControls=true;else if(arg==L"--smoke-save"&&i+1<argc)smokeSave=argv[++i];else if(arg==L"--native")initialOptions.realtime=false;else if(arg==L"--realtime")initialOptions.realtime=true;else if(arg==L"--fg")initialOptions.fg=true;else if(arg==L"--fg-multiplier"&&i+1<argc){initialOptions.fgMultiplier=std::clamp(_wtoi(argv[++i]),2,6);initialOptions.fg=true;}else if(arg==L"--capture-audio"&&i+1<argc)initialOptions.settings.captureAudio=static_cast<veyra::engine::CaptureAudioIngress>(std::clamp(_wtoi(argv[++i]),0,2));else if(arg==L"--flow-amd")initialOptions.settings.opticalFlowBackend=veyra::engine::OpticalFlowBackend::AmdFidelityFx;else if(arg==L"--flow-gpudis")initialOptions.settings.opticalFlowBackend=veyra::engine::OpticalFlowBackend::GpuDis;else if(arg==L"--video-sr"&&i+1<argc){initialOptions.settings.videoSrQuality=std::clamp(_wtoi(argv[++i]),1,5);initialOptions.sr=true;}else if(arg==L"--nr-ampere")initialOptions.settings.nrRuntime=veyra::engine::NrRuntime::Ampere;else if(arg==L"--nr-community")initialOptions.settings.nrRuntime=veyra::engine::NrRuntime::Community;else if(arg==L"--nr-original")initialOptions.settings.nrRuntime=veyra::engine::NrRuntime::Original;else if(arg==L"--sr")initialOptions.sr=true;else if(arg==L"--no-nr")initialOptions.nr=false;else if(arg==L"--nr")initialOptions.nr=true;else if(arg==L"--no-sr")initialOptions.sr=false;else autoInput=arg;}LocalFree(argv);// Diagnostic: force the colour grade on with a fixed exposure (EV). The grade is// fused into the ingest dispatch, so this flag is how the graded cost is measured// against the grade-off baseline on the same clip.@@ -1298,7 +1301,7 @@ int argc=0;auto argv=CommandLineToArgvW(GetCommandLineW(),&argc);for(int i=1;i<a// capture panel checkbox and persists captureFlipVertical with presets.{int flipArgc=0;auto flipArgv=CommandLineToArgvW(GetCommandLineW(),&flipArgc);for(int i=1;i<flipArgc;++i){if(!_wcsicmp(flipArgv[i],L"--capture-flip"))initialOptions.settings.captureFlipVertical=true;else if(!wcsncmp(flipArgv[i],L"--capture-buffer=",17)){const wchar_t* value=flipArgv[i]+17;if(!_wcsicmp(value,L"auto"))initialOptions.settings.captureBuffer=veyra::source::CaptureBufferMode::Auto;else if(!_wcsicmp(value,L"minimum"))initialOptions.settings.captureBuffer=veyra::source::CaptureBufferMode::Minimum;else if(!_wcsicmp(value,L"driver"))initialOptions.settings.captureBuffer=veyra::source::CaptureBufferMode::DriverDefault;}else if(!_wcsicmp(flipArgv[i],L"--capture-cpu-unpack"))initialOptions.captureCpuUnpack=true;}LocalFree(flipArgv);}int positionalArgc=0;auto positionalArgv=CommandLineToArgvW(GetCommandLineW(),&positionalArgc);std::wstring positional;- const wchar_t* valueFlags[]={L"--export-worker",L"--smoke-view",L"--smoke-pacing",L"--smoke-dual-export",L"--smoke-seconds",L"--export-out",L"--max-frames",L"--cancel-after-ms",L"--smoke-save",L"--fg-multiplier",L"--capture-audio",L"--video-sr",L"--bitrate-mbps",L"--subtitle-primary",L"--subtitle-secondary",L"--subtitle-offset-ms",L"--subtitle-font-size"};+ const wchar_t* valueFlags[]={L"--export-worker",L"--smoke-view",L"--smoke-pacing",L"--smoke-output-cap",L"--smoke-dual-export",L"--smoke-seconds",L"--export-out",L"--max-frames",L"--cancel-after-ms",L"--smoke-save",L"--fg-multiplier",L"--capture-audio",L"--video-sr",L"--bitrate-mbps",L"--subtitle-primary",L"--subtitle-secondary",L"--subtitle-offset-ms",L"--subtitle-font-size"};for(int i=1;i<positionalArgc;++i){const std::wstring a=positionalArgv[i];bool takesValue=false;for(const wchar_t* flag:valueFlags)if(a==flag){takesValue=true;break;}if(takesValue){++i;continue;}diff --git a/docs/UNIFIED_REPAIR_EXECUTION_2026-09-22.md b/docs/UNIFIED_REPAIR_EXECUTION_2026-09-22.mdindex bf83c706..15aec10f 100644--- a/docs/UNIFIED_REPAIR_EXECUTION_2026-09-22.md+++ b/docs/UNIFIED_REPAIR_EXECUTION_2026-09-22.md@@ -584,6 +584,72 @@ display-stats] refreshHz presentCalls dxgiPresentCount refreshes presentRefreshD**新增一条硬规矩:任何新指标在用于判断之前,必须先做一次"物理不可能"检查**——本例中"显示帧数 > 提交帧数"和"100 Hz 面板显示 270 帧/s"都应当在第一次出现时就拦下。+## 3k. 帧同步重新设计(标签 `checkpoint/pre-pacing-redesign-20260922` 起)++### 为什么重做++用户反馈"帧同步没啥用"。新增冒烟开关后同时段交替各 2 轮实测(`b13/pacing-ab/`),+三个模式在吞吐、逐秒 sd、媒体时钟偏差上**无任何可测差异**,逐秒 sd 开启后反而略差+(DLSS 4X:关 3.30–3.55,开 3.44–4.79)。设置确实生效(`effective=true/2/0`),+是设计本身没做事:++- **均匀呈现是空操作**:文件播放呈现已准到媒体时间 0.8 ms 内,自然产出间距+ (6X 组内 2.72 ms)本就接近目标(2.78 ms),再加下限不改变任何东西。+- **Reflex 一开补帧就退回低排队**,低排队只把 DXGI 队列深度 3 改 1。+- **XeSS/FSR 下整个功能被禁用**,只剩 vsync 一位透传。+- **输出限帧只在呈现时丢弃已算好的帧**,GPU 白算:原生 6X 在 100 Hz 屏上每秒生成+ 约 5670 帧(30 s)、提交约 262/s,面板最多显示 100。++### 改动++1. **输出上限接回补帧生成量**(核心)。按 `ceil(上限/源帧率)` 推出所需倍率,+ `clamp(needed, 2, 用户倍率)`,只降不升。100 Hz 配 60 fps 源 → 2X。+ 降档通过已有的 `snapshot_.previewFgMultiplier` 反映到界面。+2. **删除模式选择器**。`PacingMode` 枚举与 `mode` 字段保留但不再参与任何判断+ (不动已保存设置的字段布局);`enabled` 语义收窄为"低延迟队列"。+3. **限速器改绝对时间网格**。原来用"上次实际提交 + 间隔",抖动逐次累积成漂移。+4. **XeSS/FSR 置灰**。新增引擎侧 `presentationProviderOwned` 布尔量供 UI 判断,+ 不靠解析中文状态串。+5. **控件重排为三项独立**:低延迟队列(复选框 240)、显示同步(242)、+ 输出上限(243+244)。删除 241,三项不再互相置灰。状态串改三段式。+6. 冒烟开关改为 `--smoke-pacing off|lowlatency` 与新增 `--smoke-output-cap <fps|display>`;+ `ui-frame-pacing.py` 同步去掉对 241 的依赖。++### 实测:输出上限确实省 GPU(`b18/cap-ab/`,同时段交替各 2 轮)++| 工况 | 配置 | 生成帧 | 实际倍率 | 提交/s | GPU | 功耗 |+| --- | --- | ---: | ---: | ---: | ---: | ---: |+| 原生 NR DLSS 6X | 上限关 | 5636 / 5540 | 4.42 | 263.9 / 261.1 | 88.5% / 89.7% | 221.3 / 226.5 W |+| | 跟随显示器 | **1659 / 1650** | **2.0** | **100.0 / 100.0** | **62.7% / 62.4%** | **174.3 / 175.8 W** |+| 真超分 NR DLSS 6X | 上限关 | 2190 / 2126 | 2.24 | 139.5 / 136.3 | 92.0% / 92.2% | 237.5 / 238.5 W |+| | 跟随显示器 | 1621 / 1621 | 1.92 | 100.0 / 100.0 | 90.5% / 90.6% | 233.6 / 234.3 W |++- **原生 6X 收益大**:生成帧 −71%,GPU −27 个百分点,**功耗 −47 W(−21%)**。+- **真超分 6X 收益小**:功耗 −4 W(−2%)。该档瓶颈在超分与降噪,补帧占比小,+ 且本就只跑到 2.24 倍,降到 1.92 倍空间有限。**不要按原生的数字向用户承诺省电。**++### 限速器漂移(改绝对网格前后)++| 工况 | 改前提交/s | 改后提交/s |+| --- | ---: | ---: |+| 原生 6X + 跟随显示器 | 97.36 / 97.33 | **100.0 / 100.0** |+| 真超分 6X + 跟随显示器 | 95.66 / 95.66 | **100.0 / 100.0** |++改前低于 100 Hz 刷新率,意味着每秒有 2–4 次刷新拿不到新帧;改后四轮全部精确落在上限。++### 门槛++scheduler 127、修复合同 205、FG 呈现 D3D12 errors=0 且 0 ERROR、backend-switch 16 PASS 0 ERROR。+全部工况 `errorLines=0`。++### 未验收项(如实标注)++- **低延迟队列**对"提交到扫描输出"的排队延迟的影响,本机测不到,需 PresentMon+ 或外部测量设备。**不给该项任何结论。**+- **降档后的主观流畅度**:生成帧少了 71%,数值上提交率仍达 100/s,+ 但 6X 降到 2X 肉眼是否可接受必须由用户实看判定。+- 默认值未改:输出上限默认关闭,只在用户显式开启时生效。+## 4. 未做项的原因与下一步- **C3/C4/延迟 3b(采集三缓冲、锁外复制、直写 upload 堆)**:需要重构 mailbox 所有权diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex 243bc1df..605fc92e 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1,5 +1,20 @@# Veyra 工作记录+## 2026-09-22 帧同步重新设计:输出上限接回生成量,删掉测不出作用的模式选择器++存档 `checkpoint/pre-pacing-redesign-20260922`。实测确认三个模式无差异后重做:+**输出上限从"呈现时丢弃已算好的帧"改为"按 `ceil(上限/源帧率)` 决定补帧实际生成多少"**,+只降不升、下限 2X、不超过用户倍率。同时段交替各 2 轮实测(`b18/cap-ab/`):+原生 NR DLSS 6X 生成帧 5636→1659(−71%)、GPU 88.5%→62.7%、**功耗 221→174 W(−21%)**;+真超分 NR DLSS 6X 只降 4 W(−2%),因为该档瓶颈在超分降噪不在补帧——**不可按原生数字+对外承诺省电**。另修限速器漂移:原用"上次实际提交+间隔"导致抖动累积,100 FPS 上限实测+只跑到 95.7–97.4/s(低于刷新率),改绝对时间网格后四轮精确 100.0/s。+删除模式选择器(`PacingMode` 字段保留不参与判断,不动已保存设置布局),+控件重排为三项独立:低延迟队列/显示同步/输出上限;XeSS/FSR 下按新增的+`presentationProviderOwned` 置灰,不靠解析中文串。门槛全过。+**未验收**:低延迟队列的排队延迟本机测不到;6X 降 2X 的主观观感需用户实看。+详见 [执行记录 §3k](UNIFIED_REPAIR_EXECUTION_2026-09-22.md)。+## 2026-09-22 display-stats 指标错误,送显口径结论全部撤回;帧同步实测无效**指标 bug**:`sampleFrameStatistics` 把 `displayed` 取成 `PresentRefreshCount` 增量diff --git a/include/veyra/engine/EngineController.h b/include/veyra/engine/EngineController.hindex 19df1680..b52b7abe 100644--- a/include/veyra/engine/EngineController.h+++ b/include/veyra/engine/EngineController.h@@ -29,6 +29,8 @@ struct PlayerOptions { bool nr=false,sr=false,fg=false,realtime=true; uint32_t fenum class TransportState { Empty, Opening, Playing, Paused, Ended, Stopping, Failed };struct PlayerSnapshot {PresentationSettings presentation, presentationEffective;+ // XeSS/FSR owns Present; the UI greys the pacing controls when true.+ bool presentationProviderOwned=false;uint64_t presentationRevision=0;std::wstring presentationStatus;TransportState transport=TransportState::Empty;diff --git a/include/veyra/engine/PresentationSettings.h b/include/veyra/engine/PresentationSettings.hindex 2d767213..da83e6bb 100644--- a/include/veyra/engine/PresentationSettings.h+++ b/include/veyra/engine/PresentationSettings.h@@ -3,12 +3,19 @@#include <cstdint>#include <cmath>namespace veyra::engine {+// Retained only so saved settings keep their field layout. Nothing reads it+// any more: the three pacing "modes" measured identical on throughput,+// per-second spread and media-clock deviation (2026-09-22, b13/pacing-ab),+// because file playback already presents within 0.8 ms of media time.enum class PacingMode : unsigned { LowQueue, Even, Reflex };enum class DisplaySync : unsigned { Tearing, Vsync, Automatic };enum class OutputRateMode : unsigned { Off, FollowDisplay, Custom };struct PresentationSettings {+ // Low-latency queue: DXGI maximum frame latency 1 instead of 3, plus+ // Reflex when frame generation is off. Reduces submit-to-scanout queueing,+ // which cannot be measured on this machine - do not claim a figure for it.bool enabled=false;- PacingMode mode=PacingMode::LowQueue;+ PacingMode mode=PacingMode::LowQueue; // deprecated, see aboveDisplaySync display=DisplaySync::Tearing;OutputRateMode outputRate=OutputRateMode::Off;double customFps=60.0;@@ -18,9 +25,9 @@ struct PresentationSettings {// Media time remains the authority. Spacing adds at most one interval from// the current decision; stale generated frames are discarded by the caller.class PresentationCadence {- int64_t last_=0;+ int64_t last_=0,rateAnchor_=0;public:- void reset(){last_=0;}+ void reset(){last_=0;rateAnchor_=0;}int64_t due(int64_t mediaDeadline,int64_t outputInterval,unsigned catchUpPercent=10)const{if(!last_)return mediaDeadline;// Bounded catch-up absorbs wakeup/Present jitter without moving the@@ -31,7 +38,17 @@ public:return std::max(mediaDeadline,last_+outputInterval-recovery);}void submitted(int64_t now){last_=now;}- int64_t rateDue(int64_t now,int64_t interval)const{return !last_||interval<=0?now:last_+interval;}+ // The output cap runs on an absolute grid, not on "last actual present ++ // interval": chaining off the actual time let jitter accumulate, so a+ // 100 FPS cap measured 97.4 presents/s on a 100 Hz panel and a few+ // refreshes per second showed a repeat (2026-09-22, b17/cap-ab).+ int64_t rateDue(int64_t now,int64_t interval)const{return !rateAnchor_||interval<=0?now:rateAnchor_+interval;}+ void rateSubmitted(int64_t now,int64_t interval){+ // Re-anchor after a gap (seek, stall, reset); otherwise advance by whole+ // intervals so the long-run average stays exactly at the cap.+ if(interval<=0){rateAnchor_=0;return;}+ rateAnchor_=(!rateAnchor_||now-rateAnchor_>2*interval||now<rateAnchor_)?now:rateAnchor_+interval;+ }bool rateSkipsCandidate(int64_t now,int64_t mediaDeadline,int64_t candidateInterval,int64_t capInterval)const{// Discard only while the cap is still ahead of the next opportunity.// An expired media deadline must never prevent a ready frame recovering.diff --git a/include/veyra/engine/VideoPresenter.h b/include/veyra/engine/VideoPresenter.hindex 6742ac71..ad38b94e 100644--- a/include/veyra/engine/VideoPresenter.h+++ b/include/veyra/engine/VideoPresenter.h@@ -33,6 +33,10 @@ public:bool presentationReady(){return sink_.presentationReady();}uint64_t beginReflex(){return reflex_.begin();}void reflexFrame(uint64_t id){reflexFrame_=id;}+ // True while XeSS/FSR owns Present: the low-latency queue and the output+ // cap cannot reach provider-generated frames, so the UI greys them out.+ bool providerOwnedPresentation()const{return providerOwnedPresentation_;}+bool reflexActive()const{return reflex_.active();}bool reflexDisablePending()const{return reflex_.disablePending();}bool pacingActive()const{return sink_.pacingActive();}@@ -71,6 +75,7 @@ void recordGpuTimings(){gpuTimer_.recordCompleted();}private:gfx::ReflexSession reflex_;uint64_t reflexFrame_=0,generation_=0;+ bool providerOwnedPresentation_=false;Microsoft::WRL::ComPtr<ID3D12CommandQueue> presentationQueue_;Microsoft::WRL::ComPtr<ID3D12Fence> presentationFence_;HANDLE presentationEvent_=nullptr;diff --git a/scripts/acceptance/ui-frame-pacing.py b/scripts/acceptance/ui-frame-pacing.pyindex 041b785c..8bc2b023 100644--- a/scripts/acceptance/ui-frame-pacing.py+++ b/scripts/acceptance/ui-frame-pacing.py@@ -86,11 +86,12 @@ try:if stage=='configure':if send(control(240),0xf0):send(control(240),0xf5)assert send(control(240),0xf0)==0- assert not u.IsWindowEnabled(control(241)) and not u.IsWindowEnabled(control(242))+ # 240/242/243 are independent now: none of them gates the others.+ assert u.IsWindowEnabled(control(242)) and u.IsWindowEnabled(control(243))send(control(240),0xf5)- for ident,value in [(241,1),(242,2)]:+ for ident,value in [(242,1),(243,0)]:send(control(ident),0x14e,value);send(body,0x111,ident|(1<<16),control(ident))- wait(lambda:'effective=true/1/2' in (out/(stage+'.log')).read_text(encoding='utf-8',errors='replace'))+ wait(lambda:'effective=true/' in (out/(stage+'.log')).read_text(encoding='utf-8',errors='replace'))for width,height in [(1280,900),(800,600)]:u.SetWindowPos(main,None,20,20,width,height,0x14)time.sleep(.3)@@ -101,13 +102,13 @@ try:send(body,0x115,7) # SB_BOTTOMfor unused in range(20):send(body,0x115,1) # body handles line scrolltime.sleep(.3)- boxes=[rect(control(i)) for i in [240,241,242,1150]]+ boxes=[rect(control(i)) for i in [240,242,243,1150]]assert all(a[3]<=b[1] for a,b in zip(boxes,boxes[1:])), boxesviewport=rect(body)assert all(viewport[0]<=b[0] and b[2]<=viewport[2] for b in boxes), boxes# Compact drawers scroll; each control must be reachable,# not necessarily visible together in a 140-pixel viewport.- for ident in [240,241,242,1150]:+ for ident in [240,242,243,1150]:for unused in range(50):box=rect(control(ident));viewport=rect(body)if viewport[1]<=box[1] and box[3]<=viewport[3]:break@@ -128,12 +129,13 @@ try:results.append(dict(width=width,height=height,helpExpanded=expanded,boxes=boxes))if expanded:send(control(221),0xf5)else:- assert send(control(241),0x147)==1 and send(control(242),0x147)==2+ assert send(control(242),0x147)==1assert send(control(240),0xf0)==(1 if stage=='restart-on' else 0), stageif stage=='restart-on':send(control(240),0xf5)wait(lambda:'effective=false/' in (out/(stage+'.log')).read_text(encoding='utf-8',errors='replace'))- assert not u.IsWindowEnabled(control(241))+ # The low-latency checkbox no longer disables the other two.+ assert u.IsWindowEnabled(control(242))send(main,0x10)assert process.wait(timeout=15)==0(out/'result.json').write_text(json.dumps(dict(passed=True,restartOn=True,restartOff=True,layout=results),indent=2),encoding='utf-8')diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cppindex 801e7784..a3be0242 100644--- a/src/engine/EngineController.cpp+++ b/src/engine/EngineController.cpp@@ -651,8 +651,9 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sPresentationSettings requested;uint64_t revision;{std::lock_guard lock(mutex_);requested=presentation_;revision=presentationRevision_;}if(revision==pacingRevision&&presenterGeneration==presenter.generation()){- if(presentationEffective.enabled&&presentationEffective.mode==PacingMode::Reflex&&!presenter.reflexActive()){- presentationEffective.mode=PacingMode::LowQueue;+ // Reflex dropped out at runtime: the queue-depth part of the+ // low-latency setting stays, so only the status line changes.+ if(presentationEffective.enabled&&!presenter.reflexActive()&&presenter.reflexDisablePending()){std::lock_guard lock(mutex_);snapshot_.presentationEffective=presentationEffective;snapshot_.presentationStatus=presenter.reflexDisablePending()?L"Reflex 调用及驱动撤销失败;请关闭视频后重试":L"Reflex 调用失败,当前使用低排队;详见日志";}if(presentationEffective.enabled&&!presenter.pacingActive()){@@ -668,7 +669,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sstd::wstring message;presentationEffective=presenter.configurePresentation(ctx,requested,options.fg,message);pacingRevision=revision;presenterGeneration=presenter.generation();cadence.reset();- {std::lock_guard lock(mutex_);snapshot_.presentationEffective=presentationEffective;snapshot_.presentationRevision=revision;snapshot_.presentationStatus=message;}+ {std::lock_guard lock(mutex_);snapshot_.presentationEffective=presentationEffective;snapshot_.presentationRevision=revision;snapshot_.presentationStatus=message;snapshot_.presentationProviderOwned=presenter.providerOwnedPresentation();}veyra::log::info("pacing",std::format("revision={} requested={}/{}/{} effective={}/{}/{}",revision,requested.enabled,unsigned(requested.mode),unsigned(requested.display),presentationEffective.enabled,unsigned(presentationEffective.mode),unsigned(presentationEffective.display)));};auto drainLivePresentation=[&]{cadence.reset();if(liveScheduler){++presentationDrains;liveScheduler->cancel();pollCompletions();pendingCompletions.clear();}pairLatency.reset();};@@ -1126,6 +1127,23 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s};if(fgBudgetRevision!=options.settings.revision){fgBudget.reset();pairLatency.reset();fgBudgetRevision=options.settings.revision;}previewFgMultiplier=options.fgMultiplier;+ // An output cap used to only drop candidates at present time, so+ // the GPU still generated frames that were thrown away: at 6X on+ // a 100 Hz panel we generated ~360/s, submitted ~276/s, and the+ // panel could show at most 100 (measured 2026-09-22). Derive the+ // smallest multiplier whose output still reaches the cap and use+ // that instead. Only ever lowers, never raises, the multiplier the+ // user asked for; the present-time cap below stays as the residual+ // after this integer rounding.+ if(options.fg&&previewFgMultiplier>2&&presentationEffective.outputRate==OutputRateMode::Custom&&+ !presentSinkFrameGeneration(options.settings.frameGenerationBackend)){+ const double sourceFps=activeSource->info().averageFps;+ const double cap=presentationEffective.customFps;+ if(sourceFps>0.01&&std::isfinite(cap)&&cap>0.0){+ const auto needed=unsigned(std::ceil(cap/sourceFps-1e-6));+ previewFgMultiplier=std::clamp(needed,2u,options.fgMultiplier);+ }+ }{std::lock_guard lock(mutex_);snapshot_.previewFgMultiplier=previewFgMultiplier;}const auto liveInterval=livePhaseInterval100ns(pkt.duration,activeSource->info().averageFps/(isScreen&&halfRate?2:1),isScreen);const auto processingAllowance=isCapture&&options.fg&&!presentSinkFrameGeneration(options.settings.frameGenerationBackend)?@@ -1417,12 +1435,15 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sconst auto due=cadence.due(optionalNow+int64_t((itemPtsMs-nowMs())*10000),interval,20);if(optionalNow<due)return {State::Pending,due};}+ int64_t capInterval=0;if(presentationEffective.enabled||presentationEffective.outputRate==OutputRateMode::Custom){const auto interval=std::max<int64_t>(1,int64_t(sourceIntervalMs*10000)/std::max(1u,batch.batch.count));const auto mediaDeadline=isCapture?timeline.cadenceDeadline(item.pts100ns,optionalNow):fileAwaitingVideo?optionalNow:optionalNow+int64_t((itemPtsMs-nowMs())*10000);- const unsigned catchUpPercent=!isCapture&&options.fg&&!presentSinkFrameGeneration(options.settings.frameGenerationBackend)?20:10;- auto due=presentationEffective.enabled&&presentationEffective.mode==PacingMode::Even?cadence.due(mediaDeadline,interval,catchUpPercent):mediaDeadline;- int64_t capInterval=0;+ // Media time is the deadline. The old "even" mode+ // added a spacing floor on top; it measured as a+ // no-op because production already lands within+ // 0.8 ms of media time (b13/pacing-ab).+ auto due=mediaDeadline;if(presentationEffective.outputRate==OutputRateMode::Custom){capInterval=std::max<int64_t>(1,int64_t(10000000.0/presentationEffective.customFps));due=std::max(due,cadence.rateDue(optionalNow,capInterval));@@ -1433,7 +1454,6 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s// slot, discard this stale display opportunity// instead of accumulating latency.if(capInterval>0&&cadence.rateSkipsCandidate(optionalNow,mediaDeadline,interval,capInterval)){++s.dropped;++s.handled;++s.next;s.deadlineStart.reset();continue;}- if(generated&&presentationEffective.enabled&&presentationEffective.mode==PacingMode::Even&&due>mediaDeadline+interval){++s.dropped;++s.handled;++s.next;s.deadlineStart.reset();continue;}if(optionalNow<due)return {State::Pending,due};if(!presenter.presentationReady())return {State::Pending,optionalNow+2000};}@@ -1457,6 +1477,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s}if(didPresent){cadence.submitted(optionalNow);+ cadence.rateSubmitted(optionalNow,capInterval);if(physicalCapture&&veyra::log::verboseFrameLogs())veyra::log::info("capture-present-sample",std::format("source={} epoch={} revision={} batch={} subframe={} generated={} arrival={} arrivalA={} ready={} begin={} end={}",item.identity.sourceFrameId,item.identity.epoch,item.identity.settingsRevision,batch.batch.batchId,item.subframe,generated,captureArrival,lineage?lineage->a.host100ns:0,watch->frameReadyObserved[s.next],optionalNow,host100ns()));if(veyra::log::verboseFrameLogs())veyra::log::info("pacing-sample",std::format("mode={} enabled={} sync={} pts={} begin={} end={} ready={} process={} generated={} queue={} lateMs={:.3f}",unsigned(presentationEffective.mode),presentationEffective.enabled,unsigned(presentationEffective.display),item.pts100ns,optionalNow,host100ns(),watch->frameReadyObserved[s.next],std::chrono::duration_cast<std::chrono::nanoseconds>(watch->processStart.time_since_epoch()).count()/100,generated,liveScheduler->occupancy(),isCapture?double(optionalNow-timeline.deadline(item.pts100ns))/10000:fileAwaitingVideo?0:nowMs()-itemPtsMs));diagnostics::FrameTraceEvent event{presentEndHost,runSessionId,item.identity,batch.batch.batchId,item.lease->consumerFence,item.pts100ns,diagnostics::TraceKind::Present,item.subframe,1,elapsed};diff --git a/src/engine/VideoPresenter.cpp b/src/engine/VideoPresenter.cppindex 75e97d4e..76a57f5c 100644--- a/src/engine/VideoPresenter.cpp+++ b/src/engine/VideoPresenter.cpp@@ -302,26 +302,33 @@ PresentationSettings VideoPresenter::configurePresentation(gfx::D3D12DeviceConteif(!reflexDisabled){effective.enabled=false;sink_.configurePacing(false,false);status=L"Reflex 驱动状态撤销失败;应用等待已停用,请关闭视频后重试";return effective;}if(!requested.enabled){const bool restored=sink_.configurePacing(false,false);status=restored?L"帧同步已关闭":L"应用等待已关闭,但显示队列恢复失败;请关闭视频后重试";if(effective.outputRate==OutputRateMode::Custom)status+=std::format(L" · 输出上限 {:.3f} FPS",effective.customFps);status+=capNotice;return effective;}if(xessActive()||fsrActive()){+ // The provider owns Present for its generated frames, so neither the+ // latency waiter nor an output cap can reach them. Only the DXGI VSync+ // bit still applies (XeSS accepts it on the proxy chain).effective.enabled=false;+ providerOwnedPresentation_=true;const bool vsync=xessActive()&&requested.display!=DisplaySync::Tearing;sink_.configurePacing(false,vsync);- if(fsrActive()){effective.display=DisplaySync::Tearing;status=L"FSR 提供方调度;显示同步暂不支持";}- else status=vsync?L"XeSS 提供方调度 · 垂直同步":L"XeSS 提供方调度 · 允许撕裂";+ if(fsrActive()){effective.display=DisplaySync::Tearing;status=L"FSR 提供方自行调度:低延迟队列与输出上限均不生效,显示同步暂不支持";}+ else status=vsync?L"XeSS 提供方自行调度:低延迟队列与输出上限不生效 · 垂直同步":L"XeSS 提供方自行调度:低延迟队列与输出上限不生效 · 允许撕裂";if(xessActive()&&requested.display==DisplaySync::Automatic)status+=L"(自动;VRR 状态未知)";- status+=capNotice;return effective;}+ providerOwnedPresentation_=false;if(!sink_.configurePacing(true,requested.display!=DisplaySync::Tearing)){effective.enabled=false;status=L"显示队列控制不可用,已回退原呈现方式";return effective;}- if(requested.mode==PacingMode::Reflex){- // Generated outputs need separately validated out-of-band markers.- if(fg||!reflex_.enable(ctx.device())){effective.mode=PacingMode::LowQueue;status=fg?L"补帧运行:Reflex 暂用低排队(保留补帧倍率)":L"Reflex 初始化失败,已回退低排队";return effective;}- }- status=effective.mode==PacingMode::Reflex?L"NVIDIA Reflex · 实验":effective.mode==PacingMode::Even?L"均匀呈现":L"低排队";- if(followDisplay)status+=std::format(L" · 输出跟随显示器 ({:.0f} Hz)",requested.customFps);- else if(requested.outputRate==OutputRateMode::Custom)status+=std::format(L" · 输出上限 {:.3f} FPS",requested.customFps);- if(requested.display==DisplaySync::Automatic)status+=L" · 自动:垂直同步(VRR 状态未知)";- else if(requested.display==DisplaySync::Vsync)status+=L" · 垂直同步";- else status+=L" · 允许撕裂";+ // Low latency = queue depth 1, plus Reflex when frame generation is off+ // (generated outputs would need separately validated out-of-band markers).+ std::wstring latency=L"低延迟队列:队列深度 1";+ if(fg)latency+=L"(补帧运行,Reflex 不启用)";+ else if(reflex_.enable(ctx.device()))latency=L"低延迟队列:队列深度 1 + NVIDIA Reflex(实验)";+ else latency+=L"(Reflex 初始化失败)";+ std::wstring cap;+ if(followDisplay)cap=std::format(L"输出上限:跟随显示器 {:.0f} Hz",requested.customFps);+ else if(requested.outputRate==OutputRateMode::Custom)cap=std::format(L"输出上限:{:.3f} FPS",requested.customFps);+ else cap=L"输出上限:关闭";+ const std::wstring sync=requested.display==DisplaySync::Automatic?L"显示同步:自动(按垂直同步处理,VRR 状态未知)"+ :requested.display==DisplaySync::Vsync?L"显示同步:垂直同步":L"显示同步:允许撕裂";+ status=latency+L" · "+cap+L" · "+sync;return effective;}Microsoft::WRL::ComPtr<ID3D12Resource> VideoPresenter::presentedResourceForTest() {