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++
Checkpoint DLSS recovery fix and matched capture measurements
Veyra Goal Agentb2c3d0e574c9
diff --git a/CMakeLists.txt b/CMakeLists.txtindex 94080a55..5fe5b40a 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -811,7 +811,7 @@ if(VEYRA_FFMPEG_ROOT AND EXISTS "${VEYRA_FFMPEG_ROOT}/include/libavformat/avformtarget_compile_options(veyra_popup_selector_tests PRIVATE /utf-8)target_compile_definitions(veyra_popup_selector_tests PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN UNICODE _UNICODE)target_link_libraries(veyra_popup_selector_tests PRIVATE veyra_base comctl32)- add_dependencies(veyra_engine veyra_shader_hdr_video_sr veyra_shader_present_motion)+ add_dependencies(veyra_engine veyra_shader_hdr_video_sr veyra_shader_present_motion veyra_shader_present_blit)add_executable(veyra_hdr_color_tests tests/integration/HdrColorTests.cpp)add_executable(veyra_multichannel_tests tests/integration/MultichannelTests.cpp)target_compile_features(veyra_multichannel_tests PRIVATE cxx_std_20)diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.mdindex 4a736c41..89952055 100644--- a/docs/CURRENT_STATUS.md+++ b/docs/CURRENT_STATUS.md@@ -1,6 +1,8 @@# 当前项目状态 / Current Status-更新:2026-09-19。发布状态与开发状态分别记录,历史计划不代表当前验收。+更新:2026-09-20。发布状态与开发状态分别记录,历史计划不代表当前验收。++最新 DLSS 恢复修复:`codex/dlss-recovery-20260920` 从 `c8a3828` 隔离,将无有效 A/B 历史时的整组 MFG 重置改为单次完整预热,按实际预热成本判定预算,新增未执行重置候选计数。主程序构建、105 项 CPU 调度检查和 RTX5070 的 1080p NR+DLSS 2X/4X/6X 恢复检查通过,D3D12 错误为 0。用户关闭程序后,实卡 1440p60 NV12、NR+DLSS SR 到 4K+6X 各 120 秒对照:提交率 202.57→204.10/s,预热调用减少但主要吞吐限制未解决;关闭测试预算拒绝反而降到 184.76/s,采集丢帧及生成过期增加。未达到稳定 6X,不能宣称已修好。未覆盖用户便携包、未发布。见 [恢复修复记录](DLSS_RECOVERY_REPAIR_2026-09-20.md)。最新切换修复(09-20 最终回归):`codex/fg-backend-switch-20260919` 修正 XeSS 旧倍率缓存、UI 请求拒绝、失败回退及异步准备帧的 XeLL 标记周期。RTX5070 引擎/真实下拉切换、失败注入、拖动/重置/缩放回归通过。YUY2 50fps 合成输入 2X/4X 有生成输出,1:1 单像素测试未发现额外模糊;用户所述观感及与 PotPlayer 的差异仍缺同条件对照,不能宣称解决。详见 [切换修复记录](FG_BACKEND_SWITCH_REPAIR_2026-09-19.md)。仅本地编译,未更新用户便携包或发布。diff --git a/docs/DLSS_RECOVERY_REPAIR_2026-09-20.md b/docs/DLSS_RECOVERY_REPAIR_2026-09-20.mdnew file mode 100644index 00000000..b0299a78--- /dev/null+++ b/docs/DLSS_RECOVERY_REPAIR_2026-09-20.md@@ -0,0 +1,133 @@+# DLSS MFG recovery repair, 2026-09-20++## Scope and evidence++Baseline: `c8a3828`; checkpoint: `checkpoint/pre-dlss-recovery-20260920`;+branch: `codex/dlss-recovery-20260920`. No release or push.++The running 1.4.3 package on RTX 5070 accepts 2560x1440 NV12 at about+59.94 Hz and processes DLSS 6X at 3840x2160. In a 10.123-second sample:+607 captured, 583 accepted, 560 FG candidates rejected before evaluation,+2355 evaluations, 680 warmup evaluations, 1491 generated presentations,+184 generated frames expired. Presentation submissions are not scanout FPS.++A rejected pair invalidates FG history. Previously, the next admitted 6X+pair issued five reset evaluations and discarded all five outputs. This+amplifies the cost of recovery. It does not prove sufficient steady GPU+throughput for every 4K 6X workload. Independent stage P95s must not be summed.++## Implementation++- Seed reset history using one complete evaluation group with count/index 1.+ The next steady pair uses the selected multiplier. Do not leave a partial+ five-call group, skip temporal reset, or present reset outputs.+- Pass the actual graph reset state into admission. Use measured whole-warmup+ cost for warmup only; when unavailable, retain the steady estimate. Do not+ divide a 6X measurement by five or relax the deadline.+- Record `fgSkippedForReset` separately from rejected work and executed warmup.+ Candidate accounting is evaluated + admission-skipped + reset-skipped.+- Preserve generated-resource fences even when warmup outputs are not shown.+- Unknown readiness logs as -1, instead of subtracting a deadline from zero.++The SDK exposes count/index per evaluation rather than feature creation.+This supports the proposed group change but is not runtime acceptance evidence.++## Verification++CPU regression uses the observed deadline and predicted cost to distinguish+cheap measured recovery from steady 6X work. Integration coverage extends to+6X, checks reset accounting and valid generated outputs immediately following+startup and two rejection bursts, and checks D3D12 debug errors.++Build passed for the application, scheduler unit tests, admission tests,+sustained tests and live presentation tests. The last two were compiled only.+Scheduler tests: 105 PASS, exit 0.++On RTX 5070, driver 32.0.16.1656, 1080p test media with NR and DLSS:++| Multiplier | Real / NR | Rejected candidates | Evaluations | Reset-skipped | Valid generated | Debug errors |+| --- | --- | --- | --- | --- | --- | --- |+| 2X | 40 / 40 | 8 | 32 | 0 | 28 | 0 |+| 4X | 40 / 40 | 24 | 88 | 8 | 84 | 0 |+| 6X | 40 / 40 | 40 | 144 | 16 | 140 | 0 |++All exit 0. These final tests include an explicit midstream history reset,+two rejection bursts, next-frame validity/PTS checks, nonblack generated+pixel checks after recovery, and debug-layer inspection. Readback is test-only.+The user's application remained running, so these are correctness results,+not timing or throughput measurements. No capture device was opened.++Matched-workload physical capture testing is recorded below. It did not+eliminate rejection or reach the 4K 6X target.+RTX 30/40 and image-quality comparisons are not covered by this test.++Build: `E:/项目/Veyra/build/slider-reset-20260919` (existing isolated build).+Logs: `E:/项目/Veyra/logs/dlss-recovery-*-20260920.log`.+Tests: `E:/项目/Veyra/tests/dlss-recovery-20260920`, final2/4/6 stdout and+engine logs; `scheduler.log`. TEMP/TMP: `E:/项目/Veyra/tmp/dlss-recovery-20260920`.+Runtime identities and binary files are unchanged. The user's portable+package remains the prior build; no new package or publication was made.++## Physical capture comparison after user closed the application++The user authorized testing the previous settings. Matched original log+revision 18, not the final effects-off revision: `capture:0:14:0:0`, NV12+2560x1440 nominal 60 Hz (measured about 59.94), DLSS SR to 3840x2160,+original NR at realtime 1920x1080, NVOF Performance, DLSS 6X at 4K.+Order SR -> NR -> residual -> FG. HDR/pacing/VSync off, tearing on,+1795x816 presentation client, three swapchain buffers. GPU RTX 5070.++Baseline product source is detached `c8a3828` at+`E:/项目/Veyra/worktrees/dlss-recovery-baseline-20260920`; only the identical+sustained harness was copied there. Build at+`E:/项目/Veyra/build/dlss-recovery-baseline-20260920`, with the same approved+runtime junction and six FFmpeg/dav1d DLLs as the repaired build.+Baseline executable SHA256:+`1564C11D28DA94AE8DFC6A769F382202BB628ACBF144CA53C652C591A5777C1E`.+Repaired executable SHA256:+`3B992A76563029F7FEC53361CB35273784B7F5EC4D39E0578E6ED543CF4685E8`.++Harness profile `live-1440p` sets the above options and disables the normal+injected 55 ms stall. Run with `scripts/run-short-test.ps1`, arguments+`capture:0:14:0:0 OUTPUT 6 on 120 on 0 live-1440p`, timeout 175 seconds.+Both runs exited 0, sequentially with no concurrent build. A third diagnostic+used admission `off`, duration 60, timeout 115. This changes only the test+option; product admission remains enabled. Minimum ratio 0 means no throughput+assertion: the harness's `throughput=1` is NOT acceptance of the 360 Hz target.++Rates below are cumulative counter deltas over t=22..119 (97 seconds), or+t=22..59 (37 seconds) for the diagnostic. They are software submissions,+not physical scanout or HDMI-to-eye latency. Live content was not a repeated+controlled recording, so small differences cannot establish a performance gain.++| Measurement | Baseline | Repaired | Repaired, admission off |+| --- | ---: | ---: | ---: |+| Received input / s | 59.94 | 59.94 | 59.92 |+| Accepted input / s | 58.01 | 57.54 | 49.86 |+| Real + generated presentations / s | 202.57 | 204.10 | 184.76 |+| Rejected generated candidates / s | 57.94 | 54.12 | 0 |+| Executed warmup calls / s | 67.58 | 13.22 | 10.05 |+| Generated frames expired / s | 19.98 | 20.94 | 64.32 |+| Capture mailbox overwrites / s | 1.93 | 2.40 | 10.05 |+| Final rolling capture-age P95, ms | 32.91 | 33.23 | 35.05 |+| Final rolling scheduling-wait P95, ms | 9.02 | 9.65 | 15.02 |++Conclusion: single-call recovery removes repeated invalid work, but does not+solve the main sustained limitation for these settings (throughput delta+only +0.76%). Disabling admission worsened accepted input and effective+output, despite more generated candidates. Do not remove deadlines as a fix.+The five-frame FG GPU span was around 10 ms in this workload; this span can+include submission/dependency gaps, and does not prove pure compute saturation.+Further work must isolate GPU execution from command-slot/owner-thread stalls+and presentation phase, while retaining real source cadence and bounded queues.+No claim of stable 6X, reduced physical latency, or universal hardware coverage.++Evidence prefixes under `E:/项目/Veyra/tests/dlss-recovery-20260920`:+`live-baseline-clean`, `live-fixed-clean`, `live-fixed-no-admission`; each has+stdout/stderr and a directory with engine.log. Initial `live-fixed` overlapped+baseline compilation and is excluded from the comparison. Initial baseline+startup failed because PresentBlit shaders were absent; explicitly building+`veyra_shader_present_blit` resolved it. The root CMake engine dependency now+includes that target so standalone engine harness builds produce the shaders.+One shell invocation had a misspelled timeout argument and never launched.+No user's application was killed or overwritten; no package was produced.diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex f051a170..bea7cceb 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1,5 +1,25 @@# Veyra 工作记录+## 2026-09-20 用户关闭程序后的同参数实卡对照++用户要求直接测试刚才参数。按原日志 revision18 使用 `capture:0:14:0:0`、1440p60 NV12、NR 实时1080、DLSS SR 到4K、NVOF Performance、DLSS6X、1795x816、帧同步/VSync/HDR关闭;没有误用最终效果全关配置。完整命令、哈希、计数及边界见 `docs/DLSS_RECOVERY_REPAIR_2026-09-20.md` 新增实卡章节。++基线 worktree=`E:/项目/Veyra/worktrees/dlss-recovery-baseline-20260920`,detached c8a3828,复制相同 sustained harness,产品代码不改。同名 build 目录使用 `scripts/build-isolated.ps1`、当前 slider-reset 构建依赖缓存、同名 tmp,Targets=veyra_fg_sustained_tests;基线首次启动漏 PresentBlit,补构建 veyra_shader_present_blit 后正常。当前 CMakeLists 给 engine 增加此依赖;测试入口增加 live-1440p 参数及计数,禁用性能比较中的注入长帧。++通过 `scripts/run-short-test.ps1` 串行运行 baseline-clean/fixed-clean 各120秒、fixed-no-admission 60秒,均退出0。前两轮 t22..119 计数差得到呈现提交202.57/204.10每秒,预热67.58/13.22每秒,采集覆盖1.93/2.40每秒;关闭预算诊断 t22..59 为184.76提交、10.05采集覆盖、64.32生成过期每秒。恢复浪费减少,但稳定6X目标未达到,不宣称性能修复验收通过。三个测试不与构建并行;初轮 live-fixed 与基线编译重叠,排除其性能结论。一次超时参数拼写错误未启动测试。++证据=`E:/项目/Veyra/tests/dlss-recovery-20260920/live-{baseline-clean,fixed-clean,fixed-no-admission}*`;构建日志=`E:/项目/Veyra/logs/dlss-recovery-baseline-build-20260920.log`、`dlss-recovery-harness-dependency-20260920.log`。修正 CMake 依赖后重新配置/构建退出0(ninja 无待编译项),git diff --check 无错误;测试进程均已结束。TEMP/TMP 和 CWD 均在 E 盘本轮目录;保留对照构建与日志,无额外中间包。现场内容未固定回放,不将不足1%差异宣传为收益。未修改用户包、未发布;下一步需区分 GPU 执行成本、命令槽/主循环供给停顿和呈现相位,不能简单撤掉门禁。++## 2026-09-20 DLSS 重置恢复重复计算修复++用户要求修复现场 6X 调度降档。从干净 `c8a3828` 创建 `codex/dlss-recovery-20260920` 和存档 `checkpoint/pre-dlss-recovery-20260920`。现场计数及范围见 `docs/DLSS_RECOVERY_REPAIR_2026-09-20.md`。修复 EnhanceGraph 的重复重置评估、FgRecoveryBudget 的预热成本选择、EngineController 的实际历史状态传递及未知 ready 日志;增加独立 reset-skipped 计数,并更新候选守恒回归。没有放开截止时间、增加队列上限或取消断帧历史重置。++构建命令:`scripts/build-isolated.ps1 -Root . -BuildDirectory E:/项目/Veyra/build/slider-reset-20260919 -DependencyCache E:/项目/Veyra/build/frame-pacing-20260918/CMakeCache.txt -TempDirectory E:/项目/Veyra/tmp/dlss-recovery-20260920 -DisplayVersion 1.4.3`,Targets 为 veyra、veyra_presentation_worker_tests、veyra_fg_admission_tests、veyra_fg_sustained_tests、veyra_live_presentation_tests,分批构建均退出 0。日志为 `E:/项目/Veyra/logs/dlss-recovery-{build,build-final,live-build,admission-build}-20260920.log`。存在既有 MSVC 字符转换警告,无编译错误。++`veyra_presentation_worker_tests.exe` 退出 0,105 PASS,记录 `E:/项目/Veyra/tests/dlss-recovery-20260920/scheduler.log`。`scripts/run-short-test.ps1 -Exe BUILD/veyra_fg_admission_tests.exe -Arguments dlss,M,MEDIA,OUTPUT -TimeoutSeconds 60 -LogPrefix PREFIX`,M=2/4/6,MEDIA=`E:/项目/Veyra/tests/1.4.2beta/visible-scene.mp4`,OUTPUT/PREFIX=`E:/项目/Veyra/tests/dlss-recovery-20260920/finalM`。三轮各 40 源帧与 40 次 NR,加入两段拒绝和一次中途历史重置,分别生成 28/84/140 有效帧,debugErrors=0,均退出 0;检查恢复后一帧完整倍率、PTS 和非黑画面。早期 admission2/4/6 为未加入中途 reset 的首轮通过证据,不用其计数替代最终结果。++测试子进程 TEMP/TMP 指向 E 盘本轮 tmp 目录,CWD 指向本轮 tests 目录。用户原进程 32496 保持运行,未占采集卡、未覆盖旧包。短素材 GPU 测试只验正确性,不作并发环境下性能结论;同参数 4K 持续对照等待用户关闭旧窗口。未执行 sustained/live-presentation GPU 用例,未测 RTX30/40,不宣称所有补帧受限解决。主程序已构建但未重新打包、合并 main、推送或发布。+## 2026-09-20 1.4.3 本地测试包用户要求构建 1.4.3 自测,沿用当前隔离分支与修复提交 8c9957b,不推送或发布。CMake 数字及显示版本改为 1.4.3,新增本版更新说明、组件说明和 RemotePlay 构建说明。运行库全部沿用既有身份,打包脚本逐项校验哈希、签名、尺寸与版本。diff --git a/include/veyra/diagnostics/FrameMetrics.h b/include/veyra/diagnostics/FrameMetrics.hindex 320b09d0..f1e6605c 100644--- a/include/veyra/diagnostics/FrameMetrics.h+++ b/include/veyra/diagnostics/FrameMetrics.h@@ -46,7 +46,7 @@ struct FrameFlowCounters {// Realtime file preview only: decoded source frames whose enhancement// opportunity was dropped (PTS window fully passed) before the graph.uint64_t previewSkippedBeforeGraph=0;- uint64_t fgCandidate=0,fgEvaluated=0,fgSkippedBeforeEval=0,fgReadyValid=0,fgInvalid=0,fgWarmup=0;+ uint64_t fgCandidate=0,fgEvaluated=0,fgSkippedBeforeEval=0,fgReadyValid=0,fgInvalid=0,fgWarmup=0,fgSkippedForReset=0;uint64_t xessSdkGenerated=0,xessSdkPresented=0,realReady=0;uint64_t realPresented=0,generatedPresented=0,generatedExpiredAfterEval=0,cancelledBeforePresent=0;uint64_t historyResets=0,captureDropResets=0,settingsResets=0;diff --git a/include/veyra/engine/FgRecoveryBudget.h b/include/veyra/engine/FgRecoveryBudget.hindex 0dfb52f0..64c3a1b0 100644--- a/include/veyra/engine/FgRecoveryBudget.h+++ b/include/veyra/engine/FgRecoveryBudget.h@@ -32,7 +32,7 @@ public:void complete(std::optional<double> measuredMs,bool evaluated,bool warmup,int64_t now,std::optional<double> measuredFg={}){// Missing GPU timestamps are unknown, not CPU polling delay. Let old// samples expire; admission still checks each batch's real deadline.- if(warmup){if(measuredMs)add(warmup_,now,*measuredMs);return;}+ if(warmup){if(evaluated&&measuredMs)add(warmup_,now,*measuredMs);return;}if(evaluated&&measuredFg)fgCost(*measuredFg,now);if(!measuredMs)return;const double ms=*measuredMs;@@ -41,7 +41,10 @@ public:// completion as conservative base cost; never assume free FG.add(base_,now,std::max(0.0,ms-extra.value_or(0)));}- std::optional<double> predicted(int64_t now)const{+ std::optional<double> predicted(int64_t now,bool warmingHistory=false)const{+ // Use a measured whole warmup, never divide MFG cost by its multiplier.+ // Until measured, retain the conservative steady-work estimate.+ if(warmingHistory)if(auto cost=p95(warmup_,now,10000000))return cost;const auto base=baseCost(now);if(!base)return {};return *base+p95(fg_,now,20000000).value_or(0);@@ -53,8 +56,8 @@ public:int64_t processingAllowance(int64_t now,int64_t interval)const{return int64_t(std::min(double(std::max<int64_t>(0,interval)),baseCost(now).value_or(0)*10000));}- bool admit(int64_t now,int64_t deadline,double elapsed,double present){- const auto cost=predicted(now);+ bool admit(int64_t now,int64_t deadline,double elapsed,double present,bool warmingHistory=false){+ const auto cost=predicted(now,warmingHistory);// FG has not been submitted at admission. CPU time can at most cover// the base work; it must never erase the cost of future FG calls.const double progress=std::clamp(elapsed,0.0,baseCost(now).value_or(0));diff --git a/include/veyra/pipeline/EnhanceGraph.h b/include/veyra/pipeline/EnhanceGraph.hindex 19c10dd8..803ecdf0 100644--- a/include/veyra/pipeline/EnhanceGraph.h+++ b/include/veyra/pipeline/EnhanceGraph.h@@ -150,7 +150,7 @@ public:struct FrameOutputs {FrameBatch batch;- uint32_t fgCandidates=0,fgEvaluated=0,fgSkippedBeforeEval=0;+ uint32_t fgCandidates=0,fgEvaluated=0,fgSkippedBeforeEval=0,fgSkippedForReset=0;bool historyReset=false,fgRecovery=false;ResetReason detectedReset=ResetReason::None;bool contentDuplicate=false;int measuredContentRate=0;@@ -170,7 +170,7 @@ public:// does not own the demuxer). `reset` marks the first frame of a new// temporal epoch (open/seek/...): NVOF/FG history is not consumed.// Returns false on hard failure (run verdict must FAIL).- using FgAdmission=std::function<bool(const FrameBatch&)>;+ using FgAdmission=std::function<bool(const FrameBatch&,bool warmingHistory)>;// `hardwareSurface` carries the decoded texture for paths whose surface// does not travel inside the AVFrame (D3D11VA). It must be provided exactly// when frame->format == AV_PIX_FMT_D3D11 and is unused otherwise.diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cppindex 6a050053..3b4d8b92 100644--- a/src/engine/EngineController.cpp+++ b/src/engine/EngineController.cpp@@ -53,7 +53,7 @@ void logFrameFlow(const diagnostics::FrameFlowMetrics& m,const char* state){const auto& c=m.counters;const auto& id=m.latest;if(c.xessSdkPresented)veyra::log::info("provider-flow",std::format("state={} session={} revision={} sdkPresented={} sdkGenerated={} sdkSubmitFps={:.2f} measurement=provider-report-not-scanout",state,id.sessionId,id.frame.settingsRevision,c.xessSdkPresented,c.xessSdkGenerated,m.xessSdkSubmitFps));const auto& r=m.reset; const auto ms=[&](diagnostics::ResetStage s){return r.stageMs[size_t(s)].value_or(-1.0);};- veyra::log::info("frame-flow",std::format("state={} session={} revision={} epoch={} source={} batch={} readyFence={} consumerFence={} captureReceived={} mailboxOverwritten={} sourceAccepted={} sourceSkippedBeforeGraph={} realSubmitted={} fgCandidate={} fgSkippedBeforeEval={} fgEvaluated={} fgWarmup={} fgReadyValid={} fgInvalid={} realPresented={} generatedPresented={} generatedExpiredAfterEval={} cancelledBeforePresent={} commandSlots={} commandHighWater={} presentationHighWater={} slotWaitCount={} slotWaitMs={:.3f} generatedFps={:.2f} presentSubmitFps={:.2f} resetRevision={} resetEpoch={} resetReason={} resetOutcome={} resetDrainMs={:.3f} resetDestroyMs={:.3f} resetCreateMs={:.3f} resetWarmupMs={:.3f} resetFirstValidMs={:.3f} resetTotalMs={:.3f}",state,id.sessionId,id.frame.settingsRevision,id.frame.epoch,id.frame.sourceFrameId,id.batchId,id.readyFence,id.consumerFence,c.captureReceived,c.mailboxOverwritten,c.sourceAccepted,c.sourceSkippedBeforeGraph,c.realSubmitted,c.fgCandidate,c.fgSkippedBeforeEval,c.fgEvaluated,c.fgWarmup,c.fgReadyValid,c.fgInvalid,c.realPresented,c.generatedPresented,c.generatedExpiredAfterEval,c.cancelledBeforePresent,c.commandSlotsInFlight,c.commandSlotHighWater,c.presentationBatchHighWater,m.slotReuseWaitCount,m.slotReuseWaitMs.value_or(0),m.validGeneratedFps,m.presentSubmitFps,r.settingsRevision,r.epoch,unsigned(r.reason),unsigned(r.outcome),ms(diagnostics::ResetStage::Drain),ms(diagnostics::ResetStage::Destroy),ms(diagnostics::ResetStage::Create),ms(diagnostics::ResetStage::Warmup),ms(diagnostics::ResetStage::FirstValid),r.totalMs.value_or(-1.0)));+ veyra::log::info("frame-flow",std::format("state={} session={} revision={} epoch={} source={} batch={} readyFence={} consumerFence={} captureReceived={} mailboxOverwritten={} sourceAccepted={} sourceSkippedBeforeGraph={} realSubmitted={} fgCandidate={} fgSkippedBeforeEval={} fgEvaluated={} fgWarmup={} fgSkippedForReset={} fgReadyValid={} fgInvalid={} realPresented={} generatedPresented={} generatedExpiredAfterEval={} cancelledBeforePresent={} commandSlots={} commandHighWater={} presentationHighWater={} slotWaitCount={} slotWaitMs={:.3f} generatedFps={:.2f} presentSubmitFps={:.2f} resetRevision={} resetEpoch={} resetReason={} resetOutcome={} resetDrainMs={:.3f} resetDestroyMs={:.3f} resetCreateMs={:.3f} resetWarmupMs={:.3f} resetFirstValidMs={:.3f} resetTotalMs={:.3f}",state,id.sessionId,id.frame.settingsRevision,id.frame.epoch,id.frame.sourceFrameId,id.batchId,id.readyFence,id.consumerFence,c.captureReceived,c.mailboxOverwritten,c.sourceAccepted,c.sourceSkippedBeforeGraph,c.realSubmitted,c.fgCandidate,c.fgSkippedBeforeEval,c.fgEvaluated,c.fgWarmup,c.fgSkippedForReset,c.fgReadyValid,c.fgInvalid,c.realPresented,c.generatedPresented,c.generatedExpiredAfterEval,c.cancelledBeforePresent,c.commandSlotsInFlight,c.commandSlotHighWater,c.presentationBatchHighWater,m.slotReuseWaitCount,m.slotReuseWaitMs.value_or(0),m.validGeneratedFps,m.presentSubmitFps,r.settingsRevision,r.epoch,unsigned(r.reason),unsigned(r.outcome),ms(diagnostics::ResetStage::Drain),ms(diagnostics::ResetStage::Destroy),ms(diagnostics::ResetStage::Create),ms(diagnostics::ResetStage::Warmup),ms(diagnostics::ResetStage::FirstValid),r.totalMs.value_or(-1.0)));}}EngineController::EngineController(){worker_=std::thread(&EngineController::dispatch,this);}@@ -1045,13 +1045,13 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sconst bool injectedReject=transaction&&!options.nr&&GetEnvironmentVariableW(L"VEYRA_TEST_REJECT_NR_DISABLE",nullptr,0)>0;if(injectedReject)veyra::log::error("settings-test","test-only reject NR-disable transaction before graph process; no driver failure");pipeline::EnhanceGraph::FgAdmission admitFg;- const auto logAdmission=[&](const pipeline::FrameBatch& batch,int64_t now,int64_t deadline,double elapsed,double blit,bool admitted,const char* timeline){+ const auto logAdmission=[&](const pipeline::FrameBatch& batch,int64_t now,int64_t deadline,double elapsed,double blit,bool admitted,bool warmingHistory,const char* timeline){if(admitted)++fgAdmittedPairs;else ++fgRejectedPairs;// Keep the first rejection even if the periodic sample just// logged a success. Both channels remain rate bounded.if(now<nextFgAdmissionLog&&(admitted||now<nextFgRejectionLog))return;nextFgAdmissionLog=now+10000000;if(!admitted)nextFgRejectionLog=now+10000000;- veyra::log::info("live-fg-admission",std::format("timeline={} revision={} source={} multiplier={} admitted={} admittedPairs={} rejectedPairs={} remainingDeadlineMs={:.3f} predictedMs={:.3f} elapsedMs={:.3f} blitGpuP95Ms={:.3f} presentCpuP95Ms={:.3f} (CPU Present is backpressure, not added GPU cost)",timeline,batch.identity.settingsRevision,batch.identity.sourceFrameId,options.fgMultiplier,admitted,fgAdmittedPairs,fgRejectedPairs,double(deadline-now)/10000,fgBudget.predicted(now).value_or(-1),elapsed,blit,livePresent.p95()));+ veyra::log::info("live-fg-admission",std::format("timeline={} revision={} source={} multiplier={} admitted={} admittedPairs={} rejectedPairs={} remainingDeadlineMs={:.3f} predictedMs={:.3f} elapsedMs={:.3f} blitGpuP95Ms={:.3f} presentCpuP95Ms={:.3f} warmingHistory={} (CPU Present is backpressure, not added GPU cost)",timeline,batch.identity.settingsRevision,batch.identity.sourceFrameId,options.fgMultiplier,admitted,fgAdmittedPairs,fgRejectedPairs,double(deadline-now)/10000,fgBudget.predicted(now,warmingHistory).value_or(-1),elapsed,blit,livePresent.p95(),warmingHistory));};if(fgBudgetRevision!=options.settings.revision){fgBudget.reset();pairLatency.reset();fgBudgetRevision=options.settings.revision;}const auto liveInterval=livePhaseInterval100ns(pkt.duration,activeSource->info().averageFps/(isScreen&&halfRate?2:1),isScreen);@@ -1066,7 +1066,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s// owns generation inside its presenter and has no graph admission.if(isCapture&&!rereadCached&&useLiveFgAdmission&&!presentSinkFrameGeneration(options.settings.frameGenerationBackend)){const auto presentP95=livePresentGpu.p95();- admitFg=[&,presentP95](const pipeline::FrameBatch& batch){+ admitFg=[&,presentP95](const pipeline::FrameBatch& batch,bool warmingHistory){// Physical capture and PS5 delivery clocks are not// guaranteed to match the host clock. Anchor each new// input pair before enhancement, so a 59.94-vs-60Hz@@ -1079,8 +1079,8 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sconst auto lastGenerated=pipeline::FrameBatch::interpolate(a,batch.b100ns,options.fgMultiplier-1,options.fgMultiplier);const auto now=host100ns(),deadline=liveTimeline.deadline(lastGenerated);const double elapsed=elapsedMs(processStart);- const bool admitted=fgBudget.admit(now,deadline,elapsed,presentP95);- logAdmission(batch,now,deadline,elapsed,presentP95,admitted,pairAnchoredLive?(isRemote?"decoded-pair":"capture-pair"):"continuous");+ const bool admitted=fgBudget.admit(now,deadline,elapsed,presentP95,warmingHistory);+ logAdmission(batch,now,deadline,elapsed,presentP95,admitted,warmingHistory,pairAnchoredLive?(isRemote?"decoded-pair":"capture-pair"):"continuous");return admitted;};}@@ -1089,7 +1089,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s// generated timestamp can no longer be reached spends no FG// Evaluate; the real frame keeps its normal cadence (plan §4.1).if(!isCapture&&!isImage&&!rereadCached&&!transaction&&options.fg&&!presentSinkFrameGeneration(options.settings.frameGenerationBackend)){- admitFg=[&,historyReset](const pipeline::FrameBatch& batch){+ admitFg=[&,historyReset](const pipeline::FrameBatch& batch,bool warmingHistory){if(fileAwaitingVideo)return true; // Bounded startup lookahead; audio has not started.const auto interval=liveSourceInterval100ns(pkt.duration,activeSource->info().averageFps);const auto a=(historyReset||batch.b100ns<=batch.a100ns||batch.b100ns-batch.a100ns>10000000)?batch.b100ns-interval:batch.a100ns;@@ -1097,8 +1097,8 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sconst auto now=host100ns();const auto deadline=now+lastGenerated-int64_t(nowMs()*10000.0);const auto elapsed=elapsedMs(processStart),blit=livePresentGpu.p95();- const auto admitted=fgBudget.admit(now,deadline,elapsed,blit);- logAdmission(batch,now,deadline,elapsed,blit,admitted,"file-audio");+ const auto admitted=fgBudget.admit(now,deadline,elapsed,blit,warmingHistory);+ logAdmission(batch,now,deadline,elapsed,blit,admitted,warmingHistory,"file-audio");return admitted;};}@@ -1201,7 +1201,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sframeFlow->update([&](auto& m){m.lastSubmit100ns=host100ns();});frameFlow->cpu(diagnostics::CpuStage::Submit,processMs,host100ns());frameFlow->cpu(diagnostics::CpuStage::SlotWait,processSlotWaitMs,host100ns());- frameFlow->update([&](auto& m){m.latest.frame=out.batch.identity;m.latest.batchId=out.batch.batchId;m.latest.readyFence=std::max(out.videoFenceValue,out.genFenceValue);m.counters.sourceAccepted+=!rereadCached;++m.counters.realSubmitted;m.counters.previewSkippedBeforeGraph+=previewSkippedSinceSubmit;m.counters.fgCandidate+=out.fgCandidates;m.counters.fgEvaluated+=out.fgEvaluated;m.counters.fgSkippedBeforeEval+=out.fgSkippedBeforeEval;if(out.fgSkippedBeforeEval)m.lastFgRejected100ns=host100ns();if(!out.hasGenerated)m.counters.fgWarmup+=out.fgEvaluated;});+ frameFlow->update([&](auto& m){m.latest.frame=out.batch.identity;m.latest.batchId=out.batch.batchId;m.latest.readyFence=std::max(out.videoFenceValue,out.genFenceValue);m.counters.sourceAccepted+=!rereadCached;++m.counters.realSubmitted;m.counters.previewSkippedBeforeGraph+=previewSkippedSinceSubmit;m.counters.fgCandidate+=out.fgCandidates;m.counters.fgEvaluated+=out.fgEvaluated;m.counters.fgSkippedForReset+=out.fgSkippedForReset;m.counters.fgSkippedBeforeEval+=out.fgSkippedBeforeEval;if(out.fgSkippedBeforeEval)m.lastFgRejected100ns=host100ns();if(!out.hasGenerated)m.counters.fgWarmup+=out.fgEvaluated;});previewSkippedSinceSubmit=0;if(transaction||frames==0){std::lock_guard lock(mutex_);snapshot_.captureHalfRate=halfRate;@@ -1273,7 +1273,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sif(generated&&isCapture&&decisionTime>=nextFgDeadlineLog){nextFgDeadlineLog=decisionTime+10000000;const auto ready=watch->frameReadyObserved[s.next];- veyra::log::info("fg-deadline",std::format("revision={} batch={} subframe={} expired={} readyObservedLateMs={:.3f} decisionLateMs={:.3f} observedReadyToDecisionMs={:.3f} batchReady={} (CPU fence observations, not scanout)",item.identity.settingsRevision,batch.batch.batchId,item.subframe,generationExpired,double(ready-timeline.deadline(item.pts100ns))/10000,double(decisionTime-timeline.deadline(item.pts100ns))/10000,ready?double(decisionTime-ready)/10000:-1,watch->ready.load()));+ veyra::log::info("fg-deadline",std::format("revision={} batch={} subframe={} expired={} readyObservedLateMs={:.3f} decisionLateMs={:.3f} observedReadyToDecisionMs={:.3f} batchReady={} (CPU fence observations, not scanout; -1 means readiness unknown)",item.identity.settingsRevision,batch.batch.batchId,item.subframe,generationExpired,ready?double(ready-timeline.deadline(item.pts100ns))/10000:-1,double(decisionTime-timeline.deadline(item.pts100ns))/10000,ready?double(decisionTime-ready)/10000:-1,watch->ready.load()));}if(readiness==PreviewFrameReadiness::Expired){++s.dropped;++s.handled;++s.next;s.deadlineStart.reset();continue;}if(!s.deadlineStart)s.deadlineStart=Clock::now();diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cppindex 87881b8a..162afcf9 100644--- a/src/pipeline/EnhanceGraph.cpp+++ b/src/pipeline/EnhanceGraph.cpp@@ -1889,8 +1889,12 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, FramepreviousSource_=sourceFrameId;const bool fgBackendAvailable=fgEnabled_&&(fgBackend_&&fgBackend_->created());out.fgCandidates=fgBackendAvailable?desc_.fgMultiplier-1:0;- const bool runFg=fgBackendAvailable&&(!admitFg||admitFg(out.batch));const bool resetFg=reset||!prevValid_||fgHistorySkipped_;+ const bool runFg=fgBackendAvailable&&(!admitFg||admitFg(out.batch,resetFg));+ // A reset has no usable A/B pair. Seed one complete 2X evaluation group;+ // all later subframes would repeat reset work and cannot be presented.+ const uint32_t fgCalls=resetFg?1:desc_.fgMultiplier-1;+ if(runFg&&resetFg)out.fgSkippedForReset=out.fgCandidates-fgCalls;out.fgRecovery=runFg&&fgHistorySkipped_;if(fgBackendAvailable&&!runFg){out.fgSkippedBeforeEval=out.fgCandidates;fgHistorySkipped_=true;}if(!runFg)gpuTimer_.resolve(list);@@ -1900,7 +1904,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame// FG reads enhanced SDR color, not the pre-NR guidance input.if (runFg && fgBackend_ && fgBackend_->created()) {- for(uint32_t sub=1;sub<desc_.fgMultiplier;++sub){+ for(uint32_t sub=1;sub<=fgCalls;++sub){const uint32_t generatedSlot=parity+(sub-1)*2;auto* flist=ring_.acquireNext(slot,st); if(!flist)return false;auto* motion=desc_.fgMotionProbe?desc_.fgMotionProbe:(haveFlow?baseFlow_.Get():nrZeroMotion_.Get());@@ -1919,7 +1923,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Framefe.hdr=hdr10Output();fe.backbuffer=videoFrame_[parity].Get(); fe.depth=depthTex_.Get(); fe.mvecs=motion;fe.outputInterpolated=genFrame_[generatedSlot].Get(); fe.reset=resetFg;fe.outputDisableInterpolation=fgDisable_[parity].Get();- fe.multiFrameCount=desc_.fgMultiplier-1;fe.multiFrameIndex=sub;+ fe.multiFrameCount=fgCalls;fe.multiFrameIndex=sub;fe.frameId=realFrameIndex_+1;// FG consumer adapter: current->previous pixel flow -> normalized reverse flow.fe.mvecScaleX=(haveFlow||desc_.fgMotionProbe)?-1.0f/static_cast<float>(workW_):1.0f;@@ -1930,7 +1934,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frameif(!fgBackend_->evaluate(flist,ngxParams_,fe,st)){failedBackend_=engine::FailedBackend::Fg;return false;}cpuTrace.mark("fgEvaluate");++out.fgEvaluated;- gpuTimer_.mark(flist,timingStage,true);if(sub==desc_.fgMultiplier-1)gpuTimer_.mark(flist,GpuStage::FgBatch,true);+ gpuTimer_.mark(flist,timingStage,true);if(sub==fgCalls)gpuTimer_.mark(flist,GpuStage::FgBatch,true);tracker_.uavBarrier(flist,genFrame_[generatedSlot].Get());tracker_.uavBarrier(flist,fgDisable_[parity].Get());tracker_.transition(flist,fgDisable_[parity].Get(),D3D12_RESOURCE_STATE_COPY_SOURCE);@@ -1938,9 +1942,9 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frametracker_.transition(flist,videoFrame_[parity].Get(),D3D12_RESOURCE_STATE_COMMON);tracker_.transition(flist,genFrame_[generatedSlot].Get(),D3D12_RESOURCE_STATE_COMMON);tracker_.transition(flist,depthTex_.Get(),D3D12_RESOURCE_STATE_COMMON);- if(sub==desc_.fgMultiplier-1)gpuTimer_.resolve(flist);+ if(sub==fgCalls)gpuTimer_.resolve(flist);if(!ring_.submitAndSignal(slot))return false;- if(sub==desc_.fgMultiplier-1)gpuTimer_.submitted(ring_.lastSignaledValue());+ if(sub==fgCalls)gpuTimer_.submitted(ring_.lastSignaledValue());out.hasGenerated=!resetFg;out.genSlot=parity; out.genFenceValue=ring_.lastSignaledValue();out.generatedPtsMs=(prevPtsMs_+ptsMs)*0.5;diff --git a/tests/integration/FgAdmissionTests.cpp b/tests/integration/FgAdmissionTests.cppindex 33d2a02d..9aaae0ae 100644--- a/tests/integration/FgAdmissionTests.cpp+++ b/tests/integration/FgAdmissionTests.cpp@@ -14,7 +14,7 @@ int wmain(int argc,wchar_t** argv){using namespace veyra;if(argc!=5)return 2;if(std::wstring(argv[1])!=L"dlss")return 2;const unsigned multiplier=unsigned(std::stoi(argv[2]));- if(multiplier<2||multiplier>4)return 2;+ if(multiplier<2||multiplier>6)return 2;std::filesystem::create_directories(argv[4]);Logger::instance().openFile((std::filesystem::path(argv[4])/"engine.log").wstring());Logger::instance().setConsoleEnabled(false);CoInitializeEx(nullptr,COINIT_MULTITHREADED);gfx::D3D12DeviceContext ctx;gfx::CommandSlotRing ring;Status status;@@ -29,24 +29,35 @@ int wmain(int argc,wchar_t** argv){desc.frameGenerationBackend=engine::FrameGenerationBackend::Dlss;desc.runtimeAbsPath=runtime::localRuntimeDirectory().wstring();ok=ok&&graph.initialize(desc)&&graph.createViews();- unsigned skipped=0,evaluated=0,recoveries=0,generated=0,real=0;+ unsigned skipped=0,evaluated=0,resetSkipped=0,recoveries=0,generated=0,real=0;engine::DeadlineWait wait;for(unsigned i=0;ok&&i<40;++i){pipeline::FramePacket packet;const AVFrame* frame=nullptr;ok=source.read(packet,&frame)==source::SourceReadStatus::Frame;if(!ok)break;pipeline::EnhanceGraph::FrameOutputs out;const bool reject=(i>=8&&i<12)||(i>=24&&i<28);- auto admission=[&](const auto&){return engine::admitLiveFg(reject?2000000:900000,1000000,0,std::nullopt,0);};- ok=graph.process(frame,packet.pts.toDouble()*1000,i==0,out,packet.sequence,&packet.colorInfo,nullptr,false,admission);+ bool observedWarmup=false;+ auto admission=[&](const auto&,bool warmingHistory){+ observedWarmup=warmingHistory;+ return engine::admitLiveFg(reject?2000000:900000,1000000,0,std::nullopt,0);+ };+ ok=graph.process(frame,packet.pts.toDouble()*1000,i==0||i==20,out,packet.sequence,&packet.colorInfo,nullptr,false,admission);+ ok=ok&&(observedWarmup==(i==0||i==9||i==10||i==11||i==12||i==20||i==25||i==26||i==27||i==28));const auto start=std::chrono::steady_clock::now();while(ok&&!graph.resolveGeneration(out)){if(std::chrono::steady_clock::now()-start>std::chrono::seconds(2)){ok=false;break;}wait.slice(.2);}if(!ok)break;- skipped+=out.fgSkippedBeforeEval;evaluated+=out.fgEvaluated;recoveries+=out.fgRecovery;- ok=out.fgCandidates==multiplier-1&&out.fgCandidates==out.fgSkippedBeforeEval+out.fgEvaluated;+ skipped+=out.fgSkippedBeforeEval;evaluated+=out.fgEvaluated;resetSkipped+=out.fgSkippedForReset;recoveries+=out.fgRecovery;+ ok=ok&&out.fgCandidates==multiplier-1&&out.fgCandidates==out.fgSkippedBeforeEval+out.fgEvaluated+out.fgSkippedForReset;if(reject)ok=ok&&out.fgEvaluated==0&&out.batch.count==1&&!out.hasGenerated;if(i==12||i==28)ok=ok&&out.fgRecovery&&out.batch.count==1;+ if(i==0||i==12||i==20||i==28)ok=ok&&out.fgEvaluated==1&&out.fgSkippedForReset==multiplier-2;+ if(i==1||i==13||i==21||i==29){+ ok=ok&&out.batch.count==multiplier&&out.hasGenerated;+ for(unsigned j=0;j<out.batch.count;++j)if(out.batch.frames[j].kind==pipeline::FrameKind::Generated)+ ok=ok&&out.batch.frames[j].validity==pipeline::GenerationValidity::Valid;+ }for(unsigned j=0;j<out.batch.count;++j){const auto& f=out.batch.frames[j];if(f.kind==pipeline::FrameKind::Real){++real;ok=ok&&f.pts100ns==packet.pts.to100ns();}else if(f.validity==pipeline::GenerationValidity::Valid){++generated;ok=ok&&f.pts100ns>out.batch.a100ns&&f.pts100ns<out.batch.b100ns;}@@ -55,10 +66,16 @@ int wmain(int argc,wchar_t** argv){unsigned nonblack=0;for(size_t p=0;p+3<image.pixels.size();p+=4)nonblack+=image.pixels[p]>8||image.pixels[p+1]>8||image.pixels[p+2]>8;ok=ok&&nonblack>image.width*image.height/20;}+ if(i==13||i==21||i==29)for(unsigned j=0;j<out.batch.count;++j){+ const auto& f=out.batch.frames[j];if(f.kind!=pipeline::FrameKind::Generated)continue;+ sink::RgbaImage image;ok=ok&&sink::readRgba8(ctx,ring,f.lease->texture.Get(),image);+ unsigned nonblack=0;for(size_t p=0;p+3<image.pixels.size();p+=4)nonblack+=image.pixels[p]>8||image.pixels[p+1]>8||image.pixels[p+2]>8;+ ok=ok&&nonblack>image.width*image.height/20;+ }std::cout<<"frame="<<i<<" skip="<<out.fgSkippedBeforeEval<<" evaluate="<<out.fgEvaluated<<" recovery="<<out.fgRecovery<<" batch="<<out.batch.count<<" pass="<<ok<<std::endl;}const auto nr=graph.metrics().nrEvaluateCount;- ok=ok&&real==40&&nr==40&&skipped==8*(multiplier-1)&&evaluated==32*(multiplier-1)&&recoveries==2&&generated>0;+ ok=ok&&real==40&&nr==40&&skipped==8*(multiplier-1)&&resetSkipped==4*(multiplier-2)&&evaluated==28*(multiplier-1)+4&&recoveries==2&&generated>0;ring.drainQueue();graph.shutdown();source.close();unsigned errors=0;if(info)for(UINT64 i=0;i<info->GetNumStoredMessagesAllowedByRetrievalFilter();++i){SIZE_T size=0;info->GetMessage(i,nullptr,&size);std::vector<uint8_t> data(size);auto* m=reinterpret_cast<D3D12_MESSAGE*>(data.data());if(SUCCEEDED(info->GetMessage(i,m,&size))&&m->Severity<=D3D12_MESSAGE_SEVERITY_ERROR){++errors;log::error("debug",m->pDescription);}}ok=ok&&errors==0;diff --git a/tests/integration/FgSustainedTests.cpp b/tests/integration/FgSustainedTests.cppindex d57f267d..70a91bb7 100644--- a/tests/integration/FgSustainedTests.cpp+++ b/tests/integration/FgSustainedTests.cpp@@ -14,16 +14,18 @@ int wmain(int argc,wchar_t** argv){setFgCompatibilityProbeExecutable(executable);if(argc==3&&std::wstring_view(argv[1])==L"--fg-compat-probe")return runFgCompatibilityProbe(reinterpret_cast<HANDLE>(_wcstoui64(argv[2],nullptr,10)));- if(argc!=7&&argc!=8)return 2; // source, log directory, multiplier, admission, seconds, effects, optional minimum target ratio+ if(argc!=7&&argc!=8&&argc!=9)return 2; // optional target ratio, then live-1440p profile+ const bool liveProfile=argc==9&&std::wstring_view(argv[8])==L"live-1440p";+ if(argc==9&&!liveProfile)return 2;const unsigned multiplier=_wtoi(argv[3]);const int seconds=_wtoi(argv[5]);- const double minimumRatio=argc==8?_wtof(argv[7]):0;+ const double minimumRatio=argc>=8?_wtof(argv[7]):0;if((multiplier!=4&&multiplier!=6)||seconds<30||seconds>240)return 2;if(FAILED(CoInitializeEx(nullptr,COINIT_MULTITHREADED)))return 2;std::filesystem::create_directories(argv[2]);veyra::Logger::instance().openFile((std::filesystem::path(argv[2])/L"engine.log").wstring());veyra::Logger::instance().setConsoleEnabled(false);- RECT rect{0,0,2191,1187};AdjustWindowRect(&rect,WS_OVERLAPPEDWINDOW,FALSE);+ RECT rect{0,0,liveProfile?1795:2191,liveProfile?816:1187};AdjustWindowRect(&rect,WS_OVERLAPPEDWINDOW,FALSE);HWND window=CreateWindowExW(0,L"STATIC",L"DLSS sustained regression",WS_OVERLAPPEDWINDOW,0,0,rect.right-rect.left,rect.bottom-rect.top,nullptr,nullptr,GetModuleHandleW(nullptr),nullptr);if(!window){CoUninitialize();return 2;}@@ -35,6 +37,7 @@ int wmain(int argc,wchar_t** argv){const std::wstring_view effects=argv[6];settings.nr=effects==L"on"||effects==L"nr";settings.sr=effects==L"on"||effects==L"sr";+ if(liveProfile){settings.flow=FlowQuality::Performance;settings.videoSrQuality=0;settings.srTarget=veyra::pipeline::SrTarget::Uhd4K;}auto options=PlayerOptions::from(settings);const std::wstring source=argv[1];options.captureReplayForTest=!source.starts_with(L"capture:")&&!source.starts_with(L"capture2:");@@ -51,13 +54,16 @@ int wmain(int argc,wchar_t** argv){if(started!=Clock::time_point{}){const auto elapsed=int(std::chrono::duration_cast<std::chrono::seconds>(Clock::now()-started).count());if(elapsed>=seconds)break;- if(elapsed>=15&&!stalled){SetEnvironmentVariableW(L"VEYRA_TEST_VIDEO_WORK_MS",L"55");stalled=true;}+ if(elapsed>=15&&!stalled&&!liveProfile){SetEnvironmentVariableW(L"VEYRA_TEST_VIDEO_WORK_MS",L"55");stalled=true;}if(elapsed>=17&&!cleared){SetEnvironmentVariableW(L"VEYRA_TEST_VIDEO_WORK_MS",nullptr);cleared=true;beforeRecovery=s.generated;}if(elapsed!=reported){reported=elapsed;const auto& f=s.metrics.flow;const auto& c=f.counters;std::cout<<"t="<<elapsed<<" multiplier="<<s.applied.multiplier<<" frames="<<s.frames<<" generated="<<s.generated<<" sourceFps="<<f.sourceCompletedFps<<" submitFps="<<f.presentSubmitFps<<" validFps="<<f.validGeneratedFps<<" limited="<<s.fgBudgetLimited<<" skipped="<<c.fgSkippedBeforeEval<<" expired="<<c.generatedExpiredAfterEval+ <<" received="<<c.captureReceived<<" accepted="<<c.sourceAccepted<<" overwritten="<<c.mailboxOverwritten+ <<" evaluated="<<c.fgEvaluated<<" warmup="<<c.fgWarmup<<" realPresented="<<c.realPresented<<" generatedPresented="<<c.generatedPresented+ <<" ageP95Ms="<<s.captureAgeP95Ms<<" waitP95Ms="<<s.schedulingWaitP95Ms<<" presentMs="<<s.presentCpuP95Ms<<" slotMs="<<f.slotWaitPerFrameMs.value_or(-1);for(const auto stage:{veyra::diagnostics::GpuStage::Nr,veyra::diagnostics::GpuStage::Sr,veyra::diagnostics::GpuStage::Flow,veyra::diagnostics::GpuStage::FgBatch})std::cout<<" gpu"<<int(stage)<<"="<<f.gpuTiming[size_t(stage)].p95.value_or(-1);diff --git a/tests/integration/LivePresentationTests.cpp b/tests/integration/LivePresentationTests.cppindex cc608df6..211da264 100644--- a/tests/integration/LivePresentationTests.cpp+++ b/tests/integration/LivePresentationTests.cpp@@ -283,7 +283,7 @@ int wmain(int argc,wchar_t**argv){if(overload){check(until([](const auto& s){return s.frames>=150;},35),"native4K NR + VSR high + FG4 completes bounded overload replay");const auto s=engine.snapshot();const auto& c=s.metrics.flow.counters;- check(c.fgCandidate==c.fgEvaluated+c.fgSkippedBeforeEval&&c.presentationBatchHighWater<=2&&c.commandSlotHighWater<=6,"overload work accounting and resource bounds");+ check(c.fgCandidate==c.fgEvaluated+c.fgSkippedBeforeEval+c.fgSkippedForReset&&c.presentationBatchHighWater<=2&&c.commandSlotHighWater<=6,"overload work accounting and resource bounds");check(options.captureReplayDisableFgAdmissionForTest?c.fgSkippedBeforeEval==0:c.fgSkippedBeforeEval>0,"overload comparison uses requested admission policy");std::cout<<"OVERLOAD baseline="<<options.captureReplayDisableFgAdmissionForTest<<" frames="<<s.frames<<" processedFps="<<s.fps<<" realPresented="<<c.realPresented<<" generatedPresented="<<c.generatedPresented<<" expired="<<c.generatedExpiredAfterEval<<" skipped="<<c.fgSkippedBeforeEval<<" evaluated="<<c.fgEvaluated<<" ageP95Ms="<<s.captureAgeP95Ms<<std::endl;engine.stop();check(until([&](const auto&){return engine.idle();},5),"overload shutdown releases leases");DestroyWindow(window);CoUninitialize();return failures?1:0;@@ -311,7 +311,7 @@ int wmain(int argc,wchar_t**argv){const auto& flow=state.metrics.flow;check(flow.latest.sameWindow(state.sessionId,state.metrics.identity)&&flow.counters.fgEvaluated>0,"flow counters carry actual session, epoch and revision");check(flow.counters.commandSlotHighWater<=6&&flow.counters.presentationBatchHighWater<=2,"command and presentation queues remain bounded");- check(flow.counters.fgCandidate==flow.counters.fgSkippedBeforeEval+flow.counters.fgEvaluated,"each candidate is accounted before evaluate");+ check(flow.counters.fgCandidate==flow.counters.fgSkippedBeforeEval+flow.counters.fgEvaluated+flow.counters.fgSkippedForReset,"each candidate is accounted before evaluate");if(argc==4&&wcscmp(argv[3],L"--reset-rollback")==0){SetEnvironmentVariableW(L"VEYRA_TEST_REJECT_NR_DISABLE",L"1");settings=state.desired;settings.nr=false;engine.requestSettings(settings);diff --git a/tests/unit/LiveGpuSchedulerTests.cpp b/tests/unit/LiveGpuSchedulerTests.cppindex e0954d05..6eada2fa 100644--- a/tests/unit/LiveGpuSchedulerTests.cpp+++ b/tests/unit/LiveGpuSchedulerTests.cpp@@ -107,6 +107,16 @@ int main(){budget.complete(100,true,false,42200000,90);check(!budget.admit(42200000,42366667,0,1),"real steady GPU overload remains limited");}+ budget.reset();+ budget.complete(20.719,true,false,50000000,11);+ budget.complete(7,true,true,50000001,2);+ check(!budget.admit(50000002,50084552,1.217,.047),"observed 6X deadline rejects the full steady batch");+ check(budget.admit(50000002,50084552,1.217,.047,true),"measured single-call recovery fits without discounting steady MFG cost");+ check(budget.predicted(50000002)==20.719&&budget.predicted(50000002,true)==7,"recovery and steady costs remain independent");+ budget.complete(100,false,true,50000003);+ check(budget.predicted(50000003,true)==7,"rejected reset without FG cannot become a warmup timing sample");+ check(!budget.admit(50000002,49800002,1.217,.047,true),"cheap recovery cannot bypass an expired deadline");+ check(budget.predicted(60000002,true)==budget.predicted(60000002),"expired recovery measurement falls back to steady estimate");veyra::engine::LivePairLatency phase;check(phase.select(10000000,420000,333333,4)==420000,"unknown live readiness keeps legacy phase");for(int i=0;i<8;++i)phase.observe(10000000+i,370000);