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++
fix(fg): source-period XeSS timing, bounded skip history, DLSS reduced groups, display stats
Veyra Goal Agent37b377e6b0a1
diff --git a/docs/FG_EXPERIMENT_INDEX_2026-09-21.md b/docs/FG_EXPERIMENT_INDEX_2026-09-21.mdindex 8476f9ea..816e331c 100644--- a/docs/FG_EXPERIMENT_INDEX_2026-09-21.md+++ b/docs/FG_EXPERIMENT_INDEX_2026-09-21.md@@ -14,6 +14,11 @@| NVOF 与 Video SR 重叠 | 可执行入口已删除 | 未接受的历史候选;仅保留失败结论,避免重复尝试 || XeSS 真实源时间提示 | 代码仍在,VEYRA_TEST_XESS_SOURCE_TIMING 默认关闭 | 吞吐改善有重复证据,完整节奏、图像对应验收未完成,不能称修复完成 || XeSS fence / deadline 只读诊断 | 保留,追踪按诊断开关启用 | 用于区分依赖等待与截止时间等待,不是调度优化 |+| XeSS 文件播放 XeLL `bLowLatencyMode=0`(2026-09-22 X2) | 已撤回,仅 `VEYRA_TEST_XESS_LOW_LATENCY=0` 诊断开关 | 提供方 `SetEnabled` 返回 -15,补帧被拒;Intel 指南要求 XeLL 启用。不要再试 |+| XeSS/FSR 提供方 Present 移到辅助线程(2026-09-22 X3,单飞、fence 合同不变) | 代码已删除 | 真超分+NR+4X 源 51.0→23.8/s,GPU 95→44%,提供方周期估计 15.9→26.3 ms,组内 4.3→9.9 ms。owner 阻塞恰好锁定了源提交与提供方节奏;不改写提供方周期估计就解耦线程是负优化 |+| XeSS 真实源 PTS 间隔作 frameRenderTime(X1,已转正) | 默认开启,`VEYRA_DISABLE_XESS_SOURCE_TIMING=1` 对照 | 组内间隔 4.96→4.27 ms,Present 阻塞 p50 17.2→15.0 ms,源率不变 |+| 有界预览跳帧保留历史(F2) | 默认开启,`VEYRA_TEST_PREVIEW_SKIP_RESET=1` 对照 | 重置 177→1,原帧间隔 p95 26.8→22.2 ms,源率 53.5→50.8/s;肉眼待验收 |+| DLSS 超预算对改 2X 组(F3) | 默认开启,`VEYRA_TEST_FG_NO_REDUCED=1` 对照 | 见执行记录 §4.2 || 全局取消 DLSS admission / 无限制接纳晚到生成 | 可执行 A/B 入口已删除 | 既有采集测试约204.10降至184.76次提交/秒、过期和输入丢失增加;文件测试也严重回退,正式路径固定使用 admission |核查 src/include/tests 未发现前六项临时环境变量入口。@@ -39,6 +44,9 @@## 原始证据+- [独立修复执行记录 2026-09-22](FG_INDEPENDENT_REPAIR_EXECUTION_2026-09-22.md)+- [独立复核与方案 2026-09-22](FG_INDEPENDENT_REVIEW_2026-09-22.md)+- [非 NR 实验与回退](FG_NON_NR_EXPERIMENTS_2026-09-20.md)- [本轮 XeSS 实验、候选与逐次证据](FG_STABILITY_PROGRESS_2026-09-21.md)- [执行方案及有限实验要求](FG_STABILITY_COMPLETION_PLAN_2026-09-21.md)diff --git a/docs/FG_INDEPENDENT_REPAIR_EXECUTION_2026-09-22.md b/docs/FG_INDEPENDENT_REPAIR_EXECUTION_2026-09-22.mdnew file mode 100644index 00000000..dadde205--- /dev/null+++ b/docs/FG_INDEPENDENT_REPAIR_EXECUTION_2026-09-22.md@@ -0,0 +1,144 @@+# DLSS / XeSS 补帧独立修复执行记录++日期:2026-09-22。隔离分支 `codex/fg-independent-repair-20260922`,工作树+`E:/项目/Veyra/worktrees/fg-independent-repair-20260922`,开工存档+`checkpoint/pre-fg-independent-repair-20260922`(`c3f1ec8`)。方案见+[独立复核与修复方案](FG_INDEPENDENT_REVIEW_2026-09-22.md)。本记录只包含本机+RTX 5070 / 驱动 32.0.16.1656 / 100 Hz 显示器上的 30 秒短测;120 秒以上长测、+其他显卡、采集卡和肉眼画质由用户验收,本文不宣称这些已通过。++产物根目录:`E:/项目/Veyra/tests/fg-independent-repair-20260922/`(`app/` 为研发+staging,运行库/shader 为 junction 到既有受控目录,不是便携包);构建+`E:/项目/Veyra/build/fg-independent-repair-20260922/`;日志+`E:/项目/Veyra/logs/fg-independent-repair-20260922/`;临时+`E:/项目/Veyra/tmp/fg-independent-repair-20260922/`。++## 1. 保留的产品改动++| 编号 | 改动 | 位置 | 对照开关(仅诊断) |+| --- | --- | --- | --- |+| X1 | XeSS `frameRenderTime` 默认传真实相邻源 PTS 间隔(历史有效、身份递增、PTS 递增、0.125–500 ms),重置/重复仍传 0;有界跳帧后身份可跨 2–3 帧 | `VideoPresenter.cpp` XeSS tag 段 | `VEYRA_DISABLE_XESS_SOURCE_TIMING=1` 恢复传 0 |+| F2 | 预览跳帧 ≤2 帧且无源断点时不再清 NR/XeSS/DLSS 历史(epoch 不递增,A 仍是上一处理帧的真实 PTS);>2 帧或任何断点标志仍完整重置 | `EngineController.cpp` `boundedSkip` | `VEYRA_TEST_PREVIEW_SKIP_RESET=1` 恢复无条件重置 |+| F3 | DLSS 文件路径:整组超预算但"基础工作 + 一次首帧插值"能赶上中点时,评估 2X 组并保留历史(`FgDecision::Reduced`),UI `previewFgMultiplier=2`;否则沿用播种/跳过 | `FgRecoveryBudget::canAdmitReduced`、`EnhanceGraph::process`、文件准入 lambda | `VEYRA_TEST_FG_NO_REDUCED=1` 恢复整组丢弃 |+| F4 | 交换链创建时记录显示器刷新率;每秒 `GetFrameStatistics` 差分记录 presents / displayed / refreshes / notDisplayed | `PresentSink::sampleFrameStatistics`,日志 `display-stats` | `VEYRA_TEST_NO_DISPLAY_STATS=1` |+| 诊断 | `fg_harness --fg-planar-alt`:multiFrameCount 5/1/5 交替不重置 | `tools/fg_harness` | — |+| 诊断 | `scripts/acceptance/fg-independent-ab.py`:按环境变量变体串行调用既有矩阵脚本并汇总 | 脚本 | — |++## 2. 尝试后撤回++| 编号 | 尝试 | 结果 | 处理 |+| --- | --- | --- | --- |+| X2 | 文件播放 XeLL `bLowLatencyMode=0` | `xefgSwapChainSetEnabled` 返回 -15(LATENCY_REDUCTION_UNSUPPORTED),提供方拒绝生成;Intel 指南明确"XeLL 未启用则关闭补帧" | 默认保持 1;保留 `VEYRA_TEST_XESS_LOW_LATENCY=0` 诊断开关 |+| X3 | 提供方 `Present` 移到辅助线程(单飞、fence 合同不变、owner 在 pending 时让出) | 真超分+NR+4X:源 51.0→23.8/s,GPU 94.9%→43.9%,`gpuReadyP95` 20→66 ms,组内间隔 4.3→9.9 ms;trace 显示提供方 `Present` 内阻塞变为 p50 44 ms,其周期环中位数从 15.9 ms 爬到 26 ms | 代码全部移除,不留开关。原因见 §4.3 |++## 3. 门槛测试(本机)++| 测试 | 结果 | 证据 |+| --- | --- | --- |+| 构建 veyra + 4 个 FG 测试 + harness + scheduler 单测 | exit 0 | `logs/.../build7.log` |+| `veyra_presentation_worker_tests`(含新增 6 项 reduced 预算断言) | 127 PASS / 0 FAIL | `tests/.../unit-scheduler.log` |+| `veyra_fg_presentation_tests`(4X→6X→4X、resize、fence 复用) | exit 0,D3D12 errors=0 | `fg-presentation2.log` |+| `veyra_fg_settings_tests backend-switch`(XeSS4→DLSS4→XeSS4→XeSS2→XeSS4→DLSS6→XeSS4) | 16 PASS / 0 FAIL | `settings2-backend-switch.log` |+| `fg_harness --fg-planar6` | 55/55 独立输出,位置通过 33/55(sub2/sub5 系统性偏差,与既有 6X 位置误差记录一致,非本轮引入) | `harness/planar6.log` |+| `fg_harness --fg-planar-alt` | 35/35 独立输出,group=1 中点 5/5 精确 8.0 px,group=5 各 sub 与固定模式逐项一致;无 disabled | `harness/planar-alt.log` |++harness 结论:NGX MFG 在不重置的情况下逐对切换 `multiFrameCount` 5↔1,输出有效且+位置正确。这是 F3 的前置条件。++## 4. 短测结果(30 秒,全屏 2560×1440,统计 10–29 秒)++### 4.1 XeSS 4X,1080p→4K Video SR + 实时 NR(重负载)++`ab-xess4-sr/`(同一构建,仅环境变量不同,串行运行):++| 变体 | 源/s | 生成/s | epoch | 呈现原帧间 epoch 变化 | 组内间隔 | Present 阻塞 p50/p95 | 原帧间隔 p95 | GPU |+| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |+| baseline(传 0,跳帧重置) | 53.6 | 141.2 | 177 | 90 | 4.96 ms | 17.2 / 17.9 | 29.1 | 95.5% |+| x1(真实周期,跳帧重置) | 53.5 | 141.0 | 182 | 92 | 4.27 ms | 15.0 / 17.0 | 26.8 | 95.1% |+| full(x1 + F2) | 50.8 | 152.3 | 1 | 0 | 4.33 ms | 13.5 / 15.9 | 22.2 | 94.9% |++同日早晨的旧构建(`bounded-repair` exe)在同一会话中重跑:源 41.9/s,生成 94.3/s,+组内 8.16 ms,Present 阻塞 p50 20.8 ms,GPU 70.2%。早晨原始对照为 39.3/s、72%。++解读:+- 本轮三个变体源率都在 50–54/s,均高于旧构建的 39–42/s,而它们与旧构建的差别不只+ X1/F2(构建、F4 采样、harness 汇总也不同)。**X1 本身在 baseline→x1 中未改变源率**,+ 改变的是组内间隔(4.96→4.27 ms)和 Present 阻塞(17.2→15.0 ms)。旧构建在同一会话+ 重跑仍是 42/s、8.2 ms 组内,因此差异不是环境漂移。+- F2 把重置次数从 177 降到 1;呈现原帧间隔 p95 从 26.8 降到 22.2 ms。代价是源率+ 53.5→50.8/s(跳帧从 178 增至 250):不重置后每帧都做完整 4X 生成(生成/s 反而上升),+ GPU 时间被生成占用。这是"更多生成、稍少原帧"的取舍,画面对应尚未肉眼验收。+- F4:100 Hz 显示器上每秒 displayed≈101、notDisplayed=0。应用侧 Present 全部被扫描出,+ 组内生成帧由提供方内部 Present,不在此计数。显示端在本机没有丢弃应用提交。++### 4.1b XeSS 重复性(`ab4-xess-final/`,同一构建,稍后串行重跑)++| 变体 / 工况 | 源/s | 生成/s | epoch | 组内间隔 | Present 阻塞 p50/p95 | 原帧间隔 p95 | GPU |+| --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |+| baseline / SR+NR 4X | 38.0 | 85.5 | 263 | 8.76 ms | 11.5 / 29.4 | 41.6 | 72.8% |+| full / SR+NR 4X | 45.4 | 136.1 | 1 | 4.77 ms | 12.8 / 16.4 | 26.5 | 95.5% |+| baseline / 原生 4K+NR 4X | 59.2 | 175.1 | 20 | 4.25 ms | 11.9 / 14.4 | 17.8 | 94.4% |+| baseline / SR+NR 2X | 59.9 | 59.9 | 1 | — | 10.4 / 11.0 | 17.4 | 95.0% |++同一构建的 baseline 变体两次结果差异很大(53.6 vs 38.0 源/s;组内 4.96 vs 8.76 ms)。+这与早晨旧构建的两次(39.3、41.9)一起说明:**传 0 的旧路径存在两个稳态**,取决于+提供方在启动几秒内把周期估计锁在约 16 ms 还是约 21–25 ms(`xess-pacing` 前几行的+ring median 分别为 14.3→20.7 ms 和 0→16.8→25.6 ms)。锁在高值后 GPU 只有 72%、+组内 8.7 ms、源 38/s,即用户报告的"GPU 未满却卡顿"形态;锁在低值时接近满速。+X1 的两次 full 结果为 51.0 和 45.4 源/s,组内都在 4.3–4.8 ms、GPU 95%,没有进入+高值稳态。这是 X1 的主要价值:消除双稳态而不是提高峰值;但两次 45–51 的差异说明+30 秒短测不足以给出精确均值,长测由用户执行。++### 4.2 DLSS(F3 reduced 组)++`ab3-dlss/`,同一构建,`noreduced` = `VEYRA_TEST_FG_NO_REDUCED=1` 对照:++| 工况 | 变体 | 提交/s | 间隔 >16.667 ms | 间隔 p95 / p99 / max (ms) | 每对有效生成分布 | 拒绝对 | 播种评估 | reduced 对 | 过期生成 |+| --- | --- | ---: | ---: | --- | --- | ---: | ---: | ---: | ---: |+| 原生 4K+NR 6X | noreduced | 238.4 | 73 / 1460 | 16.67 / 17.01 / 17.73 | 5×219,0×149 | 654 | 657 | 0 | 12 |+| 原生 4K+NR 6X | full | 237.1 | **3** / 1481 | **8.53** / 8.81 / 16.94 | 5×185,1×185,0×6 | 838 | 25 | 790 | 6 |+| 1080→4K SR+NR 6X | noreduced | 121.2 | 194 / 1041 | 16.94 / 17.08 / 17.32 | 5×105,0×411 | 1302 | 1314 | 0 | 7 |+| 1080→4K SR+NR 6X | full | 115.7 | 155 / 1043 | 16.92 / 17.07 / 17.95 | 5×84,1×84,0×374 | 1213 | 956 | 269 | 8 |+| 原生 4K+NR 2X | noreduced | 120.0 | 0 | 8.79 / 9.26 / 9.91 | 1×585 | 0 | 1 | 0 | 1 |+| 原生 4K+NR 2X | full | 120.0 | 0 | 8.78 / 9.04 / 9.69 | 1×585 | 0 | 1 | 0 | 2 |++解读:+- 原生 6X 的"5,5,5,0"周期性空档被 2X 组替代:提交率不变,超过一个源周期的空档从 73+ 降到 3,p95 从 16.7 ms 降到 8.5 ms。播种评估从 657 降到 25,说明此前 24% 的对在+ 做"评估却不呈现"的预热,现在同样的一次评估产出可呈现的中点帧。`fgInvalid` 为 0。+ 用户看到的会是交替 6X/2X 的组,UI 已按 `previewFgMultiplier=2` 提示当前对。+- 真超分 6X 每对约 24 ms,基础工作已超过 8.3 ms 的中点,多数拒绝对连 2X 都赶不上+ (0×374),只有 269 对能用 reduced。空档 194→155,是有限改善;这部分仍是性能上限。+- 2X 不受影响(同一路径不触发 reduced)。+- F4:原生 6X 每秒提交 241 次、显示 100 次、未显示 141 次,与 100 Hz 显示器一致;+ 未显示分布 p50 140 / p95 151,与 noreduced 的 140 / 151 相同。++### 4.3 X3 为什么失败++trace(`async-trace/sr-nr-xess4/`,20 s,`VEYRA_TEST_TRACE_XESS=1`):owner 的+`Present` 阻塞降到 p50 0.27 ms(目标达到),但提供方内部 `XessPresent` 变为 p50 44 ms,+`ProviderDeadline` 从 4 ms 升到 11 ms,周期环中位数 15.9→26.3 ms。提供方在非 Intel+GPU 上用它自己的高优先级线程节奏,并以观察到的 present 到达间隔估计周期;owner 不再+被阻塞后立刻读下一源帧,源之间的处理成本(SR+NR+流约 12 ms)加上 XeLL sleep 使提供方+看到更长且更不规则的到达间隔,估计周期放大,组内间隔从 4.3 拉到 9.9 ms,owner 又在+`gpuReady`(等 GPU 就绪)处等待 65 ms。结论:在这个提供方上,"owner 被 Present 阻塞"+恰好起到了把源提交节奏锁到提供方输出节奏的作用;去掉阻塞需要同时替代提供方的周期估计+(Magpie 改写时间戳的做法),单独解耦线程是负优化。已从代码删除。++## 5. 判定与停止条件++- X1:保留。组内间隔回到 4.2–4.3 ms 且不降源率。+- F2:保留,但需用户在长测和肉眼上确认无新增拖影;若快速运动场景出现可见拖影,+ 把上限从 2 帧降到 1 帧(`previewSkippedSinceSubmit<=1`)或撤回。+- F3:保留。原生 6X 长空档 73→3 且无 `fgInvalid`;真超分 6X 仅小幅改善,剩余属上限。+- F4:保留(只读诊断)。+- X2、X3:撤回,记入实验索引,不再重试同形态。++## 6. 未做与边界++- 未做 120 秒以上长测、采集卡、PS5、RTX 30/40/5090、多显示器、HDR。+- 未做像素级 C 实验(合成素材的亮度脉冲),F2 的"闪烁消失"只在 epoch 计数层面成立。+- XeSS 重负载 4X 在本机仍不到 60 源帧/s(50–54),剩余差距是 SR+NR+流约 12 ms 加+ Present 阻塞约 14 ms 的串行成本,属于当前架构下的上限;进一步需要改写提供方时间戳+ 或减少每帧 GPU 工作,本轮未授权。+- 未打包、未合并 main、未推送、未发布。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex 72b5b1b8..514ddd01 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1,5 +1,20 @@# Veyra 工作记录+## 2026-09-22 DLSS/XeSS 补帧独立修复(隔离分支,短测)++分支 `codex/fg-independent-repair-20260922`,存档 `checkpoint/pre-fg-independent-repair-20260922`。+按独立复核方案实施并短测:X1 XeSS 真实源周期 frameRenderTime 转正;F2 有界预览跳帧+(≤2 帧)不再清 NR/XeSS/DLSS 历史;F3 DLSS 超预算对改为可呈现的 2X 组(harness+5/1/5 交替不重置验证位置正确);F4 记录显示器刷新率与 GetFrameStatistics 差分。+X2(XeLL 关低延迟)被提供方 -15 拒绝,撤回;X3(提供方 Present 移到辅助线程)+使源率 51→24/s、提供方周期估计 16→26 ms,已从代码删除。+真超分+NR+XeSS4 短测:源 50.8/s、生成 152/s、历史重置 177→1、原帧间隔 p95 29→22 ms,+组内 4.3 ms;同会话旧构建 41.9/s、8.2 ms。显示端 100 Hz 上应用提交全部被扫描出。+门槛:scheduler 单测 127 PASS,FG 呈现测试 D3D12 errors=0,backend-switch 16 PASS。+完整数字、撤回原因与边界见 [执行记录](FG_INDEPENDENT_REPAIR_EXECUTION_2026-09-22.md);+产物在 `E:/项目/Veyra/{tests,build,logs,tmp}/fg-independent-repair-20260922/`。+长测、其他显卡、采集卡与肉眼画质由用户验收;未打包、未合并、未推送、未发布。+## 2026-09-22 DLSS/XeSS 补帧独立复核(只出方案)独立于此前结论重读源码、六组 XeSS 4X 对照日志/trace 与有界修复 DLSS 矩阵。diff --git a/include/veyra/diagnostics/FrameMetrics.h b/include/veyra/diagnostics/FrameMetrics.hindex f1e6605c..a2d2c375 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,fgSkippedForReset=0;+ uint64_t fgCandidate=0,fgEvaluated=0,fgSkippedBeforeEval=0,fgReadyValid=0,fgInvalid=0,fgWarmup=0,fgSkippedForReset=0,fgReduced=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 ea4ff765..111d7c95 100644--- a/include/veyra/engine/FgRecoveryBudget.h+++ b/include/veyra/engine/FgRecoveryBudget.h@@ -88,6 +88,17 @@ public:// admit a whole MFG group whose early outputs are already doomed.return recordAdmission(fits(firstDeadline,*base+*firstFgMs)&&fits(lastDeadline,*whole));}+ // Reduced-group affordability: base work plus ONE measured first+ // interpolation must reach the pair midpoint. Does not touch recovery+ // state; the caller decides between Reduced and Seed/Skip.+ bool canAdmitReduced(int64_t now,int64_t midpointDeadline,int64_t outputInterval,double elapsed,double present,std::optional<double> firstFgMs,double queuedMs)const{+ const auto base=baseCost(now);+ if(!base||!firstFgMs||!std::isfinite(*firstFgMs)||*firstFgMs<0)return false;+ const double queued=std::isfinite(queuedMs)?std::max(0.0,queuedMs):0.0;+ const double progress=std::clamp(elapsed,0.0,queued+*base);+ const double grace=double(std::max<int64_t>(0,outputInterval))/10000;+ return double(midpointDeadline-now)/10000+grace>=std::max(0.0,queued+*base+*firstFgMs-progress)+std::max(0.0,present);+ }bool recovering()const{return limited_&&recoveryPairs_>0;}};}diff --git a/include/veyra/engine/VideoPresenter.h b/include/veyra/engine/VideoPresenter.hindex 5ddc7e73..6742ac71 100644--- a/include/veyra/engine/VideoPresenter.h+++ b/include/veyra/engine/VideoPresenter.h@@ -15,9 +15,17 @@ namespace veyra::engine {class VideoPresenter {public:~VideoPresenter(){close();}- bool open(gfx::D3D12DeviceContext&, HWND, pipeline::EnhanceGraph&, bool captureCompatible=false);+ // mediaClockPaced: the owner already waits on a media clock before each+ // source (file playback). Retained for diagnostics; XeLL low latency must+ // stay enabled or the provider refuses generation (result -15).+ bool open(gfx::D3D12DeviceContext&, HWND, pipeline::EnhanceGraph&, bool captureCompatible=false, bool mediaClockPaced=false);bool present(gfx::D3D12DeviceContext&,gfx::CommandSlotRing&,pipeline::EnhanceGraph&,unsigned slot,bool generated,bool referencesValid=true,int comparison=0,bool baseReference=false,float split=.5f,pipeline::FrameIdentity identity={},PreviewView view={},int64_t sourcePts100ns=-1);void close();+ // Present-sink providers (XeSS/FSR) block inside Present while pacing+ // their generated frames. A helper-thread Present was tried on+ // 2026-09-22 (X3): the provider then estimated its period from the+ // longer hand-off intervals and the source rate fell 51 -> 24/s at 44%+ // GPU. The synchronous call stays; see FG_INDEPENDENT_REPAIR_EXECUTION.bool beginSourceInput();bool beginSourceProcessing();void sourceProcessed(pipeline::FrameIdentity);diff --git a/include/veyra/gfx/PresentSink.h b/include/veyra/gfx/PresentSink.hindex ca353c4c..01fe1f9a 100644--- a/include/veyra/gfx/PresentSink.h+++ b/include/veyra/gfx/PresentSink.h@@ -53,6 +53,9 @@ public:// Requested frame-generation multiplier (2 = one generated frame).// Only the XeSS path consumes it today; >2 requires the provider unlock.uint32_t fgMultiplier = 1;+ // XeLL low-latency sleep on the source-input thread. Must stay true+ // for generation (provider returns -15 otherwise); diagnostic toggle.+ bool xessLowLatencySleep = true;// Probe runs create their own window class name per process.std::wstring title = L"Veyra";HWND targetWindow = nullptr; // borrowed UI-owned child HWND; never destroyed by sink@@ -79,6 +82,20 @@ public:HRESULT result=S_OK;};const PresentTiming& lastPresentTiming()const{return presentTiming_;}+ // Display-side evidence: DXGI frame statistics deltas since the previous+ // sample. presents = successful Present calls in the window; refreshes =+ // vertical refreshes elapsed (SyncRefreshCount); displayed = refreshes at+ // which a NEW presented frame was scanned out (PresentRefreshCount delta).+ // presents - displayed = submissions that never reached the screen (with+ // tearing/vsync off, dropped by flip). Unsupported (proxy swapchain or+ // pre-first-present) leaves supported=false; nothing is invented.+ struct FrameStatisticsDelta {+ bool supported=false;+ uint64_t presents=0,displayed=0,refreshes=0;+ HRESULT result=S_OK;+ };+ FrameStatisticsDelta sampleFrameStatistics();+ double displayRefreshHz()const{return displayRefreshHz_;}bool configurePacing(bool enabled,bool vsync);bool presentationReady();bool pacingActive()const{return pacing_;}@@ -141,6 +158,10 @@ private:HANDLE latencyHandle_=nullptr;bool pacing_=false,capacityAcquired_=false;PresentTiming presentTiming_{};+ double displayRefreshHz_=0;+ bool frameStatisticsBaseValid_=false;+ uint64_t frameStatisticsBasePresents_=0;+ UINT frameStatisticsBasePresentRefresh_=0,frameStatisticsBaseSyncRefresh_=0;};} // namespace veyra::gfxdiff --git a/include/veyra/gfx/XessPresenter.h b/include/veyra/gfx/XessPresenter.hindex 3aa4df07..c86a3efb 100644--- a/include/veyra/gfx/XessPresenter.h+++ b/include/veyra/gfx/XessPresenter.h@@ -12,7 +12,11 @@ public:~XessPresenter();// fgMultiplier is the requested output multiplier (2 = one generated frame,// 3 = two, 4 = three). >2 requires the audited provider unlock.- bool initialize(ID3D12Device*,ID3D12CommandQueue*,IDXGIFactory2*,HWND,const DXGI_SWAP_CHAIN_DESC1&,IDXGISwapChain3**,uint32_t fgMultiplier=1);+ // lowLatencySleep: XeLL bLowLatencyMode. File playback already paces its+ // inputs by the media clock (an application frame limiter, which Intel's+ // XeLL guide says should not run together with XeLL sleep); keep the XeLL+ // markers and sleep call but let pass-through mode make the sleep trivial.+ bool initialize(ID3D12Device*,ID3D12CommandQueue*,IDXGIFactory2*,HWND,const DXGI_SWAP_CHAIN_DESC1&,IDXGISwapChain3**,uint32_t fgMultiplier=1,bool lowLatencySleep=true);uint32_t beginInput();bool beginProcessing(uint32_t frameId);bool endProcessing(uint32_t frameId);diff --git a/include/veyra/pipeline/EnhanceGraph.h b/include/veyra/pipeline/EnhanceGraph.hindex 5efd3ea5..00565183 100644--- a/include/veyra/pipeline/EnhanceGraph.h+++ b/include/veyra/pipeline/EnhanceGraph.h@@ -153,7 +153,7 @@ public:struct FrameOutputs {FrameBatch batch;uint32_t fgCandidates=0,fgEvaluated=0,fgSkippedBeforeEval=0,fgSkippedForReset=0;- bool historyReset=false,fgRecovery=false,fgBudgetSeed=false;+ bool historyReset=false,fgRecovery=false,fgBudgetSeed=false,fgReduced=false;ResetReason detectedReset=ResetReason::None;bool contentDuplicate=false;int measuredContentRate=0;double ptsMs = 0.0;@@ -177,7 +177,12 @@ 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).- enum class FgDecision { Skip, Evaluate, Seed };+ // Reduced: the full group does not fit its deadline but one midpoint+ // frame does. Run a presentable 2X group WITHOUT resetting history+ // (fg_harness --fg-planar-alt verified 5/1/5 alternation keeps correct+ // interpolation positions). The pair keeps its true A/B PTS; only the+ // number of outputs changes, and it is reported as previewFgMultiplier.+ enum class FgDecision { Skip, Evaluate, Seed, Reduced };using FgAdmission=std::function<FgDecision(const FrameBatch&,bool warmingHistory)>;// `hardwareSurface` carries the decoded texture for paths whose surface// does not travel inside the AVFrame (D3D11VA). It must be provided exactlydiff --git a/scripts/acceptance/fg-independent-ab.py b/scripts/acceptance/fg-independent-ab.pynew file mode 100644index 00000000..4e9371a3--- /dev/null+++ b/scripts/acceptance/fg-independent-ab.py@@ -0,0 +1,193 @@+#!/usr/bin/env python3+"""Short A/B matrix for the 2026-09-22 independent FG repair.++Runs the existing fg-utilization-matrix harness (unchanged) in fullscreen view+for a set of named variants that differ only in environment toggles, then+summarises source/generated rates, history resets, present blocking and the+new display-stats line from each app.log. It never edits product files.++Variants (environment differences only):+ baseline : VEYRA_DISABLE_XESS_SOURCE_TIMING=1 VEYRA_TEST_PREVIEW_SKIP_RESET=1 (old behaviour)+ x1 : source timing on, skip resets on+ full : source timing on, bounded skip keeps history+ (X2 XeLL pass-through was withdrawn: provider returns -15 without XeLL.)+"""+import argparse+import json+import os+import re+import runpy+import statistics+import subprocess+import sys+from pathlib import Path++VARIANTS = {+ "baseline": {"VEYRA_DISABLE_XESS_SOURCE_TIMING": "1", "VEYRA_TEST_PREVIEW_SKIP_RESET": "1", "VEYRA_TEST_SYNC_PROVIDER_PRESENT": "1", "VEYRA_TEST_FG_NO_REDUCED": "1"},+ "x1": {"VEYRA_TEST_PREVIEW_SKIP_RESET": "1", "VEYRA_TEST_SYNC_PROVIDER_PRESENT": "1", "VEYRA_TEST_FG_NO_REDUCED": "1"},+ "x1f2": {"VEYRA_TEST_SYNC_PROVIDER_PRESENT": "1", "VEYRA_TEST_FG_NO_REDUCED": "1"},+ "sync": {"VEYRA_TEST_SYNC_PROVIDER_PRESENT": "1"},+ "noreduced": {"VEYRA_TEST_FG_NO_REDUCED": "1"},+ "full": {},+}+CLEAR = ("VEYRA_DISABLE_XESS_SOURCE_TIMING", "VEYRA_TEST_XESS_LOW_LATENCY", "VEYRA_TEST_PREVIEW_SKIP_RESET", "VEYRA_TEST_SYNC_PROVIDER_PRESENT", "VEYRA_TEST_FG_NO_REDUCED")+++def dist(values):+ if not values:+ return None+ v = sorted(values)+ n = len(v)+ return {"n": n, "mean": round(statistics.mean(v), 3), "p50": round(v[n // 2], 3),+ "p95": round(v[min(n - 1, int(n * .95))], 3), "p99": round(v[min(n - 1, int(n * .99))], 3), "max": round(v[-1], 3)}+++def summarise(case_dir: Path, seconds: int):+ log = (case_dir / "app.log").read_text(encoding="utf-8", errors="replace")+ lines = log.splitlines()+ first = None+ counters = []+ for line in lines:+ m = re.match(r"(\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d+)Z", line)+ if not m:+ continue+ stamp = m.group(1)+ if first is None:+ first = stamp+ if "[xess-fg] presentId=" in line:+ kv = dict(re.findall(r"(\w+)=(-?[\d.]+)", line))+ counters.append((stamp, int(kv["presentId"]), int(kv["generatedTotal"])))+ out = {"case": case_dir.name}+ import datetime as dt++ def secs(stamp):+ return (dt.datetime.fromisoformat(stamp) - dt.datetime.fromisoformat(first)).total_seconds()++ window = [c for c in counters if 10 <= secs(c[0]) <= seconds - 1]+ if len(window) >= 2:+ span = secs(window[-1][0]) - secs(window[0][0])+ out["xessSourcePerSec"] = round((window[-1][1] - window[0][1]) / span, 3)+ out["xessGeneratedPerSec"] = round((window[-1][2] - window[0][2]) / span, 3)+ out["counterWindowSeconds"] = round(span, 3)+ closed = next((l for l in reversed(lines) if "[frame-flow] state=closed" in l), "")+ kv = dict(re.findall(r"(\w+)=(-?[\d.]+)", closed))+ for key in ("epoch", "sourceAccepted", "realPresented", "generatedPresented", "fgEvaluated", "fgSkippedBeforeEval",+ "fgSkippedForReset", "fgWarmup", "fgReduced", "fgReadyValid", "generatedExpiredAfterEval", "cancelledBeforePresent", "slotWaitCount"):+ if key in kv:+ out[key] = float(kv[key]) if "." in kv[key] else int(kv[key])+ timing = [dict(re.findall(r"(\w+)=([^ ]+)", l)) for l in lines if "[player-timing]" in l]+ if timing:+ t = timing[-1]+ for key in ("previewSkipped", "expiredGenerated", "gpuReadyP95Ms", "presentP95Ms", "gpuSrP95Ms", "gpuNrP95Ms", "gpuFgBatchP95Ms", "playbackSpeed"):+ if key in t:+ out[key] = float(t[key])+ out["previewSkipRetainedLogLines"] = sum("[preview-skip]" in l for l in lines)+ out["xessFgGateEvents"] = sum("[xess-fg-gate]" in l for l in lines)+ out["engineStallLines"] = sum("[engine-stall]" in l for l in lines)+ out["asyncProviderPresent"] = any("helper thread" in l for l in lines)+ out["errorLines"] = sum("[ERROR]" in l for l in lines)+ adm = [l for l in lines if "[live-fg-admission]" in l and "reduced=" not in l]+ if adm:+ kv = dict(re.findall(r"(\w+)=(-?[\d.]+)", adm[-1]))+ out["admittedPairs"] = int(kv.get("admittedPairs", 0)); out["rejectedPairs"] = int(kv.get("rejectedPairs", 0)); out["predictedMs"] = float(kv.get("predictedMs", 0))+ red = [l for l in lines if "reduced=2X" in l]+ if red:+ kv = dict(re.findall(r"(\w+)=(-?[\d.]+)", red[-1])); out["reducedPairs"] = int(kv.get("reducedPairs", 0))+ pacing = [l for l in lines if "[xess-pacing] multiplier=" in l]+ if pacing:+ m = re.search(r"inBurstGaps=(\d+) mean=([\d.]+)ms min=([\d.]+)ms max=([\d.]+)ms", pacing[-1])+ if m:+ out["xessInBurstGapMs"] = {"mean": float(m.group(2)), "min": float(m.group(3)), "max": float(m.group(4))}+ xell = next((l for l in lines if "XeLL bLowLatencyMode=" in l), "")+ m = re.search(r"bLowLatencyMode=(\d)", xell)+ out["xellLowLatency"] = int(m.group(1)) if m else None+ stats = []+ for l in lines:+ if "[display-stats]" in l and "refreshHz=" in l:+ stats.append(dict(re.findall(r"(\w+)=(-?[\d.]+)", l)))+ if stats:+ out["displayRefreshHz"] = float(stats[0]["refreshHz"])+ out["displayStatsSamples"] = len(stats)+ out["displayed"] = dist([float(s["displayed"]) for s in stats])+ out["presents"] = dist([float(s["presents"]) for s in stats])+ out["notDisplayed"] = dist([float(s["notDisplayed"]) for s in stats])+ out["refreshesWithoutNewFrame"] = dist([float(s["refreshesWithoutNewFrame"]) for s in stats])+ else:+ unavailable = next((l for l in lines if "[display-stats] unavailable" in l), None)+ out["displayStats"] = "unavailable: " + unavailable[-60:] if unavailable else "no samples"+ trace = case_dir / "trace.txt"+ if trace.exists():+ ev = []+ for line in trace.read_text(encoding="utf-8", errors="replace").splitlines():+ if line.startswith("event="):+ ev.append(dict(kv.split("=", 1) for kv in line.split() if "=" in kv))+ pres = [e for e in ev if e["event"] == "Present"]+ if len(pres) > 2:+ hosts = [int(e["presentEndHost"]) for e in pres]+ gaps = [(hosts[i] - hosts[i - 1]) / 1e4 for i in range(1, len(hosts))]+ out["tracePresents"] = len(pres)+ out["traceSubmitPerSec"] = round((len(pres) - 1) * 1e7 / (hosts[-1] - hosts[0]), 3)+ out["presentReturnGapMs"] = dist(gaps)+ out["gapsOver16_667ms"] = sum(g > 16.667 for g in gaps)+ out["presentBlockMs"] = dist([(int(e["presentEndHost"]) - int(e["presentBeginHost"])) / 1e4 for e in pres])+ ep = [e["epoch"] for e in pres]+ out["epochChangesBetweenPresents"] = sum(1 for i in range(1, len(ep)) if ep[i] != ep[i - 1])+ ready = [int(e["count"]) for e in ev if e["event"] == "Ready"]+ if ready:+ from collections import Counter+ out["validGeneratedPerBatch"] = dict(Counter(ready))+ return out+++def main():+ ap = argparse.ArgumentParser()+ ap.add_argument("--exe", type=Path, required=True)+ ap.add_argument("--native", type=Path, required=True)+ ap.add_argument("--derived", type=Path, required=True)+ ap.add_argument("--output", type=Path, required=True)+ ap.add_argument("--temp", type=Path, required=True)+ ap.add_argument("--harness", type=Path, required=True, help="scripts/acceptance/fg-utilization-matrix.py")+ ap.add_argument("--variants", nargs="+", default=list(VARIANTS))+ ap.add_argument("--cases", nargs="+", default=["sr-nr-xess4"])+ ap.add_argument("--seconds", type=int, default=30)+ ap.add_argument("--view", default="fullscreen")+ ap.add_argument("--summarise-only", action="store_true")+ args = ap.parse_args()+ args.output.mkdir(parents=True, exist_ok=True)+ summary = {}+ for variant in args.variants:+ vout = args.output / variant+ if not args.summarise_only:+ env = dict(os.environ)+ for k in CLEAR:+ env.pop(k, None)+ env.update(VARIANTS[variant])+ # Same in-process view override as the 2026-09-22 comparison: the+ # harness hardcodes pro view; swap the argument after --smoke-view.+ real_popen = subprocess.Popen++ def popen(argv, *a, **kw):+ argv = list(argv)+ if "--smoke-view" in argv:+ argv[argv.index("--smoke-view") + 1] = args.view+ kw["env"] = {**kw.get("env", {}), **{k: v for k, v in env.items() if k in VARIANTS[variant] or k in CLEAR}}+ for k in CLEAR:+ if k not in VARIANTS[variant]:+ kw["env"].pop(k, None)+ return real_popen(argv, *a, **kw)++ subprocess.Popen = popen+ sys.argv = [str(args.harness), "--exe", str(args.exe), "--native", str(args.native), "--derived", str(args.derived),+ "--output", str(vout), "--temp", str(args.temp), "--cases", *args.cases, "--seconds", str(args.seconds)]+ try:+ runpy.run_path(str(args.harness), run_name="__main__")+ finally:+ subprocess.Popen = real_popen+ summary[variant] = {"environment": VARIANTS[variant], "view": args.view,+ "cases": {c: summarise(vout / c, args.seconds) for c in args.cases if (vout / c / "app.log").exists()}}+ (args.output / "summary.json").write_text(json.dumps(summary, indent=1), encoding="utf-8")+ print(json.dumps(summary, indent=1))+++if __name__ == "__main__":+ main()diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cppindex 596d8294..027b6864 100644--- a/src/engine/EngineController.cpp+++ b/src/engine/EngineController.cpp@@ -54,7 +54,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={} 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)));+ 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={} fgReduced={} 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.fgReduced,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);}@@ -325,7 +325,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sbool opened=graph.initialize(desc);auto failure=graph.failedBackend();if(opened){- opened=presenter.open(ctx,window,graph,selected.settings.captureCompatible)&&graph.createViews();+ opened=presenter.open(ctx,window,graph,selected.settings.captureCompatible,!isCapture&&!isImage)&&graph.createViews();failure=FailedBackend::Infrastructure;if(opened&&graph.xessEnabled()&&!presenter.xessActive()){opened=false;failure=FailedBackend::Fg;}if(opened&&graph.fsrEnabled()&&!presenter.fsrActive()){opened=false;failure=FailedBackend::Fg;}@@ -468,7 +468,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s// master clock; FG admission predicts pair completion; XeSS-FG// generation is suppressed over stable intervals when sustained// late. Export/images/paused frames never enter these paths.- uint64_t previewSkippedTotal=0,previewSkippedSinceSubmit=0;+ uint64_t previewSkippedTotal=0,previewSkippedSinceSubmit=0,previewSkipRetained=0;int64_t nextPreviewSkipLog=0;bool previewSkipSinceProcess=false;// Cumulative provider-submission totals already fed to the frame// flow. The AMD provider reports presentation from its own thread,@@ -495,7 +495,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sLivePairLatency pairLatency;const bool adaptiveCapturePhase=physicalCapture&&GetEnvironmentVariableW(L"VEYRA_TEST_LEGACY_CAPTURE_PHASE",nullptr,0)==0;int64_t nextFgAdmissionLog=0,nextFgRejectionLog=0;- uint64_t fgAdmittedPairs=0,fgRejectedPairs=0;+ uint64_t fgAdmittedPairs=0,fgRejectedPairs=0,fgReducedPairs=0;int64_t nextFgReducedLog=0;std::atomic<uint64_t> historyResets=0,presentationDrains=0,presentationCompletedReal=0,presentationSkippedGenerated=0,presentationCancelledJobs=0;std::atomic<uint64_t> presentationGeneration{0};std::unique_ptr<LiveGpuScheduler> liveScheduler;@@ -596,7 +596,9 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,swatch.flow->ready(batch.batch.batchId,watch.real,valid,invalid,host100ns());traceFrame(diagnostics::TraceKind::Ready,batch.batch.identity,batch.batch.batchId,std::max(batch.videoFenceValue,batch.genFenceValue),batch.batch.b100ns,invalid,valid,elapsedMs(watch.processStart));if(watch.real)completedProcessing(batch.batch.identity);- if(batch.batch.identity.settingsRevision==fgBudgetRevision)fgBudget.complete(watch.gpuExecutionMs,batch.fgEvaluated>0,batch.historyReset||batch.fgRecovery,host100ns(),watch.fgExecutionMs);+ // A reduced (2X) group must not lower the full-group FG+ // cost estimate; treat it like a warmup sample for costs.+ if(batch.batch.identity.settingsRevision==fgBudgetRevision)fgBudget.complete(watch.gpuExecutionMs,batch.fgEvaluated>0,batch.historyReset||batch.fgRecovery||batch.fgReduced,host100ns(),watch.fgExecutionMs);if(adaptiveCapturePhase&&watch.captureArrival>0&&valid==batch.fgCandidates&&batch.hasGenerated&&!batch.historyReset&&!batch.fgRecovery&&batch.batch.identity.settingsRevision==fgBudgetRevision&&watch.presentationGeneration==presentationGeneration.load()){@@ -823,7 +825,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s(previous.frameGenerationBackend!=requested.frameGenerationBackend||previous.multiplier!=requested.multiplier);if(accepted&&rebuild){presenter.close();graph.shutdown();markResetStage(diagnostics::ResetStage::Destroy);accepted=initializePreview(nextDesc,next,preserveWorkingFg);markResetStage(diagnostics::ResetStage::Create);- if(!accepted){presenter.close();graph.shutdown();if(!graph.initialize(gd)||!presenter.open(ctx,window,graph,options.settings.captureCompatible)||!graph.createViews()){status(L"设置失败且旧资源恢复失败,已停止",true);break;}}+ if(!accepted){presenter.close();graph.shutdown();if(!graph.initialize(gd)||!presenter.open(ctx,window,graph,options.settings.captureCompatible,!isCapture&&!isImage)||!graph.createViews()){status(L"设置失败且旧资源恢复失败,已停止",true);break;}}}else if(accepted)accepted=graph.applySettings(requested);if(rebuild)publishFrameGenerationCapabilities();if(accepted){@@ -983,7 +985,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sgd.nrBeforeSr=options.settings.lowLatency&&options.nr&&plan.srApplied;gd.enableSr=plan.srApplied&&(ctx.adapter().isNvidia||options.settings.videoSrQuality==kVideoSrFsr);gd.sourceWidth=width;gd.sourceHeight=height;gd.hdrInput=!isImage&&activeSource->info().color.isHdrPath();gd.hdrOutput=options.settings.useHdrPreview(gd.hdrInput,displayHdrActive());gd.workWidth=plan.base.width;gd.workHeight=plan.base.height;gd.nrWidth=plan.nr.width;gd.nrHeight=plan.nr.height;gd.flowWidth=plan.flow.width;gd.flowHeight=plan.flow.height;presenter.close();graph.shutdown();out={};hasOutput=false;- if(!graph.initialize(gd)||!presenter.open(ctx,window,graph,options.settings.captureCompatible)||!graph.createViews()){status(L"串流尺寸切换失败",true);break;}+ if(!graph.initialize(gd)||!presenter.open(ctx,window,graph,options.settings.captureCompatible,!isCapture&&!isImage)||!graph.createViews()){status(L"串流尺寸切换失败",true);break;}reset=true;pendingResetCause=pipeline::ResetReason::Resize;}const bool rereadCached=transaction&&frame==cachedFrame;@@ -1052,7 +1054,23 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s// lifecycle records continue (only hard resets — open/seek/// pause/discontinuity/settings — reopen them).const bool hardFrameReset=reset||pipeline::breaksHistory(pkt.flags&~static_cast<pipeline::FrameFlags>(pipeline::FrameFlagBits::Drop));- const bool temporalBreak=pipeline::breaksHistory(pkt.flags)||previewSkipSinceProcess;+ // A bounded preview skip (at most two dropped candidates, no+ // source discontinuity) keeps NR/FG/XeSS history: the graph's+ // A is still the last PROCESSED frame with its real PTS, so+ // motion, generated-frame PTS and temporal blending stay on+ // the true timeline, merely spanning 2-3 source periods.+ // Clearing history here made 25% of presented real frames+ // reset frames under load (review 2026-09-22): XeSS skipped+ // generation, NR reseeded, DLSS lost the whole group. Larger+ // skips still reset. VEYRA_TEST_PREVIEW_SKIP_RESET restores+ // the unconditional reset for A/B runs.+ static const bool skipAlwaysResets=GetEnvironmentVariableW(L"VEYRA_TEST_PREVIEW_SKIP_RESET",nullptr,0)>0;+ const bool boundedSkip=previewSkipSinceProcess&&!skipAlwaysResets&&previewSkippedSinceSubmit<=2&&!pipeline::breaksHistory(pkt.flags);+ if(boundedSkip){++previewSkipRetained;+ if(host100ns()>=nextPreviewSkipLog){nextPreviewSkipLog=host100ns()+10000000;+ veyra::log::info("preview-skip",std::format("retained history across {} skipped candidate(s) source={} retainedTotal={} skippedTotal={} (bounded skip; no NR/FG/XeSS reset)",previewSkippedSinceSubmit,pkt.sequence,previewSkipRetained,previewSkippedTotal));}+ }+ const bool temporalBreak=pipeline::breaksHistory(pkt.flags)||(previewSkipSinceProcess&&!boundedSkip);const bool previewOnlyReset=!hardFrameReset&&temporalBreak;if(hardFrameReset)++metricsWindowEpoch;const bool historyReset=hardFrameReset||temporalBreak;@@ -1135,6 +1153,22 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sconst auto admitted=fgBudget.admitFile(now,firstDeadline,deadline,interval/previewFgMultiplier,elapsed,blit,first,warmingHistory,queuedGpuMs);logAdmission(batch,now,deadline,elapsed,blit,admitted,warmingHistory,"file-audio",firstDeadline,queuedGpuMs);if(admitted)return pipeline::EnhanceGraph::FgDecision::Evaluate;+ // Over budget for the full group. Prefer a presentable+ // 2X group that keeps history over a whole-group hole+ // (16.7 ms gap every rejected pair at 6X, review+ // 2026-09-22). The UI reports previewFgMultiplier=2 for+ // the pair. VEYRA_TEST_FG_NO_REDUCED restores the old+ // reject/seed behaviour for A/B runs.+ static const bool reducedGroups=GetEnvironmentVariableW(L"VEYRA_TEST_FG_NO_REDUCED",nullptr,0)==0;+ if(reducedGroups&&!warmingHistory&&previewFgMultiplier>2){+ const auto midpoint=now+pipeline::FrameBatch::interpolate(a,batch.b100ns,1,2)-media;+ if(fgBudget.canAdmitReduced(now,midpoint,interval/2,elapsed,blit,first,queuedGpuMs)){+ ++fgReducedPairs;+ if(now>=nextFgReducedLog){nextFgReducedLog=now+10000000;+ veyra::log::info("live-fg-admission",std::format("timeline=file-audio revision={} source={} reduced=2X requestedMultiplier={} reducedPairs={} remainingMidpointMs={:.3f} predictedFullMs={:.3f} (history kept; presentable midpoint instead of whole-group hole)",batch.identity.settingsRevision,batch.identity.sourceFrameId,options.fgMultiplier,fgReducedPairs,double(midpoint-now)/10000,fgBudget.predicted(now,false).value_or(-1)));}+ return pipeline::EnhanceGraph::FgDecision::Reduced;+ }+ }if(!warmingHistory&&fgBudget.canAdmit(now,deadline,elapsed,blit,true,queuedGpuMs))return pipeline::EnhanceGraph::FgDecision::Seed;return pipeline::EnhanceGraph::FgDecision::Skip;@@ -1184,7 +1218,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sif(transaction){ring.drainQueue();out={};presenter.close();graph.shutdown();options=PlayerOptions::from(previous);gd=previousDesc;- if(graph.initialize(gd)&&presenter.open(ctx,window,graph,options.settings.captureCompatible)&&graph.createViews()&&graph.process(frame,pts,true,out,pkt.sequence,&pkt.colorInfo,&pkt.hardwareSurface,comparisonMode_!=0)){+ if(graph.initialize(gd)&&presenter.open(ctx,window,graph,options.settings.captureCompatible,!isCapture&&!isImage)&&graph.createViews()&&graph.process(frame,pts,true,out,pkt.sequence,&pkt.colorInfo,&pkt.hardwareSurface,comparisonMode_!=0)){publishFrameGenerationCapabilities();finishReset(diagnostics::ResetOutcome::RolledBack);std::lock_guard lock(mutex_);desired_.rejectVideoRequest(requested,previous);snapshot_.desired=desired_;snapshot_.rejectedRevision=requested.revision;snapshot_.applying=desired_!=previous;snapshot_.status=L"参数执行失败,已整套回滚";transaction=false;@@ -1194,6 +1228,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sif(transaction){std::lock_guard lock(mutex_);snapshot_.applied=options.snapshot();snapshot_.applying=desired_!=snapshot_.applied;snapshot_.status=std::format(L"输入 {}×{} / 底图 {}×{} / NR {}×{} / 光流 {}×{} / FG与输出 {}×{} | {}",width,height,gd.workWidth,gd.workHeight,gd.nrWidth,gd.nrHeight,gd.flowWidth,gd.flowHeight,gd.workWidth,gd.workHeight,gd.nrBeforeSr?L"低延迟 · NR先行后超分":gd.nrWidth<gd.workWidth?L"实时内部处理并回填":L"原生NR(性能成本较高)");veyra::log::info("display-color",std::format("hdrInput={} hdrOutput={} forceSdrPreview={}",gd.hdrInput,gd.hdrOutput,options.settings.forceSdrPreview));veyra::log::info("settings",std::format("Applied revision={} sourcePtsMs={} fgBackend={} flowBackend={} multiplier={} (source kept open)",options.settings.revision,pts,frameGenerationBackendName(options.settings.frameGenerationBackend),opticalFlowBackendName(options.settings.opticalFlowBackend),options.snapshot().multiplier));}if(veyra::log::verboseFrameLogs())veyra::log::info("source-identity",std::format("source={} totalRead={} graphProcessed={} cached={} revision={} nvofStandalone={}",pkt.sequence,sourceFrames,frames+1,rereadCached,options.settings.revision,gd.enableNvofStandalone));presenter.sourceProcessed(out.batch.identity);+ if(out.fgReduced||previewFgMultiplier!=options.fgMultiplier){std::lock_guard lock(mutex_);snapshot_.previewFgMultiplier=out.fgReduced?2u:previewFgMultiplier;}reset=false;hasOutput=true;const auto processDone=Clock::now();if(physicalCapture&&veyra::log::verboseFrameLogs())veyra::log::info("capture-graph-sample",std::format("source={} epoch={} revision={} arrival={} start={} submitted={} slotWaitMs={:.6f}",pkt.sequence,out.batch.identity.epoch,out.batch.identity.settingsRevision,captureArrival,std::chrono::duration_cast<std::chrono::nanoseconds>(processStart.time_since_epoch()).count()/100,std::chrono::duration_cast<std::chrono::nanoseconds>(processDone.time_since_epoch()).count()/100,processSlotWaitMs));@@ -1243,7 +1278,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.fgSkippedForReset+=out.fgSkippedForReset;m.counters.fgSkippedBeforeEval+=out.fgSkippedBeforeEval;if(out.fgSkippedBeforeEval||out.fgBudgetSeed)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;m.counters.fgReduced+=uint64_t(out.fgReduced);if(out.fgSkippedBeforeEval||out.fgBudgetSeed)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;diff --git a/src/engine/VideoPresenter.cpp b/src/engine/VideoPresenter.cppindex 1b0328fc..64303b35 100644--- a/src/engine/VideoPresenter.cpp+++ b/src/engine/VideoPresenter.cpp@@ -20,7 +20,7 @@ void VideoPresenter::sourceProcessed(pipeline::FrameIdentity identity){xessWork_[xessWorkPosition_]={identity,xessInputId_};xessWorkPosition_=(xessWorkPosition_+1)%xessWork_.size();xessInputId_=0;}-bool VideoPresenter::open(gfx::D3D12DeviceContext& ctx,HWND window,pipeline::EnhanceGraph& graph,bool captureCompatible) {+bool VideoPresenter::open(gfx::D3D12DeviceContext& ctx,HWND window,pipeline::EnhanceGraph& graph,bool captureCompatible,bool mediaClockPaced) {close();viewWidth_=viewHeight_=0;bufferMonitor_=nullptr;monitorWidth_=monitorHeight_=0;++generation_;@@ -38,7 +38,15 @@ bool VideoPresenter::open(gfx::D3D12DeviceContext& ctx,HWND window,pipeline::EnhgpuTimer_.initialize(ctx.device(),queue);window_=window;RECT rc{};GetClientRect(window,&rc);gfx::PresentSink::Desc d;d.targetWindow=window;d.width=std::max(1L,rc.right);d.height=std::max(1L,rc.bottom);d.vsync=false;d.waitable=!GetEnvironmentVariableW(L"VEYRA_TEST_LEGACY_SWAPCHAIN",nullptr,0);- d.hdr=graph.hdrOutput();d.hdr10=graph.hdr10Output();d.xess=graph.xessEnabled();d.fsr=graph.fsrEnabled();d.renderWidth=graph.workWidth();d.renderHeight=graph.workHeight();d.captureCompatible=captureCompatible;d.fgMultiplier=graph.fgMultiplier();lastXessFrame_={};lastXessIdentity_={};xessWasEnabled_=false;lastFsrFrame_={};lastFsrIdentity_={};fsrWasEnabled_=false;+ d.hdr=graph.hdrOutput();d.hdr10=graph.hdr10Output();d.xess=graph.xessEnabled();d.fsr=graph.fsrEnabled();d.renderWidth=graph.workWidth();d.renderHeight=graph.workHeight();d.captureCompatible=captureCompatible;d.fgMultiplier=graph.fgMultiplier();+ // Candidate X2 (2026-09-22) tried XeLL pass-through for media-clock-paced+ // sources; the audited provider then rejects generation with -15+ // (LATENCY_REDUCTION_UNSUPPORTED) and Intel's guide states frame+ // generation is disabled unless XeLL is enabled. Keep low latency on.+ // VEYRA_TEST_XESS_LOW_LATENCY=0 remains a diagnostic-only toggle.+ (void)mediaClockPaced;+ wchar_t lowLatency[4]{};+ d.xessLowLatencySleep=!(GetEnvironmentVariableW(L"VEYRA_TEST_XESS_LOW_LATENCY",lowLatency,4)&&lowLatency[0]==L'0');lastXessFrame_={};lastXessIdentity_={};xessWasEnabled_=false;lastFsrFrame_={};lastFsrIdentity_={};fsrWasEnabled_=false;if(d.xess){bufferMonitor_=MonitorFromWindow(window,MONITOR_DEFAULTTONEAREST);MONITORINFO monitor{sizeof(monitor)};@@ -170,13 +178,23 @@ bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing&// the next continuous frame can interpolate without another warmup.const bool enabled=regionVisible&&!generated&&!comparison&&graph.presentMotion(slot)&&graph.presentDepth()&&identity.sourceFrameId!=lastXessIdentity_.sourceFrameId&&!xessGenerationSuppressed_;const bool reset=!graph.presentMotionValid(slot)||!xessWasEnabled_||identity.epoch!=lastXessIdentity_.epoch||identity.settingsRevision!=lastXessIdentity_.settingsRevision||graph.motionPreviousSource(slot)!=lastXessIdentity_.sourceFrameId;- // Present intervals include the provider's own wait. Do not feed that- // wait back into its pacing. Intel explicitly permits zero when an- // independent frame-time estimate is unavailable.+ // frameRenderTime is the provider's only independent period estimate on+ // non-Intel GPUs. Feeding present-to-present time back would include the+ // provider's own wait and lengthen the next burst (measured 2026-09-21).+ // Zero makes it infer the period from observed presents, which under+ // load fed the owner-thread Present block back into the burst spacing+ // (8.5 ms in-burst at 4X against a 16.67 ms source, review 2026-09-22).+ // Supply the real consecutive source PTS delta instead: only with valid+ // history, an identity that advanced by exactly one, increasing PTS and+ // a plausible range. Resets, skips and repeats keep zero.+ // VEYRA_DISABLE_XESS_SOURCE_TIMING restores the old zero for A/B runs.float elapsed=0.0f;- static const bool sourceTiming=GetEnvironmentVariableW(L"VEYRA_TEST_XESS_SOURCE_TIMING",nullptr,0)>0;+ static const bool sourceTiming=GetEnvironmentVariableW(L"VEYRA_DISABLE_XESS_SOURCE_TIMING",nullptr,0)==0;+ // Identity may advance by more than one across a bounded preview+ // skip (history kept); the interval the provider must bridge is then+ // the real PTS delta of the two presented sources, not zero.if(sourceTiming&&!reset&&lastXessPts100ns_>=0&&sourcePts100ns>lastXessPts100ns_&&- identity.sourceFrameId==lastXessIdentity_.sourceFrameId+1){+ identity.sourceFrameId>lastXessIdentity_.sourceFrameId){const auto delta=double(sourcePts100ns-lastXessPts100ns_)/10000;if(delta>=0.125&&delta<500)elapsed=float(delta);}@@ -235,6 +253,12 @@ bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing&const bool slow=ms(presentEnd-presentStart)>=80.0;if(slow||presentEnd>=nextCostLog_){nextCostLog_=presentEnd+std::chrono::seconds(1);+ // Display-side sample (F4, review 2026-09-22): which submissions the+ // display actually scanned out. This is still not a photon measurement.+ static const bool displayStats=GetEnvironmentVariableW(L"VEYRA_TEST_NO_DISPLAY_STATS",nullptr,0)==0;+ const auto stats=displayStats?sink_.sampleFrameStatistics():gfx::PresentSink::FrameStatisticsDelta{};+ if(stats.supported)veyra::log::info("display-stats",std::format("refreshHz={:.3f} presents={} displayed={} refreshes={} notDisplayed={} refreshesWithoutNewFrame={} backend={} (DXGI GetFrameStatistics delta over ~1s; XeSS/FSR generated presents are provider-internal and not counted in presents)",sink_.displayRefreshHz(),stats.presents,stats.displayed,stats.refreshes,stats.presents>stats.displayed?stats.presents-stats.displayed:0,stats.refreshes>stats.displayed?stats.refreshes-stats.displayed:0,sink_.xess()?"XeSS":sink_.fsr()?"FSR":"DXGI"));+ else if(FAILED(stats.result))veyra::log::info("display-stats",std::format("unavailable hr=0x{:X} backend={}",unsigned(stats.result),sink_.xess()?"XeSS":sink_.fsr()?"FSR":"DXGI"));const auto& timing=sink_.lastPresentTiming();veyra::log::info("present-cost",std::format("generated={} totalMs={:.3f} recordSubmitMs={:.3f} slotWaitMs={:.3f} dxgiMs={:.3f} slow={} source={} epoch={} backend={} resized={} resizeMs={:.3f} beginMs={:.3f} commandsMs={:.3f} beforeMs={:.3f} presentCallMs={:.3f} bufferMs={:.3f} afterMs={:.3f} hr=0x{:X}",generated,std::chrono::duration<double,std::milli>(presentEnd-presentStart).count(),diff --git a/src/gfx/PresentSink.cpp b/src/gfx/PresentSink.cppindex 4bb99430..d92da104 100644--- a/src/gfx/PresentSink.cpp+++ b/src/gfx/PresentSink.cpp@@ -236,7 +236,7 @@ bool PresentSink::initialize(ID3D12Device* device, ID3D12CommandQueue* queue,for(auto& b:backBuffers_)b.Reset();swapChain_.Reset();xess_=std::make_unique<XessPresenter>();- if(!xess_->initialize(device,queue,factory_.Get(),hwnd_,scd,swapChain_.GetAddressOf(),desc.fgMultiplier)){+ if(!xess_->initialize(device,queue,factory_.Get(),hwnd_,scd,swapChain_.GetAddressOf(),desc.fgMultiplier,desc.xessLowLatencySleep)){// XeSS is an optional experimental presenter. A missing or// incompatible local runtime must not prevent basic playback.log::warn("present", "XeSS FG initialization failed; falling back to native presentation");@@ -300,6 +300,9 @@ bool PresentSink::initialize(ID3D12Device* device, ID3D12CommandQueue* queue,if(!configurePacing(false,desc.vsync))log::warn("pacing","baseline latency configuration failed; playback remains available");}tearingSupported_=tearingSupported_&&(actual.Flags&DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING)!=0;+ displayRefreshHz_=displayRefreshFps(hwnd_);+ frameStatisticsBaseValid_=false;+ log::info("display-refresh",std::format("monitor refresh={:.3f} Hz at swapchain creation (0 = unknown); submissions above this rate cannot all be scanned out",displayRefreshHz_));log::info("present", std::format("present-sink: window {}x{} swapEffect={} buffers=3 vsync={} tearing={} captureCompatible={} (capture not verified)",width_, height_, actual.SwapEffect==DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL?"flip-sequential":"flip-discard", desc_.vsync ? 1 : 0, tearingSupported_ ? 1 : 0, desc.captureCompatible));return true;@@ -423,6 +426,27 @@ bool PresentSink::present(Status& status)return false;}+PresentSink::FrameStatisticsDelta PresentSink::sampleFrameStatistics(){+ FrameStatisticsDelta delta;+ if(!swapChain_)return delta;+ DXGI_FRAME_STATISTICS stats{};+ delta.result=swapChain_->GetFrameStatistics(&stats);+ // DXGI_ERROR_FRAME_STATISTICS_DISJOINT: mode change or first frames; a+ // proxy swapchain may also refuse the query. Restart the baseline.+ if(FAILED(delta.result)){frameStatisticsBaseValid_=false;return delta;}+ if(frameStatisticsBaseValid_){+ delta.supported=true;+ delta.presents=presentCount_-frameStatisticsBasePresents_;+ delta.displayed=uint64_t(stats.PresentRefreshCount-frameStatisticsBasePresentRefresh_);+ delta.refreshes=uint64_t(stats.SyncRefreshCount-frameStatisticsBaseSyncRefresh_);+ }+ frameStatisticsBaseValid_=true;+ frameStatisticsBasePresents_=presentCount_;+ frameStatisticsBasePresentRefresh_=stats.PresentRefreshCount;+ frameStatisticsBaseSyncRefresh_=stats.SyncRefreshCount;+ return delta;+}+bool PresentSink::configurePacing(bool enabled,bool vsync){// XeSS owns pacing, but its proxy accepts DXGI VSync independently.// Do not install another latency waiter on the provider swap chain.@@ -491,6 +515,7 @@ void PresentSink::resize(uint32_t width, uint32_t height)bufferExtentW_ = width_;bufferExtentH_ = height_;pendingResize_ = true;+ frameStatisticsBaseValid_=false;log::info("present", std::format("present-sink: resized to {}x{}", width_, height_));}diff --git a/src/gfx/XessPresenter.cpp b/src/gfx/XessPresenter.cppindex b652b90d..6b9813c3 100644--- a/src/gfx/XessPresenter.cpp+++ b/src/gfx/XessPresenter.cpp@@ -96,7 +96,7 @@ struct XessPresenter::Impl {};XessPresenter::XessPresenter():p_(std::make_unique<Impl>()){}XessPresenter::~XessPresenter()=default;-bool XessPresenter::initialize(ID3D12Device* device,ID3D12CommandQueue* queue,IDXGIFactory2* factory,HWND window,const DXGI_SWAP_CHAIN_DESC1& desc,IDXGISwapChain3** swapchain,uint32_t fgMultiplier){+bool XessPresenter::initialize(ID3D12Device* device,ID3D12CommandQueue* queue,IDXGIFactory2* factory,HWND window,const DXGI_SWAP_CHAIN_DESC1& desc,IDXGISwapChain3** swapchain,uint32_t fgMultiplier,bool lowLatencySleep){if(GetEnvironmentVariableW(L"VEYRA_TEST_XESS_INIT_FAILURE",nullptr,0)){log::warn("xess-fg","test-only initialization rejection; runtime not loaded");return false;}@@ -156,8 +156,9 @@ bool XessPresenter::initialize(ID3D12Device* device,ID3D12CommandQueue* queue,ID}if(!p.check(p.xellD3D12CreateContextFn(device,&p.ll),"XeLL create",true)||!p.check(p.xefgSwapChainD3D12CreateContextFn(device,&p.fg),"Create",true))return false;if(!p.check(p.xefgSwapChainSetLatencyReductionFn(p.fg,p.ll),"Attach XeLL",true))return false;- xell_sleep_params_t sleep{};sleep.bLowLatencyMode=1;+ xell_sleep_params_t sleep{};sleep.bLowLatencyMode=lowLatencySleep?1:0;if(!p.check(p.xellSetSleepModeFn(p.ll,&sleep),"XeLL sleep mode",true))return false;+ log::info("xess-fg",std::format("XeLL bLowLatencyMode={} (0 = pass-through; sleep/markers still issued per XeLL contract)",unsigned(sleep.bLowLatencyMode)));// Query the real ceiling before deciding what to request. The unlock (U5)// is what makes this report more than 1 on a non-Intel GPU.{@@ -194,7 +195,7 @@ bool XessPresenter::initialize(ID3D12Device* device,ID3D12CommandQueue* queue,IDif(p.requestedGenerated>0&&!p.check(p.xefgSwapChainSetNumInterpolatedFramesFn(p.fg,p.requestedGenerated),"SetNumInterpolatedFrames",true))return false;return p.check(p.xefgSwapChainD3D12GetSwapChainPtrFn(p.fg,__uuidof(IDXGISwapChain3),reinterpret_cast<void**>(swapchain)),"GetSwapChain",true);#else- (void)device;(void)queue;(void)factory;(void)window;(void)desc;(void)swapchain;(void)fgMultiplier;+ (void)device;(void)queue;(void)factory;(void)window;(void)desc;(void)swapchain;(void)fgMultiplier;(void)lowLatencySleep;log::error("xess-fg","Intel XeSS SDK unavailable at build time");return false;#endif}diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cppindex 8f46b0c4..2142bb6a 100644--- a/src/pipeline/EnhanceGraph.cpp+++ b/src/pipeline/EnhanceGraph.cpp@@ -1933,13 +1933,19 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frameconst bool reseedRejected=decision==FgDecision::Seed;out.fgBudgetSeed=reseedRejected;if(reseedRejected)resetFg=true;+ // Reduced groups only make sense with valid history; on a reset the+ // seed path already runs a single evaluation.+ const bool reduced=decision==FgDecision::Reduced&&!resetFg;+ out.fgReduced=reduced;// 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:fgMultiplier-1;+ const uint32_t fgCalls=(resetFg||reduced)?1:fgMultiplier-1;+ const unsigned outputMultiplier=reduced?2u:fgMultiplier;if(runFg&&resetFg){if(reseedRejected)out.fgSkippedBeforeEval=out.fgCandidates-fgCalls;else out.fgSkippedForReset=out.fgCandidates-fgCalls;}+ if(reduced)out.fgSkippedBeforeEval=out.fgCandidates-fgCalls;out.fgRecovery=runFg&&(fgHistorySkipped_||reseedRejected);if(fgBackendAvailable&&!runFg){out.fgSkippedBeforeEval=out.fgCandidates;fgHistorySkipped_=true;}if(!runFg)gpuTimer_.resolve(list);@@ -1998,7 +2004,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frameif(out.hasGenerated){++metrics_.fgSubmittedCandidates;BatchFrame f;f.identity=out.batch.identity;f.kind=FrameKind::Generated;f.validity=GenerationValidity::Pending;f.subframe=sub;- f.pts100ns=FrameBatch::interpolate(out.batch.a100ns,out.batch.b100ns,sub,fgMultiplier);+ f.pts100ns=FrameBatch::interpolate(out.batch.a100ns,out.batch.b100ns,sub,outputMultiplier);f.lease=std::make_shared<FrameLease>();f.lease->texture=genFrame_[generatedSlot];f.lease->slot=generatedSlot;f.lease->readyFence=out.genFenceValue;f.lease->readyFenceObject=out.genFenceObject;generatedLeases_[generatedSlot]=f.lease;out.batch.append(std::move(f));}}diff --git a/tests/unit/LiveGpuSchedulerTests.cpp b/tests/unit/LiveGpuSchedulerTests.cppindex ae47803b..78b51e83 100644--- a/tests/unit/LiveGpuSchedulerTests.cpp+++ b/tests/unit/LiveGpuSchedulerTests.cpp@@ -76,6 +76,18 @@ int main(){check(prefix.admit(10000000,10200000,0,0)&&prefix.recovering(),"first admitted group begins recovery");check(prefix.canAdmit(10000000,10010000,0,0,true)&&prefix.recovering(),"seed affordability query cannot falsely complete recovery");}+ {+ // Reduced (2X) group: base 8 ms + one measured first interpolation+ // 3 ms must reach the pair midpoint; the full group (base + 10) need not.+ veyra::engine::FgRecoveryBudget reduced;+ reduced.complete(18,true,false,10000000,10);+ check(!reduced.admitFile(10000000,10100000,10150000,27778,0,0,3,false,0),"full group over budget for the last output");+ check(reduced.canAdmitReduced(10000000,10150000,83333,0,0,3,0),"midpoint reachable with base plus one interpolation");+ check(!reduced.canAdmitReduced(10000000,10020000,83333,0,0,3,0),"midpoint too early rejects the reduced group even with one-output grace");+ check(!reduced.canAdmitReduced(10000000,10150000,83333,0,0,std::nullopt,0),"unmeasured first interpolation cannot admit a reduced group");+ check(!reduced.canAdmitReduced(10000000,10150000,83333,0,0,3,15),"queued earlier GPU work consumes the reduced deadline");+ check(!reduced.recovering(),"reduced affordability query does not touch recovery state");+ }{veyra::engine::FgRecoveryBudget queued;queued.complete(10,true,false,10000000,4);diff --git a/tools/fg_harness/fg_test.cpp b/tools/fg_harness/fg_test.cppindex feab7c65..5c3528b5 100644--- a/tools/fg_harness/fg_test.cpp+++ b/tools/fg_harness/fg_test.cpp@@ -362,8 +362,12 @@ void copyUploadToTexture(ID3D12GraphicsCommandList* list, ID3D12Resource* dst,// Diagnostic readback only: isolate the NGX backend from graph scheduling,// pool ownership, source conversion and optical-flow estimation.+// alternateGroups: per-frame multiFrameCount 5,1,5,1,... WITHOUT reset,+// to learn whether a pair over budget may run a smaller group and keep+// history (F3 precondition, review 2026-09-22). Position/uniqueness checks+// apply to every generated frame; group 1 expects the midpoint.static bool runPlanarSix(veyra::gfx::CommandSlotRing& ring,- veyra::ngx::NgxCoreHost& core, NVSDK_NGX_Parameter* params, GpuTextures& t)+ veyra::ngx::NgxCoreHost& core, NVSDK_NGX_Parameter* params, GpuTextures& t, bool alternateGroups=false){veyra::Status status = veyra::Status::Ok;veyra::ngx::DlssFgBackend fg;@@ -383,7 +387,8 @@ static bool runPlanarSix(veyra::gfx::CommandSlotRing& ring,}std::memcpy(t.mappedColor,current.data(),current.size());uint64_t previousHash=0;- for(unsigned sub=1;ok&&sub<=5;++sub){+ const unsigned groupCount=alternateGroups&&(frame%2==0)?1u:5u;+ for(unsigned sub=1;ok&&sub<=groupCount;++sub){list=ring.acquire(0,status);if(!list){ok=false;break;}if(sub==1){copyUploadToTexture(list,t.backbuffer.Get(),t.uploadColor.Get(),DXGI_FORMAT_R8G8B8A8_UNORM,kWidth,kHeight);@@ -397,7 +402,7 @@ static bool runPlanarSix(veyra::gfx::CommandSlotRing& ring,veyra::ngx::DlssFgBackend::EvalDesc evaluate{};evaluate.backbuffer=t.backbuffer.Get();evaluate.depth=t.depth.Get();evaluate.mvecs=t.mvecs.Get();evaluate.outputInterpolated=t.outInterp.Get();evaluate.outputDisableInterpolation=t.disableFlag.Get();- evaluate.reset=frame==0;evaluate.frameId=frame+1;evaluate.multiFrameCount=5;evaluate.multiFrameIndex=sub;+ evaluate.reset=frame==0;evaluate.frameId=frame+1;evaluate.multiFrameCount=groupCount;evaluate.multiFrameIndex=sub;evaluate.mvecScaleX=1.0f/kWidth;evaluate.mvecScaleY=1.0f/kHeight;ok=fg.evaluate(list,params,evaluate,status);for(unsigned j=0;j<5;++j){barriers[j].Transition.StateBefore=barriers[j].Transition.StateAfter;barriers[j].Transition.StateAfter=j<3?D3D12_RESOURCE_STATE_COMMON:D3D12_RESOURCE_STATE_COPY_SOURCE;}@@ -427,16 +432,20 @@ static bool runPlanarSix(veyra::gfx::CommandSlotRing& ring,}const uint64_t hash=fnv1a64(pixels,current.size());const bool unique=hash!=previousHash&&hash!=fnv1a64(previous.data(),previous.size())&&hash!=fnv1a64(current.data(),current.size());- const bool position=std::abs(shift-16.0*sub/6)<=1.0;+ const double expectedShift=16.0*sub/(groupCount+1);+ const bool position=std::abs(shift-expectedShift)<=1.0;++generated;distinct+=unique;accurate+=position&&unique&&!*flag;previousHash=hash;- log::info("fg-planar6",std::format("frame={} sub={} expected={:.3f} observed={:.3f} distinct={} disabled={} positionPass={}",frame,sub,16.0*sub/6,shift,unique,unsigned(*flag),position));+ log::info("fg-planar6",std::format("frame={} group={} sub={} expected={:.3f} observed={:.3f} distinct={} disabled={} positionPass={}",frame,groupCount,sub,expectedShift,shift,unique,unsigned(*flag),position));t.readbackInterp->Unmap(0,nullptr);t.readbackFlag->Unmap(0,nullptr);}previous=current;}const bool drained=ring.drainQueue();fg.release();- log::info("fg-planar6",std::format("directNGX=true generated={} distinct={} contentValid={} graphUsed=false",generated,distinct,accurate));- return ok&&drained&&generated==55&&accurate==55;+ // 12 frames: frame 0 is the reset seed (its outputs are not scored).+ // Fixed 5: 11*5=55. Alternating 1/5 from frame 1: odd frames 5, even frames 1 -> 6*5+5*1=35.+ const unsigned expectedGenerated=alternateGroups?35u:55u;+ log::info("fg-planar6",std::format("directNGX=true alternateGroups={} generated={} distinct={} contentValid={} expected={} graphUsed=false",alternateGroups,generated,distinct,accurate,expectedGenerated));+ return ok&&drained&&generated==expectedGenerated&&accurate==expectedGenerated;}// Runs one DLSSG phase (translation or cut) for a given mvec convention.@@ -838,7 +847,7 @@ int runFgTest(const FgTestArgs& args)}if(args.planarSix){- const bool passed=caps.multiFrameCountMax>=5&&runPlanarSix(ring,coreHost,params,textures);+ const bool passed=caps.multiFrameCountMax>=5&&runPlanarSix(ring,coreHost,params,textures,args.alternateGroups);coreHost.destroyParameters(params);coreHost.shutdown();ring.shutdown();context.shutdown();return passed?0:1;}diff --git a/tools/fg_harness/fg_test.h b/tools/fg_harness/fg_test.hindex 741f5a1d..cf8f0b17 100644--- a/tools/fg_harness/fg_test.h+++ b/tools/fg_harness/fg_test.h@@ -18,6 +18,7 @@ struct FgTestArgs {std::wstring captureDir;bool capabilityOnly = false; // --fg-cap: query + honest JSON, no createbool planarSix = false; // Direct NGX diagnostic; no player/EnhanceGraph.+ bool alternateGroups = false; // planarSix with multiFrameCount 1/5 alternating, no reset.};// Runs the full FG truth test and writes JSON to args.jsonFile.diff --git a/tools/fg_harness/main.cpp b/tools/fg_harness/main.cppindex 0afc71de..97503e31 100644--- a/tools/fg_harness/main.cpp+++ b/tools/fg_harness/main.cpp@@ -19,7 +19,7 @@ namespace {void printUsage(){std::fprintf(stderr,- "usage: veyra_fg_harness --fg-cap | --fg-test | --fg-planar6 | --audio-test\n"+ "usage: veyra_fg_harness --fg-cap | --fg-test | --fg-planar6 | --fg-planar-alt | --audio-test\n"" [--runtime-dir DIR] [--run-id ID] [--log-file FILE] [--json-file FILE]\n"" [--capture-dir DIR]\n");}@@ -31,7 +31,7 @@ int main(int argc, char** argv)using namespace veyra::harness;bool doCap = false, doFgTest = false, doAudio = false;- bool planarSix = false;+ bool planarSix = false, alternateGroups = false;std::wstring runtimeDir;std::string runId = "fg-harness";std::wstring logFile, jsonFile, captureDir;@@ -41,6 +41,7 @@ int main(int argc, char** argv)if (arg == "--fg-cap") doCap = true;else if (arg == "--fg-test") doFgTest = true;else if (arg == "--fg-planar6") { doFgTest = true; planarSix = true; }+ else if (arg == "--fg-planar-alt") { doFgTest = true; planarSix = true; alternateGroups = true; }else if (arg == "--audio-test") doAudio = true;else if (arg == "--run-id" && i + 1 < argc) runId = argv[++i];else if (arg == "--runtime-dir" && i + 1 < argc) {@@ -84,6 +85,7 @@ int main(int argc, char** argv)args.jsonFile = jsonFile;args.captureDir = captureDir;args.planarSix = planarSix;+ args.alternateGroups = alternateGroups;return runFgTest(args);}AudioTestArgs args{};